SpringMvc 3.2配置指南

http://blog.csdn.net/luzongfeng88/article/details/45646323

1.springmvc框架介绍。 
Spring Web MVC是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进行职责解耦,基于请求驱动指的就是使用请求-响应模型,框架的目的就是帮助我们简化开发,Spring Web MVC也是要简化我们日常Web开发的。

另外还有一种基于组件的、事件驱动的Web框架在此就不介绍了,如Tapestry、JSF等。

Spring Web MVC也是服务到工作者模式的实现,但进行可优化。前端控制器是DispatcherServlet;应用控制器其实拆为处理器映射器(Handler Mapping)进行处理器管理和视图解析器(View Resolver)进行视图管理;页面控制器/动作/处理器为Controller接口(仅包含ModelAndView handleRequest(request, response) 方法)的实现(也可以是任何的POJO类);支持本地化(Locale)解析、主题(Theme)解析及文件上传等;提供了非常灵活的数据验证、格式化和数据绑定机制;提供了强大的约定大于配置(惯例优先原则)的契约式编程支持。 
2.所需jar包 
从spring官网上下载spring mvc3.2版本,导入所有jar包,另外还需要一些支持包,aop相关、log4j、commons-logging等等,总之如果报错请与下面列出的jar包相比较,如果缺少再添加。 
aopalliance-1.0.jar 
asm-3.3.1.jar 
aspectj-1.7.4.jar 
aspectjweaver-1.6.8.jar 
cglib-2.2.2.jar 
commons-dbcp-1.4.jar 
commons-logging-1.1.1.jar 
commons-pool-1.3.jar 
jackson-core-asl-1.9.7.jar 
jackson-core-lgpl-1.9.7.jar 
jackson-mapper-asl-1.9.7.jar 
jackson-mapper-lgpl-1.9.7.jar 
javassist-3.15.0-GA.jar 
javassist-3.17.1-GA.jar 
log4j-1.2.17.jar 
mybatis-3.2.2.jar 
mybatis-spring-1.2.1.jar 
mysql-connector-java-5.0.8-bin.jar 
org.springframework.aop-3.0.5.RELEASE.jar 
slf4j-api-1.7.5.jar 
slf4j-log4j12-1.7.5.jar 
spring-aop-3.2.0.RELEASE.jar 
spring-aspects-3.2.0.RELEASE.jar 
spring-beans-3.2.0.RELEASE.jar 
spring-context-3.2.0.RELEASE.jar 
spring-context-support-3.2.0.RELEASE.jar 
spring-core-3.2.0.RELEASE.jar 
spring-expression-3.2.0.RELEASE.jar 
spring-instrument-3.2.0.RELEASE.jar 
spring-instrument-tomcat-3.2.0.RELEASE.jar 
spring-jdbc-3.2.0.RELEASE.jar 
spring-jms-3.2.0.RELEASE.jar 
spring-orm-3.2.0.RELEASE.jar 
spring-oxm-3.2.0.RELEASE.jar 
spring-struts-3.2.0.RELEASE.jar 
spring-test-3.2.0.RELEASE.jar 
spring-tx-3.2.0.RELEASE.jar 
spring-web-3.2.0.RELEASE.jar 
spring-webmvc-3.2.0.RELEASE.jar 
spring-webmvc-portlet-3.2.0.RELEASE.jar

3.开发环境搭建(不罗嗦,开整) 
web.xml配置如下: 
如果有不懂的可留言,或者自行百度,学习本来就是一件自主的事。。。。

<code class="hljs xml has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-pi" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">web-app</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">version</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"3.0"</span> 
    <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://java.sun.com/xml/ns/javaee"</span> 
    <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:xsi</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.w3.org/2001/XMLSchema-instance"</span> 
    <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xsi:schemaLocation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"</span>></span>
  <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">display-name</span>></span><span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">display-name</span>></span> 
  <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">welcome-file-list</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">welcome-file</span>></span>index.jsp<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">welcome-file</span>></span>
  <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">welcome-file-list</span>></span>

  <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- 配置spring上下文监视器 --></span>
  <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">listener</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">listener-class</span>></span>org.springframework.web.context.ContextLoaderListener<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">listener-class</span>></span>
   <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">listener</span>></span>

   <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- 配置上下文参数加载配置文件 --></span>
   <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">context-param</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-name</span>></span>contextConfigLocation<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-name</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-value</span>></span>
            classpath:*-context.xml
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-value</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">context-param</span>></span>

    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">listener</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">listener-class</span>></span>org.springframework.web.context.request.RequestContextListener<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">listener-class</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">listener</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter-name</span>></span>characterEncodingFilter<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter-name</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter-class</span>></span>org.springframework.web.filter.CharacterEncodingFilter<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter-class</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">init-param</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-name</span>></span>encoding<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-name</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-value</span>></span>UTF-8<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-value</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">init-param</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">init-param</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-name</span>></span>forceEncoding<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-name</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-value</span>></span>true<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-value</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">init-param</span>></span>
     <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter</span>></span>
     <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter-mapping</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter-name</span>></span>characterEncodingFilter<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter-name</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">url-pattern</span>></span>/*<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">url-pattern</span>></span>
     <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">filter-mapping</span>></span>
     <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet-name</span>></span>SpringMVCServlet<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet-name</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet-class</span>></span>org.springframework.web.servlet.DispatcherServlet<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet-class</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">init-param</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-name</span>></span>contextConfigLocation<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-name</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-value</span>></span>
                classpath:web-context.xml
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param-value</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">init-param</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">load-on-startup</span>></span>1<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">load-on-startup</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet-mapping</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet-name</span>></span>SpringMVCServlet<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet-name</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">url-pattern</span>></span>/<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">url-pattern</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">servlet-mapping</span>></span>


<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">web-app</span>></span>
</code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li><li style="box-sizing: border-box; padding: 0px 5px;">50</li><li style="box-sizing: border-box; padding: 0px 5px;">51</li><li style="box-sizing: border-box; padding: 0px 5px;">52</li><li style="box-sizing: border-box; padding: 0px 5px;">53</li><li style="box-sizing: border-box; padding: 0px 5px;">54</li><li style="box-sizing: border-box; padding: 0px 5px;">55</li><li style="box-sizing: border-box; padding: 0px 5px;">56</li><li style="box-sizing: border-box; padding: 0px 5px;">57</li><li style="box-sizing: border-box; padding: 0px 5px;">58</li><li style="box-sizing: border-box; padding: 0px 5px;">59</li><li style="box-sizing: border-box; padding: 0px 5px;">60</li><li style="box-sizing: border-box; padding: 0px 5px;">61</li><li style="box-sizing: border-box; padding: 0px 5px;">62</li></ul>

文档结构图如下: 
这里写图片描述

spring-context.xml配置如下:

<code class="hljs xml has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-pi" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">beans</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/beans"</span>
       <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:xsi</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.w3.org/2001/XMLSchema-instance"</span>
       <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xsi:schemaLocation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd"</span>></span>

    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">id</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"dataSource"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.apache.commons.dbcp.BasicDataSource"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">destroy-method</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"close"</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"driverClassName"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"com.mysql.jdbc.Driver"</span>></span><span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"url"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"jdbc:mysql://localhost:3306/mydb?characterEncoding=utf-8"</span>></span><span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"username"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"root"</span>></span><span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"password"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"root"</span>/></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"maxActive"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"5"</span> /></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"maxIdle"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"3"</span> /></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"maxWait"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"1000"</span> /></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"defaultAutoCommit"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"true"</span> /></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"removeAbandoned"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"true"</span> /></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"removeAbandonedTimeout"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"60"</span> /></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span>></span>
     <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- 创建SqlSessionFactory,同时指定数据源 --></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">id</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"sqlSessionFactory"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.mybatis.spring.SqlSessionFactoryBean"</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"dataSource"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">ref</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"dataSource"</span> /></span>
         <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"configLocation"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"classpath:mybatis-config.xml"</span>></span><span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span>></span>  
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span>></span> 
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">beans</span>></span></code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li></ul>

transaction-context.xml:配置如下:

<code class="hljs xml has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-pi" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">beans</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/beans"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:xsi</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.w3.org/2001/XMLSchema-instance"</span>
       <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:aop</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/aop"</span>
       <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:context</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/context"</span>
       <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:tx</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/tx"</span>
       <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xsi:schemaLocation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">id</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"transactionManager"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.springframework.jdbc.datasource.DataSourceTransactionManager"</span>></span>
       <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"dataSource"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">ref</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"dataSource"</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">aop:config</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">aop:advisor</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">id</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"managerTx"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">advice-ref</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"txAdvice"</span>
         <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">pointcut</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"within(com.lzf.code.service..*Service) &amp;&amp; execution( * *(..))"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">order</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"1"</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">aop:config</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:advice</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">id</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"txAdvice"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">transaction-manager</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"transactionManager"</span>></span>      
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:attributes</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"load*"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">read-only</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"true"</span> /></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"get*"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">read-only</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"true"</span> /></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"create*"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">propagation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"REQUIRED"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">rollback-for</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"java.lang.Exception"</span>/></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"save*"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">propagation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"REQUIRED"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">rollback-for</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"java.lang.Exception"</span>/></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"update*"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">propagation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"REQUIRED"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">rollback-for</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"java.lang.Exception"</span>/></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"delete*"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">propagation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"REQUIRED"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">rollback-for</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"java.lang.Exception"</span>/></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"crud*"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">propagation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"REQUIRED"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">rollback-for</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"java.lang.Exception"</span>/></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"schedule*"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">propagation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"REQUIRED"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">rollback-for</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"java.lang.Exception"</span>/></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"do*"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">propagation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"REQUIRED"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">rollback-for</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"java.lang.Exception"</span>/></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:method</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"*"</span> /></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:attributes</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">tx:advice</span>></span>
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">beans</span>></span></code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li></ul>

user-context.xml:配置如下:

<code class="hljs xml has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-pi" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">beans</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/beans"</span>
  <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:xsi</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.w3.org/2001/XMLSchema-instance"</span>
  <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:context</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/context"</span>
  <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xsi:schemaLocation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-3.2.xsd"</span> ></span>
    <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- 用户Dao--></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">id</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"userDao"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.mybatis.spring.mapper.MapperFactoryBean"</span>></span>  
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"mapperInterface"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"com.lzf.code.dao.UserDao"</span> /></span>  
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"sqlSessionFactory"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">ref</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"sqlSessionFactory"</span> /></span>  
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span>></span>
  <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- 扫描数据访问层,组装数据访问接口实现类 --></span>
  <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.mybatis.spring.mapper.MapperScannerConfigurer"</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"basePackage"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"com.lzf.code"</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"sqlSessionFactory"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">ref</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"sqlSessionFactory"</span>/></span>
  <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span>></span>

<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">beans</span>></span></code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li></ul>

web-context.xml配置如下:

<code class="hljs xml has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-pi" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">beans</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/beans"</span>
    <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:xsi</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.w3.org/2001/XMLSchema-instance"</span> 
    <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:context</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/context"</span>
    <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:mvc</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://www.springframework.org/schema/mvc"</span>
    <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xsi:schemaLocation</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"</span>></span>

    <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- 启动扫描Code下所有的controller --></span> 
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">context:component-scan</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">base-package</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"com.lzf.code"</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">mvc:annotation-driven</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">mvc:default-servlet-handler</span>/></span>

     <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- 避免IE执行AJAX时,返回JSON出现下载文件 --></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">id</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"mappingJacksonHttpMessageConverter"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"supportedMediaTypes"</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">list</span>></span>
                <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">value</span>></span>text/html;charset=UTF-8<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">value</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">list</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span>></span>
     <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- 启动Spring MVC 的注解功能,完成请求和注解POJO的映射 --></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"messageConverters"</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">list</span>></span>
                <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">ref</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">bean</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"mappingJacksonHttpMessageConverter"</span> /></span>  <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- json转换器 --></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">list</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"</span>></span>  
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"exceptionMappings"</span>></span>  
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">props</span>></span>  
                <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">prop</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">key</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.springframework.web.servlet.PageNotFound"</span>></span>error/pageNotFound<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">prop</span>></span>  
                <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">prop</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">key</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.springframework.dao.DataAccessException"</span>></span>error/dataAccessFailure<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">prop</span>></span>  
                <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">prop</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">key</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.springframework.transaction.TransactionException"</span>></span>error/dataAccessFailure<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">prop</span>></span>  
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">props</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span>></span>
     <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- jsp页面解析器,当Controller返回XXX字符串时,先通过拦截器,然后该类就会在/WEB-INF/pages/目录下,查找XXX.jsp文件--></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.springframework.web.servlet.view.InternalResourceViewResolver"</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"prefix"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"/pages/"</span>/></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">property</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"suffix"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">".jsp"</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">bean</span>></span>
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">beans</span>></span></code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li></ul>

log4j配置如下:

<code class="hljs xml has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-pi" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><?xml version="1.0" encoding="UTF-8" ?></span>
<span class="hljs-doctype" style="font-family: 'Segoe UI', monospace !important; color: rgb(102, 0, 102); box-sizing: border-box;"><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"></span>

<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">log4j:configuration</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">xmlns:log4j</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"http://jakarta.apache.org/log4j/"</span>></span>

    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">appender</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"appender"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.apache.log4j.ConsoleAppender"</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"threshold"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"ERROR"</span>/></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">layout</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">class</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"org.apache.log4j.PatternLayout"</span>></span>
            <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">param</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"ConversionPattern"</span>
                <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"[cmall] %p [%t] %c{1}.%M(%L) | %m%n"</span>/></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">layout</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">appender</span>></span>

      <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!--  
    <appender name="actionAppender" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="/opt/logs/ActionsError.log"/>
        <param name="Append" value="true"/>
        <param name="threshold" value="INFO"/>
        <param name="DatePattern" value="'.'yyyy-MM-dd'.txt'"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
        </layout>
    </appender>  

    <category name="com">
        <priority value="ERROR"/>
        <appender-ref ref="appender"/>
    </category>

    <category name="com.ibatis">
        <priority value="ERROR"/>
        <appender-ref ref="appender"/>
    </category>

    </category>
     --></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">category</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"com.ibatis"</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">priority</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"DEBUG"</span>/></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">appender-ref</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">ref</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"appender"</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">category</span>></span>

    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">category</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"java.sql"</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">priority</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"DEBUG"</span>/></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">appender-ref</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">ref</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"appender"</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">category</span>></span>

    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">category</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">name</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"com"</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">priority</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"DEBUG"</span>/></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">appender-ref</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">ref</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"appender"</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">category</span>></span>    

  <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;"><!-- 
    <category name="com">
        <priority value="DEBUG"/>
        <appender-ref ref="actionAppender"/>
    </category>   --></span>

    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">root</span>></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">level</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">value</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"ERROR"</span> /></span>
        <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">appender-ref</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">ref</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"appender"</span>/></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">root</span>></span>
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">log4j:configuration</span>></span></code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li><li style="box-sizing: border-box; padding: 0px 5px;">50</li><li style="box-sizing: border-box; padding: 0px 5px;">51</li><li style="box-sizing: border-box; padding: 0px 5px;">52</li><li style="box-sizing: border-box; padding: 0px 5px;">53</li><li style="box-sizing: border-box; padding: 0px 5px;">54</li><li style="box-sizing: border-box; padding: 0px 5px;">55</li><li style="box-sizing: border-box; padding: 0px 5px;">56</li><li style="box-sizing: border-box; padding: 0px 5px;">57</li><li style="box-sizing: border-box; padding: 0px 5px;">58</li><li style="box-sizing: border-box; padding: 0px 5px;">59</li><li style="box-sizing: border-box; padding: 0px 5px;">60</li><li style="box-sizing: border-box; padding: 0px 5px;">61</li><li style="box-sizing: border-box; padding: 0px 5px;">62</li></ul>

详细的目录结构图再看一下。

user.java:

<code class="hljs cs has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">package com.lzf.code.vo;

<span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">class</span> User {
    <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">//用户ID</span>
    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">private</span> <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">int</span> user_id;
    <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">//用户姓名</span>
    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">private</span> String user_name;

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">private</span> String credits;

    <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">//用户密码</span>
    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">private</span> String password;

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">private</span> String last_visit;

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">private</span> String last_id;

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">int</span> <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">getUser_id</span>() {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">return</span> user_id;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">void</span> <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">setUser_id</span>(<span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">int</span> user_id) {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">this</span>.user_id = user_id;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> String <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">getUser_name</span>() {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">return</span> user_name;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">void</span> <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">setUser_name</span>(String user_name) {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">this</span>.user_name = user_name;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> String <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">getCredits</span>() {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">return</span> credits;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">void</span> <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">setCredits</span>(String credits) {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">this</span>.credits = credits;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> String <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">getPassword</span>() {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">return</span> password;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">void</span> <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">setPassword</span>(String password) {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">this</span>.password = password;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> String <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">getLast_visit</span>() {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">return</span> last_visit;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">void</span> <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">setLast_visit</span>(String last_visit) {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">this</span>.last_visit = last_visit;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> String <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">getLast_id</span>() {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">return</span> last_id;
    }

    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">void</span> <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">setLast_id</span>(String last_id) {
        <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">this</span>.last_id = last_id;
    }
}
</code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li><li style="box-sizing: border-box; padding: 0px 5px;">50</li><li style="box-sizing: border-box; padding: 0px 5px;">51</li><li style="box-sizing: border-box; padding: 0px 5px;">52</li><li style="box-sizing: border-box; padding: 0px 5px;">53</li><li style="box-sizing: border-box; padding: 0px 5px;">54</li><li style="box-sizing: border-box; padding: 0px 5px;">55</li><li style="box-sizing: border-box; padding: 0px 5px;">56</li><li style="box-sizing: border-box; padding: 0px 5px;">57</li><li style="box-sizing: border-box; padding: 0px 5px;">58</li><li style="box-sizing: border-box; padding: 0px 5px;">59</li><li style="box-sizing: border-box; padding: 0px 5px;">60</li><li style="box-sizing: border-box; padding: 0px 5px;">61</li><li style="box-sizing: border-box; padding: 0px 5px;">62</li><li style="box-sizing: border-box; padding: 0px 5px;">63</li><li style="box-sizing: border-box; padding: 0px 5px;">64</li><li style="box-sizing: border-box; padding: 0px 5px;">65</li><li style="box-sizing: border-box; padding: 0px 5px;">66</li></ul>

UserDao.java:

<code class="hljs java has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">package</span> com.lzf.code.dao;

<span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">import</span> com.lzf.code.vo.User;


<span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-class" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">interface</span> <span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">UserDao</span> {</span>

    <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">//根据id获取用户信息</span>
    <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">public</span> User <span class="hljs-title" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box;">getUserInfo</span>(<span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">int</span> id);

}
</code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li></ul>

UserService.java:

<code class="hljs avrasm has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">package <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">com</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.lzf</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.code</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.service</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>

import java<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.util</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.ArrayList</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
import java<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.util</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.List</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>

import org<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.springframework</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.beans</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.factory</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.annotation</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.Autowired</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
import org<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.springframework</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.stereotype</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.Service</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
import org<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.springframework</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.web</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.bind</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.annotation</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.RequestMapping</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
import org<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.springframework</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.web</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.bind</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.annotation</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.RequestMethod</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
import org<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.springframework</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.web</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.bind</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.annotation</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.RequestParam</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
import org<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.springframework</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.web</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.bind</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.annotation</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.ResponseBody</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
import org<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.springframework</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.web</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.servlet</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.ModelAndView</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
import org<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.springframework</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.web</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.util</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.JavaScriptUtils</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>

import <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">com</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.lzf</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.code</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.dao</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.UserDao</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
import <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">com</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.lzf</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.code</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.vo</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.User</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>

@Service
@RequestMapping(value=<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"/user"</span>)
public class UserService {
    @Autowired
    private UserDao userDao<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>

    @RequestMapping(value=<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"/login"</span>,method=RequestMethod<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.GET</span>)
    public String login(){
        return <span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"/user/success"</span><span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
    }

    @RequestMapping(value=<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"/json"</span>,method=RequestMethod<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.GET</span>)
    public @ResponseBody List<User>test(){
        List<User>userlist =new ArrayList<User>()<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
        User user1 =new User()<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
        <span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">/*user1.setId(0);
        user1.setName("jack");
        user1.setPassword("abc");
        userlist.add(user1);
        User user2 =new User();
        user2.setId(0);
        user2.setName("tom");
        user2.setPassword("abc");
        userlist.add(user2);*/</span>
        return userlist<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
    }

    @RequestMapping(value=<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"/add"</span>,method=RequestMethod<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.GET</span>)
    public ModelAndView <span class="hljs-keyword" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 0, 136); box-sizing: border-box;">add</span>(@RequestParam(value=<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"username"</span>,required=true,defaultValue=<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"lzf"</span>)String username) {
        User user = userDao<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.getUserInfo</span>(<span class="hljs-number" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;">1</span>)<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
        ModelAndView mv =null<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
        if(user!=null){
            System<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.out</span><span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.println</span>(user<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.getUser</span>_name())<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
            mv = new ModelAndView(<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"/user/addSuccess"</span>)<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
            mv<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.addObject</span>(<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"info"</span>,<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"该用户姓名为:"</span>+user<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.getUser</span>_name())<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
        }else{
            mv = new ModelAndView(<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"/user/addSuccess"</span>)<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
            mv<span class="hljs-preprocessor" style="font-family: 'Segoe UI', monospace !important; color: rgb(68, 68, 68); box-sizing: border-box;">.addObject</span>(<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"info"</span>,<span class="hljs-string" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 136, 0); box-sizing: border-box;">"该用户不存在!"</span>)<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>

        }
        return mv<span class="hljs-comment" style="font-family: 'Segoe UI', monospace !important; color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
    }
}
</code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li><li style="box-sizing: border-box; padding: 0px 5px;">50</li><li style="box-sizing: border-box; padding: 0px 5px;">51</li><li style="box-sizing: border-box; padding: 0px 5px;">52</li><li style="box-sizing: border-box; padding: 0px 5px;">53</li><li style="box-sizing: border-box; padding: 0px 5px;">54</li><li style="box-sizing: border-box; padding: 0px 5px;">55</li><li style="box-sizing: border-box; padding: 0px 5px;">56</li><li style="box-sizing: border-box; padding: 0px 5px;">57</li><li style="box-sizing: border-box; padding: 0px 5px;">58</li><li style="box-sizing: border-box; padding: 0px 5px;">59</li><li style="box-sizing: border-box; padding: 0px 5px;">60</li><li style="box-sizing: border-box; padding: 0px 5px;">61</li></ul>

UserDao.xml:

<code class="hljs xml has-numbering" style="font-family: 'Source Code Pro', monospace; display: block; padding: 0px; color: inherit; box-sizing: border-box;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-pi" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><?xml version="1.0" encoding="UTF-8" ?></span>
<span class="hljs-doctype" style="font-family: 'Segoe UI', monospace !important; color: rgb(102, 0, 102); box-sizing: border-box;"><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"></span>

<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">mapper</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">namespace</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"com.lzf.code.dao.UserDao"</span>></span>
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"><<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">select</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">id</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"getUserInfo"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">parameterType</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"int"</span> <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(102, 0, 102);">resultType</span>=<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 136, 0);">"Userinfo"</span>></span>
        select * from t_user where user_id = #{id}
    <span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">select</span>></span>
<span class="hljs-tag" style="font-family: 'Segoe UI', monospace !important; color: rgb(0, 102, 102); box-sizing: border-box;"></<span class="hljs-title" style="box-sizing: border-box; color: rgb(0, 0, 136);">mapper</span>></span></code><ul class="pre-numbering" style="font-family: 'Segoe UI', monospace !important; box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul>

主要配置就这么多,涉及简单的环境搭建,与mybaits整合,使用log4j作为日志管理。

有疑问的地方可以留言或者百度,或者添加qq:957633749,也可发邮件:957633749@qq.com

展开阅读全文

没有更多推荐了,返回首页