Dynamic @Value-equivalent in Spring?
Autowire the Environment object in your class. Then you will be able to access the properties using environment.getProperty(propertyName);
@Autowiredprivate Environment environment;// access it as below wherever required. environment.getProperty(propertyName);
Also add @PropertySource on Config class.
@Configuration@PropertySource("classpath:some.properties")public class ApplicationConfiguration
inject BeanFactory into your bean.
@Autowired BeanFactory factory;
then cast and get the property from the bean
((ConfigurableBeanFactory) factory).resolveEmbeddedValue("${propertie}")