PropertiesConfiguration.java
2.79 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.viontech.configuration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.InputStream;
import java.util.Properties;
/**
* .
*
* @author 谢明辉
* @date 2020/8/31
*/
@Configuration
@Slf4j
public class PropertiesConfiguration {
public static String username;
public static String password;
@Value("${login.username}")
public void setUsername(String username) {
PropertiesConfiguration.username = username;
}
@Value("${login.password}")
public void setPassword(String password) {
PropertiesConfiguration.password = password;
}
@Bean(name = "directionProp")
public Properties directionProp() {
Properties properties = new Properties();
try (InputStream inputStream = PropertiesConfiguration.class.getResourceAsStream("/fxlb.properties")) {
properties.load(inputStream);
} catch (Exception e) {
log.error("读取 fxlb.properties 失败", e);
}
return properties;
}
@Bean(name = "manufactureLogoProp")
public Properties manufactureLogoProp() {
Properties properties = new Properties();
try (InputStream inputStream = PropertiesConfiguration.class.getResourceAsStream("/clpp.properties")) {
properties.load(inputStream);
} catch (Exception e) {
log.error("读取 clpp.properties 失败", e);
}
return properties;
}
@Bean(name = "vehicleColorProp")
public Properties vehicleColorProp() {
Properties properties = new Properties();
try (InputStream inputStream = PropertiesConfiguration.class.getResourceAsStream("/csys.properties")) {
properties.load(inputStream);
} catch (Exception e) {
log.error("读取 csys.properties 失败", e);
}
return properties;
}
@Bean(name = "illegalTypeProp")
public Properties illegalTypeProp() {
Properties properties = new Properties();
try (InputStream inputStream = PropertiesConfiguration.class.getResourceAsStream("/wzlx.properties")) {
properties.load(inputStream);
} catch (Exception e) {
log.error("读取 wzlx.properties 失败", e);
}
return properties;
}
@Bean(name = "eventProp")
public Properties behaviorProp() {
Properties properties = new Properties();
try (InputStream inputStream = PropertiesConfiguration.class.getResourceAsStream("/sjlx.properties")) {
properties.load(inputStream);
} catch (Exception e) {
log.error("读取 sjlx.properties 失败", e);
}
return properties;
}
}