Issue with Spring profiles and my properties files
Hello,
I am trying to activate one set of properties files for one Spring profile and another set for another Spring profile as follows:
Code:
<beans profile="cloud">
<context:property-placeholder location="classpath*:META-INF/spring/cloud/*.properties" />
</beans>
<beans profile="default">
<context:property-placeholder location="classpath*:META-INF/spring/default/*.properties" />
</beans>
I have the corresponding and appropriate directory structure in my src/main/resources folder.
I have a simple @Value("${application.url}") in one of my services and I systematically get the following error:
Error creating bean with name 'mailerServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.Be anCreationException: Could not autowire field: private java.lang.String com.kadjoukor.service.MailerServiceImpl.websiteCon text; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'application.url' in string value "${application.url}"
Note that I have tried adding a spring.profiles.active init-param to my web.xml. It doesn't make any difference...
Could it matter that the above snippets of configuration are located at the bottom of the configuration file?
Otherwise, I am not sure what I am getting wrong. Can anyone please provide advice?
Regards,
J.