Spring DAO is not injected in JSF managed bean

后端 未结 3 933
长情又很酷
长情又很酷 2020-12-24 11:29

I am using JSF2+Spring3.1+Hibernate4 in my demo application and i will want to use annotation to create session factory but my DAO class is not initialize in Jsf Managed Bea

3条回答
  •  余生分开走
    2020-12-24 12:04

    Can you try ManagedProperty annotation for UserDAO

    @ManagedProperty("#{userDAO}")
    private UserDAO userDAO;
    
    private void setUserDAO(UserDAO userDAO){
    this.userDAO=userDAO;
    }
    

    You may need to change dao annotation as well

    @Repository("userDAO")
    @Transactional
    public class UserDAO
    

提交回复
热议问题