1

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?

sam3131
  • 357
  • 1
  • 9
  • have you created configuration class, where you imported your xml configs? like: `@Configuration @ImportResource({"classpath*:applicationContext.xml"}) public class XmlConfiguration { }` – BSeitkazin Dec 26 '18 at 11:23
  • specify the properties file location in xml file `` – Ryuzaki L Dec 26 '18 at 11:24
  • @BSeitkazin yes i imported my applicationContext.xml in the main springboot class – sam3131 Dec 26 '18 at 13:47
  • @Deadpool it is not working because property files loaded by the cloud config server are not available on the classpath – sam3131 Dec 26 '18 at 13:48

1 Answers1

0

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)

sam3131
  • 357
  • 1
  • 9