English 中文(简体)
春季内容是否支持JSR-330 贵重人物处理好坏事?
原标题:Does spring-context support JSR-330 Qualifier on bean instances?

春天有自己的<代码>Qualifier annotation,我认为它相当于javax.inject.Named annotation,而这反过来又是JSR-330的一个具体限定词。

因此,我不禁要问,春季的哪一种版本,如果有的话,会支持四方?

这里是我的榜样,不幸的是,它用的是春季案文3.0.5:

@Retention(RUNTIME)
@javax.inject.Qualifier
public @interface Version {

    String value();

}

@Configuration
public class MyConfig {

    @Bean("book-12") @Version("a") Book book12a() { ... }

    @Bean("book-12") @Version("b") Book book12b() { ... }

}

@Component
public class UserClass {

    @Inject @Named("book-12") Book anybook12;

    @Inject @Named("book-12") @Version("b") Book book12_b;

}
最佳回答

是的,它支持所有<代码>javax.inject.*>。 我本人使用了<代码>javax.inject.Qualifier。

Btw, I assume you want @Service or @Component instead of @Bean, and you need your Book class to be made spring-managed.

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签