项目场景:
提示:课堂考勤管理系统——基于SpringMVC+Spring+Mybatis问题一:
Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yan.dao.AdminDao.findById
原因分析:
找不到MyBatis的映射文件
解决方案:
在pom 文件 build 标签中加入下面代码即可
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
问题二:静态资源加载不出来
原因分析:
解决方案:
(1)web.xml配置文件中加入下列代码:
<!-- 静态资源 -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
<url-pattern>*.js</url-pattern>
<url-pattern>*.gif</url-pattern>
<url-pattern>*.png</url-pattern>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
(2)spring-mvc.xml配置文件:
<!--配置静态资源的访问映射,此配置中的文件,将不被前端控制器拦截 -->
<mvc:default-servlet-handler/>
<mvc:resources location="/js/" mapping="/js/**"/>
<mvc:resources location="/css/" mapping="/css/**"/>
<mvc:resources location="/fonts/" mapping="/fonts/**"/>
<mvc:resources location="/images/" mapping="/images/**"/>
问题三:
log4j:WARN No appenders could be found for logger (com.alibaba.druid.pool.DruidDataSource).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.