0
環境:行家,春季4.2.4-RELEASE,2個模塊:zscb服務器zscb常見,和zscb服務器依賴zscb常見MyBatis的無效約束聲明(未找到)
我的web.xml核心代碼:
<listener>
<listener-class>com.iidooo.core.listener.RoleResourceInitListener</listener-class>
</listener>
我有一個初始化監聽器在我的模塊zscb常見:
RoleResourceInitListener核心代碼:
public void contextInitialized(ServletContextEvent arg0) {
try {
ServletContext sc = arg0.getServletContext();
SqlSessionFactory sqlSessionFactory = (SqlSessionFactory) SpringUtil.getBean(sc, "sqlSessionFactory");
SqlSession sqlSession = sqlSessionFactory.openSession(true);
SecurityRoleMapper roleMapper = sqlSession.getMapper(SecurityRoleMapper.class);
List<SecurityRole> roleList = roleMapper.selectAll();
// key: roleID value:List<SecurityResource>
Map<Integer, List<SecurityResource>> roleResourceMap = new HashMap<Integer, List<SecurityResource>>();
for (SecurityRole item : roleList) {
roleResourceMap.put(item.getRoleID(), item.getResourceList());
}
sc.setAttribute(ServletConstant.ROLE_RESOURCE_MAP, roleResourceMap);
} catch (Exception e) {
e.printStackTrace();
logger.fatal(e);
}
}
我的applicationContext.xml:
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.iidooo.core.mapper com.edo.zscb.mapper" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
</bean>
我檢查了我的mapper.xml的namepsace:
<mapper namespace="com.iidooo.core.mapper.SecurityRoleMapper">
,當我運行Tomcat,出錯
Mybatis Invalid bound statement (not found)
誰可以救救我!
[mybatis spring mvc application,獲取無效綁定語句(未找到)]的可能副本(https://stackoverflow.com/questions/20427210/mybatis-spring-mvc-application-getting-invalid-bound-statement-未找到) – jvwilge