forked from t-hong/springboot-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfileProperties.java
More file actions
39 lines (31 loc) · 979 Bytes
/
ProfileProperties.java
File metadata and controls
39 lines (31 loc) · 979 Bytes
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
package com.hong.service;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* @ClassName: ProfileProperties
* @Description: (获取多环境下的属性参数)
* @author hong
* @date 2017/4/19
* @version v1.1
*/
@Component
@ConfigurationProperties(prefix = "spring.server")
// 指定对应的配置文件的路径
@PropertySource(ignoreResourceNotFound = true, value = "classpath:conf/${spring.profiles.active}/application-${spring.profiles.active}.properties")
public class ProfileProperties {
private String address;
private String port;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
}