I am configuring config server to use in a springboot application The application has recently been migrated from spring to springboot so most of the properties are used in applicationContext.xml files
Example :
<bean id="rabbitConnectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
<property name="address" value="${rabbitmq.address}"/>
</bean>
This throw an IllegalArgumentException : Could not resolve placeholder
I also have my configuration Properties file to load some properties by prefix, and I can use my properties if I declare them in the class below:
@Configuration
@ConfigurationProperties
public class ConfiguationProperties {}
But I don't want to put all the properties in the configuration properties file and keep my applicationContext directly loading properties using placeholders syntax, is there a possibility?
My error was that the path to my configuration files was incorrect because my properties files were in a subdirectory of my config path ${config-path}/subdirectory/myapplication-dev.properties
i removed the subdirectory and it works fine. It seems that the config server load correctly the properties files in the classpath only if it respects the schema url :
http://localhost:8888/${my-profile}/myapplication
and not :
http://localhost:8888/subdirectory/${my-profile}/myapplication
(event if i can see my properties in the web browser with this url)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.