I need to create a means to add a custom annotation like
@Value(\"${my.property}\")
However, in my case I need to get the value from a data
Alternatively you should be able to configure kind of properties repository bean and then use it in SpEL directly in @Value annotation.
Let's say you'd have bean called propertiesRepository
in your context that implements following interface:
interface PropertiesRepository {
String getProperty(String propertyName);
}
then on bean where you want to inject values you can use following expression
@Value("#{propertiesRepository.getProperty('my.property')}")
String myProperty;