Injecting Annotated Bean into Regular Bean
- by jboyd
AppContext.xml
<bean id="myBean" class="com.myapp.MyClass">
<property ref="myService"/>
</bean>
MyService.java
@Service
public class MyService {
...
}
This will throw an exception stating that no bean can be found for property "myService", which I understand because it can't be found in the context files, but I can autowire that field in other spring managed beans, but I need to explicitly build the bean in my context because the POJO is not editable in the scope of my project.