spring注解之PropertySources
@Configuration
@PropertySources(
@PropertySource(value = "classpath:/config/load.properties",ignoreResourceNotFound = true,encoding = "UTF-8")
)
public class ServerProperties {
@Value("${liubin.test.name}")
private String name;
public String getName() {
return name;
}
}
@PropertySource 功能类似与
<context:property-placeholder location="classpath*:/config/load.properties"/>