PropertiesConfiguration.java
3.29 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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;
}
/**
* 车牌类型
* 博康的车牌类型指文安的号牌颜色
* @return
*/
@Bean(name = "plateTypeProp")
public Properties plateTypeProp() {
Properties properties = new Properties();
try (InputStream inputStream = PropertiesConfiguration.class.getResourceAsStream("/hpys.properties")) {
properties.load(inputStream);
} catch (Exception e) {
log.error("读取 hpys.properties 失败", e);
}
return properties;
}
}