Required Multiple beans of same type in Spring

后端 未结 3 552
忘掉有多难
忘掉有多难 2020-12-04 18:18

A request before you mark it as duplicate. I have gone through the forum and couldn\'t find the solution for the problem anywhere.

I am writing a code using Spring 3

3条回答
  •  佛祖请我去吃肉
    2020-12-04 18:55

    Injection using @Resource annotation is what you're looking for. You can use

    @AutoWired
    @Qualifier("A1Unmarshaller")
    private Jaxb2Marshaller A1Unmarshaller;
    

    But that is not the only way.

    @Resource("A1Unmrshaller")
    

    Does the job too. I suggest you use the later one! See why

提交回复
热议问题