How to refer a bean declared in spring context xml from an annotated class spring



Example:


spring context xml



<beans>
<bean id="a" class="ClassA" />
</beans>


@Service public class Test {


@Resource InterfaceA ifcA;


}


public class ClassA implements InterfaceA { }


public interface InterfaceA { }




I would like to know how I can refer to xml bean declared in xml from a java class that has annotations enabled.


One way I know would be get the context and then get the bean.


Please suggest.


No comments:

Post a Comment