When I recently made a project with Spring-boot, I encountered a problem that the custom profile could not read, by defining @propertysource on the Appcation.java class (value = {"Classpath:XXX.properties"} , encoding= "Utf-8"), and then reads the properties file configuration in the component using @value, etc., is always a null value, and the last discovery is that the project data layer is the EJB access that is used. A bean is then defined in the Ejb-config.xml configuration file:
<bean id= "Propertyconfigurer" class= " Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer " lazy-init=" false "> <property name= "Locations" > <list> <value>classpath*:jnpurl.properties</value > </list> </property> </bean>
Because of this configuration, the Spring-boot code configuration is overwritten, so the previously configured annotation profile is not read.
The workaround is to place the profile in a uniform location: In a bean that is written uniformly in a configuration file, or in a uniform configuration in code annotations.
Spring-boot configuration File Reference:
Http://www.cnblogs.com/hafiz/p/5876243.html
http://blog.csdn.net/je_ge/article/details/54783184
http://tengj.top/2017/02/28/springboot2/
"Daily Error" Spring-boot configuration file not read