是否有一个JSR-330相当于Spring的@Value注释?

joe*_*ohn 4 java spring annotations jsr330

我正在尝试在Spring 3中使用JSR-330注释.

是否有一个JSR-330相当于Spring的@Value注释用于插入属性值?例如,我可以@Provider以指示Spring注入属性值的方式使用吗?

nic*_*ild 5

我查找了@Value正在使用的项目中的用法org.springframework.beans-3.0.5.RELEASE.jar.注释在这里引用两个地方,AutowiredAnnotationBeanPostProcessorQualifierAnnotationAutowireCandidateResolver.

AutowiredAnnotationBeanPostProcessor,提到的唯一JSR-330注释是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)
    {
    }
}
Run Code Online (Sandbox Code Playgroud)

QualifierAnnotationAutowireCandidateResolver 没有提到JSR-330注释.