在Spring4和Mybatis3整合的時候,啓動時,拋Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required異常,解決這一個錯誤,在你的BaseDaoImpl重寫setSqlSessionFactory,並在方法上加@Autowired註解便可。sql
public abstract class BaseDaoImpl<T extends BaseEntity> extends SqlSessionDaoSupport implements BaseDao<T> { /** * 解決 Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required */ @Autowired @Override public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { super.setSqlSessionFactory(sqlSessionFactory); } }