I have one Annotation bean with some methods. It works fine.
Now, I am integrating one quartz task. But I am load it with XML definition beans that call previus annotation bean.Code:public @Controller("adminController") class AdminController { ... private @Autowired AdminDAO adminDAO; public void resetTemporalList() { System.out.println("HE SIDO EJECUTADO."); this.adminDAO.resetTemporalRegisters(); } ... }
Whan I start my app appear next error.Code:<bean id="resetTemporalRegisters" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="adminController" /> <property name="targetMethod" value="resetTemporalList" /> <property name="concurrent" value="false" /> </bean>
Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'adminController' is defined
I believe the problem is that Spring load XML beans first, after Annotation beans, then in this moment "adminController" bean not exits...
How Can I fix it?
PD: AdminDAO extends BaseDAO and use one personal annotation to do it.
Code:public @Repository(value="baseDAO") abstract class BaseDAO { private @Autowired HibernateTemplate hibernateTemplate; public HibernateTemplate getHibernateTemplate() { return this.hibernateTemplate; } }Code:@Parent(parent = "baseDAO") public @Repository class AdminDAO extends BaseDAO { public boolean resetTemporalRegisters(){ try{... this.getHibernateTemplate().find(hql); }catch(Exception ex){ ex.printStackTrace(); return false; } return true; } }


Reply With Quote
