为什么我的spring@Autowired的字段为空
答案:1 悬赏:80 手机版
解决时间 2021-02-27 10:29
- 提问者网友:别再叽里呱啦
- 2021-02-26 20:49
为什么我的spring@Autowired的字段为空
最佳答案
- 五星知识达人网友:旧脸谱
- 2021-02-26 22:28
为什么我的spring@Autowired的字段为空
// dao
public class BaseDaoHibernate<T, ID extends Serializable> extends
HibernateDaoSupport implements BaseDao<T, ID> {
protected Class<T> persistentClass;
@Autowired
public void setSessionFactory0(SessionFactory sessionFactory) {
super.setSessionFactory(sessionFactory);
}
@Repository("authorizeDao")
public class AuthorizeDaoHibernate extends BaseDaoHibernate<Authorize, Long>
implements AuthorizeDao {
private Criteria getAuthorizeCriteria(Authorize auth) {
Criteria crit = getCriteria();
Example example = Example.create(auth);
example.enableLike(MatchMode.ANYWHERe);
crit.add(example);
if (auth.getDate_s() != null) {
crit.add(Restrictions.ge("createDate", auth.getDate_s()));
}
if (auth.getDate_e() != null) {
crit.add(Restrictions.le("createDate", auth.getDate_e()));
}
return crit;
}
// service
@Service("authorizeService")
public class AuthorizeServiceImpl implements AuthorizeService {
@Autowired
private AuthorizeDao authorizeDao;
public Authorize getAuthorizeByAuthId(Long authId) {
return authorizeDao.getById(authId);
}
public List<Authorize> findAll() {
return authorizeDao.findAll();
}
//action
@SuppressWarnings("serial")
public class AdminAction extends AuthAction {
private SiteBackGroudUser user;
private Long keyId;
private List<Authorize> auths;
private Page page;
@Autowired
private SiteBackGroudUserService siteBackGroudUserService;
@Autowired
private AuthorizeService authorizeService;
// dao
public class BaseDaoHibernate<T, ID extends Serializable> extends
HibernateDaoSupport implements BaseDao<T, ID> {
protected Class<T> persistentClass;
@Autowired
public void setSessionFactory0(SessionFactory sessionFactory) {
super.setSessionFactory(sessionFactory);
}
@Repository("authorizeDao")
public class AuthorizeDaoHibernate extends BaseDaoHibernate<Authorize, Long>
implements AuthorizeDao {
private Criteria getAuthorizeCriteria(Authorize auth) {
Criteria crit = getCriteria();
Example example = Example.create(auth);
example.enableLike(MatchMode.ANYWHERe);
crit.add(example);
if (auth.getDate_s() != null) {
crit.add(Restrictions.ge("createDate", auth.getDate_s()));
}
if (auth.getDate_e() != null) {
crit.add(Restrictions.le("createDate", auth.getDate_e()));
}
return crit;
}
// service
@Service("authorizeService")
public class AuthorizeServiceImpl implements AuthorizeService {
@Autowired
private AuthorizeDao authorizeDao;
public Authorize getAuthorizeByAuthId(Long authId) {
return authorizeDao.getById(authId);
}
public List<Authorize> findAll() {
return authorizeDao.findAll();
}
//action
@SuppressWarnings("serial")
public class AdminAction extends AuthAction {
private SiteBackGroudUser user;
private Long keyId;
private List<Authorize> auths;
private Page page;
@Autowired
private SiteBackGroudUserService siteBackGroudUserService;
@Autowired
private AuthorizeService authorizeService;
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯