5

I'm trying to use JSR-330 annotations with Spring 3.

Is there a JSR-330 equivalent of Spring's @Value annotation for inserting property values? e.g. can I use @Provider in a way that will instruct Spring to inject a property value?

joelittlejohn
  • 11,665
  • 2
  • 41
  • 54

1 Answers1

6

I looked for usages of @Value in a project that is using org.springframework.beans-3.0.5.RELEASE.jar. The annotation is referenced in two places here, AutowiredAnnotationBeanPostProcessor and QualifierAnnotationAutowireCandidateResolver.

In AutowiredAnnotationBeanPostProcessor, the only JSR-330 annotation mentioned is javax.inject.Inject.

public AutowiredAnnotationBeanPostProcessor()
{
    this.autowiredAnnotationTypes.add(Autowired.class);
    this.autowiredAnnotationTypes.add(Value.class);
    ClassLoader cl = AutowiredAnnotationBeanPostProcessor.class.getClassLoader();
    try {
        this.autowiredAnnotationTypes.add(cl.loadClass("javax.inject.Inject"));
        this.logger.info("JSR-330 'javax.inject.Inject' annotation found and supported for autowiring");
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
    }
}

QualifierAnnotationAutowireCandidateResolver makes no mention of JSR-330 annotations.

nicholas.hauschild
  • 42,483
  • 9
  • 127
  • 120