QuartzConfigProperties.java
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.yoho.quartz.scheduler;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import java.util.Properties;
/**
* Author:yanzhang.fu
* Date:2018/1/29
* Description:
* Modified By:
**/
public class QuartzConfigProperties implements FactoryBean {
private Resource customConfigLocation;
@Override
public Object getObject() throws Exception {
if (customConfigLocation == null) {
return null;
}
Properties prop = new Properties();
try {
PropertiesLoaderUtils.fillProperties(prop, this.customConfigLocation);
} catch (Exception e) {
return null;
}
return prop;
}
@Override
public Class<?> getObjectType() {
return Properties.class;
}
@Override
public boolean isSingleton() {
return true;
}
public Resource getCustomConfigLocation() {
return customConfigLocation;
}
public void setCustomConfigLocation(Resource customConfigLocation) {
this.customConfigLocation = customConfigLocation;
}
}