我有一个会话作用域用户bean:
@Component
@Scope("session")
public class UserBean {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
和地址bean:
@Component
@Scope("session")
public class AddressBean {
@Autowired
private UserBean userBean;
public getUserBean(){
return userBean;
}
public void setUserBean(UserBean userBean){
this.userBean=userBean;
}
}
当我在JSF中调用UserBean时,我可以看到一个对象已被实例化。当我调用AddressBean时... UserBean始终为null并且尚未注入。如何正确连接?