@ConfigurationProperties locations deprecated

The example tells me to add:

@ConfigurationProperties(prefix=”my”, locations=”classpath:example.properties”)

However, it was removed from Spring 1.5 I believe, so that’s not available. Googling told me to add this annotation:

@PropertySource(“classpath:example.properties”)

But that doesn’t work either. The reason is because:

“In certain situations, it may not be possible or practical to tightly control property source ordering when using @ProperySource annotations. For example, if the @Configuration classes above were registered via component-scanning, the ordering is difficult to predict.”

Taken from:

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/PropertySource.html

I think I’ll just leave this example. The video was trying to show all the different ways to get the property, using Profiles and different ways to wire up the beans. Honestly, it’s all a bit of a muddle at this stage, so I’m not going to debug old deprecated code.

 

Leave a comment