Is JSR-330 equivalent to Spring @Value annotation?

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

Is there a JSR-330 equivalent of Spring @Value annotation for inserting property values? for example, can I use @Provider to instruct Spring to enter a property value?

+4
source share
1 answer

I was looking for using @Value in a project using org.springframework.beans-3.0.5.RELEASE.jar . Annotations are mentioned here in two places: AutowiredAnnotationBeanPostProcessor and QualifierAnnotationAutowireCandidateResolver .

Only one JSR-330 annotation is mentioned in AutowiredAnnotationBeanPostProcessor : 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 does not mention JSR-330 annotations.

+4
source

Source: https://habr.com/ru/post/1395017/


All Articles