I am using Spring 3 and also heavily utilize the well known @Autowire annotation. I would like to create a new annotation, let’s call it @Property that autowires Java properties from set by .property files or vm arguments.
Considering the following class
class A {
@Property("my.a")
private int a;
}
if the property my.a is present, the property A.a is set.
Is such an annotation maybe already existing? If not I am aiming to create one, as mentioned above. Are the utilities given by spring to achieve my goal? I think about creating a BeanPostProcessor …
Thanks for your hints!
There’s already such an annotation –
@ValueYou should just define a
PropertyPlaceHolderConfigurer, and configure it to resolve system properties.