• Maven+Spring+Mybatis+Security+Mysql简短的框架


    一段时间想搞个框架做开发,但是网上好多代码建立的都太杂乱。有的开源的东西我感觉用不了。本人太笨,不懂怎么上传到github上,就写在博客里,留作记录。以后用的时候也方便。

    1.首先让我们看一下项目结构

    2.下面是maven的pom.xml文件

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>Excel</groupId>
      <artifactId>excel</artifactId>
      <packaging>war</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>excel Maven Webapp</name>
      <url>http://maven.apache.org</url>
      <properties>
        <!-- 全局版本控制-->
        <spring-version>4.0.2.RELEASE</spring-version>
        <spring-security-version>3.2.5.RELEASE</spring-security-version>
        <mybatis-version>3.2.8</mybatis-version>
      </properties>
      <dependencies>
        <dependency>
          <!-- junit测试包,如果是测试spring框架用不到,使用下面专门的junit-->
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.springframework.webflow</groupId>
          <artifactId>spring-webflow</artifactId>
          <version>2.4.0.RELEASE</version>
        </dependency>
        <dependency>
          <!-- springMVC的依赖包,不需要单独导入网上说的那些其他的包
          Spring flow 集成了spring mvc
          -->
          <groupId>org.springframework</groupId>
          <artifactId>spring-context</artifactId>
          <version>${spring-version}</version>
        </dependency>
        <!-- mybatis包 -->
        <dependency>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis</artifactId>
          <version>3.2.8</version>
        </dependency>
        <!-- mysql包 -->
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>5.1.18</version>
        </dependency>
        <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.16</version>
        </dependency>
        <dependency>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis-spring</artifactId>
          <version>1.2.2</version>
        </dependency>
        <!-- 版本1.10说明 准备加入至今学spring -security -->
        <dependency>
          <groupId>org.springframework.security</groupId>
          <artifactId>spring-security-config</artifactId>
          <version>${spring-security-version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.springframework.security</groupId>
          <artifactId>spring-security-web</artifactId>
          <version>3.2.5.RELEASE</version>
        </dependency>
        <!-- jsp页面使用的security 标签  页面级别控制用的到,
    -->
        <dependency>
          <groupId>org.springframework.security</groupId>
          <artifactId>spring-security-taglibs</artifactId>
          <version>3.2.5.RELEASE</version>
        </dependency>
        <!-- jsr250 安全机制
    本例子使用的权限控制方式
    -->
        <dependency>
          <groupId>javax.annotation</groupId>
          <artifactId>jsr250-api</artifactId>
          <version>1.0</version>
        </dependency>
    
        <!--
        传说中比dbcp牛逼的数据源
        阿里巴巴 德鲁伊
        -->
        <dependency>
          <groupId>com.alibaba</groupId>
          <artifactId>druid</artifactId>
          <version>1.0.13</version>
        </dependency>
    
    
        <dependency>
          <!-- 用于spring 框架的junit测试用的(基于弄快测试的编程)-->
          <groupId>org.springframework</groupId>
          <artifactId>spring-test</artifactId>
          <version>4.0.2.RELEASE</version>
        </dependency>
        <dependency>
          <!--spring自己提供的数据源,-->
          <groupId>org.springframework</groupId>
          <artifactId>spring-jdbc</artifactId>
          <version>${spring-version}</version>
        </dependency>
        <!-- jsp页面使用的security 标签 -->
        <dependency>
          <groupId>org.springframework.security</groupId>
          <artifactId>spring-security-taglibs</artifactId>
          <version>3.2.5.RELEASE</version>
        </dependency>
        <dependency>
          <!--jstl标签,使得jsp可以使用jstl表达式-->
          <groupId>javax.servlet</groupId>
          <artifactId>jstl</artifactId>
          <version>1.2</version>
        </dependency>
        <dependency>
          <groupId>taglibs</groupId>
          <artifactId>standard</artifactId>
          <version>1.1.2</version>
        </dependency>
        <dependency>
           <groupId>javax.servlet</groupId>
           <artifactId>servlet-api</artifactId>
           <version>3.0-alpha-1</version>
         </dependency>
    
    
      </dependencies>
      <build>
        <finalName>excel</finalName>
      </build>
    </project>

    3.现在开始配置文件,首先是spring的配置文件

    springmvc.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:mvc="http://www.springframework.org/schema/mvc"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-4.0.xsd
            http://www.springframework.org/schema/mvc
             http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
    
           <context:component-scan base-package="spring.security.maven">
                  <context:include-filter type="annotation"
                                          expression="org.springframework.stereotype.Controller"/>
                  <context:include-filter type="annotation"
                                          expression="org.springframework.web.bind.annotation.ControllerAdvice"/>
           </context:component-scan>
           <context:annotation-config />
           <mvc:annotation-driven></mvc:annotation-driven>
    <!--资源文件不拦截-->
           <mvc:default-servlet-handler/>
           <bean id="viewResolver"
                 class="org.springframework.web.servlet.view.InternalResourceViewResolver">
                  <property name="prefix">
                         <value>/WEB-INF/</value>
                  </property>
                  <property name="suffix">
                         <value>.jsp</value>
                  </property>
           </bean>
           <!--配置 使用视图的名字来解析视图
           通过order属性进行定义视图解析器的优先级,值越小优先越高
           InternalResourceViewResolver 只是最大的数值
           -->
           <bean class="org.springframework.web.servlet.view.BeanNameViewResolver">
                  <property name="order" value="100" />
           </bean>
    </beans>
            

    然后是 spring_security.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:security="http://www.springframework.org/schema/security"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/security 
        http://www.springframework.org/schema/security/spring-security-3.2.xsd">
           <!--  Spring-Security 的配置 -->
           <security:http pattern="/css/**" security="none"></security:http>
           <security:http pattern="/img/**" security="none"></security:http>
           <security:http pattern="/js/**" security="none"></security:http>
           <security:http pattern="/fonts/**" security="none"></security:http>
           <security:http pattern="/jsp/**" security="none"></security:http>
           <security:http auto-config="true"  use-expressions="true"  access-denied-page="/denied.jsp" >
                  <security:intercept-url pattern="/login.jsp*"  access="permitAll"  />
                  <security:intercept-url pattern="/user/admin/**" access="hasRole('ROLE_ADMIN')"/>
                  <security:intercept-url pattern="/user/common/**"  access="hasRole('ROLE_USER')" />
                  <security:intercept-url pattern="/**" access="permitAll"/>
                  <security:form-login login-page="/login.jsp"
                                       authentication-failure-url="/login.jsp?login_error=true"
                                       default-target-url="/index.jsp"
                          />
    
                  <!--成功退出后跳转到的页面 -->
                  <security:logout logout-success-url="/login.jsp" />
                  <!-- 配置会话超时跳转的页面,tomacat默认30分钟过时-->
                  <security:session-management invalid-session-url="/sessionOutTime.jsp">
                         <!-- 单点登陆,这个会导致前一个登陆失效
                         error-if-maximum-exceeded 阻止第二次登陆
                         -->
                     <security:concurrency-control max-sessions="1" error-if-maximum-exceeded="true"></security:concurrency-control>
                  </security:session-management>
           </security:http>
           <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
                <property name="basename"  value="message" />
           </bean>
    
           <!--使用了annotations保护业务方法
             可以接口出添加    @RolesAllowed("ROLE_ADMIN")
             -->
           <security:global-method-security
                   jsr250-annotations="enabled" secured-annotations="enabled" >
           </security:global-method-security>
    
    
           <!-- 配置權限 -->
           <security:authentication-manager>
                  <security:authentication-provider  user-service-ref="managerDetialService">
                         <!-- 对于密码的MD5加密 -->
                         <security:password-encoder ref="passwordEncoder">
                                <!-- 加盐
                                对应的加盐值方式是 密码{盐值}
                                结果是小写的
                                例如 用户名字wpj 密码123
                                加密方式是 123{wpj} 去MD5值
                                -->
                                <security:salt-source user-property="username"/>
    
                         </security:password-encoder>
                  </security:authentication-provider>
    
           </security:authentication-manager>
           <bean id="securityFilterChainProxy" class="org.springframework.security.web.FilterChainProxy">
                  <constructor-arg>
                         <list>
                                <security:filter-chain pattern="/css/**"
                                                       filters="none" />
                                <security:filter-chain pattern="/images/**"
                                                       filters="none" />
                                <security:filter-chain pattern="/js/**"
                                                       filters="none" />
                                <security:filter-chain pattern="/font/**"
                                                       filters="none" />
                                 <security:filter-chain pattern="/jsp/**"
                                                       filters="none" />
                         </list>
                  </constructor-arg>
           </bean>
           <!-- 加密 -->
           <bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder">
           </bean>
    </beans>

    后面是spring-mybatis.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:p="http://www.springframework.org/schema/p"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="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
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
    
        <!-- 自动扫描(自动注入) -->
        <context:component-scan base-package="spring.security.maven">
            <context:exclude-filter type="annotation"
                                    expression="org.springframework.stereotype.Controller"/>
            <context:exclude-filter type="annotation"
                                    expression="org.springframework.web.bind.annotation.ControllerAdvice"/>
        </context:component-scan>
        <bean id="propertyConfigurer"
              class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <!-- 这里支持多种寻址方式:classpath和file -->
                    <!-- 推荐使用file的方式引入,这样可以将配置和代码分离 -->
                    <value>classpath:db.properties</value>
                    <value>classpath:message_zh_CH.properties</value>
                </list>
            </property>
        </bean>
        <!-- spring与mybatis整合配置,扫描所有dao -->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
            <property name="basePackage" value="spring.security.maven.dao" />
            <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
        </bean>
        <!-- mybatis文件配置,扫描所有mapper文件 -->
        <bean id="sqlSessionFactory"
              class="org.mybatis.spring.SqlSessionFactoryBean"
              p:dataSource-ref="dataSource"
              p:mapperLocations="classpath:Mapper/*Mapper.xml"
                />
        <!--p:mapperLocations="classpath:spring/security/maven/daomain/*Mapper.xml" 部署时候用的 Mapper测试时候用的-->
        <!-- configLocation为mybatis属性 mapperLocations为所有mapper-->
    
    
    
        <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init"
                 destroy-method="close" >
                  <property name="driverClassName">
                         <value>${driver}</value>
                  </property>
                  <property name="url">
                         <value>${url}</value>
                  </property>
                  <property name="username">
                         <value>${username}</value>
                  </property>
                  <property name="password">
                         <value>${password}</value>
                  </property>
                  <!-- 连接池最大使用连接数 -->
                  <property name="maxActive">
                         <value>20</value>
                  </property>
                  <!-- 初始化连接大小 -->
                  <property name="initialSize">
                         <value>1</value>
                  </property>
                  <!-- 获取连接最大等待时间 -->
                  <property name="maxWait">
                         <value>60000</value>
                  </property>
                  <!-- 连接池最大空闲 -->
                  <property name="maxIdle">
                         <value>20</value>
                  </property>
                  <!-- 连接池最小空闲 -->
                  <property name="minIdle">
                         <value>3</value>
                  </property>
                  <!-- 自动清除无用连接 -->
                  <property name="removeAbandoned">
                         <value>true</value>
                  </property>
                  <!-- 清除无用连接的等待时间 -->
                  <property name="removeAbandonedTimeout">
                         <value>180</value>
                  </property>
                  <!-- 连接属性 -->
                  <property name="connectionProperties">
                         <value>clientEncoding=UTF-8</value>
                  </property>
           </bean>
        <!-- 配置事务管理器 -->
        <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource" />
        </bean>
        <!-- 注解方式配置事物 -->
        <tx:annotation-driven transaction-manager="transactionManager" />
        <!-- 拦截器方式配置事物 -->
        <tx:advice id="transactionAdvice" transaction-manager="transactionManager">
            <tx:attributes>
                <tx:method name="add*" propagation="REQUIRED" />
                <tx:method name="append*" propagation="REQUIRED" />
                <tx:method name="insert*" propagation="REQUIRED" />
                <tx:method name="save*" propagation="REQUIRED" />
                <tx:method name="update*" propagation="REQUIRED" />
                <tx:method name="modify*" propagation="REQUIRED" />
                <tx:method name="edit*" propagation="REQUIRED" />
                <tx:method name="delete*" propagation="REQUIRED" />
                <tx:method name="remove*" propagation="REQUIRED" />
                <tx:method name="repair" propagation="REQUIRED" />
                <tx:method name="delAndRepair" propagation="REQUIRED" />
    
                <tx:method name="get*" propagation="SUPPORTS" />
                <tx:method name="find*" propagation="SUPPORTS" />
                <tx:method name="load*" propagation="SUPPORTS" />
                <tx:method name="search*" propagation="SUPPORTS" />
                <tx:method name="datagrid*" propagation="SUPPORTS" />
    
                <tx:method name="*" propagation="SUPPORTS" />
            </tx:attributes>
        </tx:advice>
        <bean id="contentManager"
              class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
            <property name="favorPathExtension" value="true"/>
            <property name="ignoreAcceptHeader" value="true" />
            <property name="defaultContentType" value="text/html" />
            <property name="useJaf" value="false"/>
            <property name="mediaTypes">
                <map>
                    <entry key="json" value="application/json" />
                    <entry key="html" value="text/html" />
                    <entry key="xml" value="application/xml" />
                </map>
            </property>
        </bean>
    </beans>

    4.数据库配置文件

    db.properties

    driver=com.mysql.jdbc.Driver
    url=jdbc:mysql://localhost:3306/spring_security?useUnicode=true&amp;characterEncoding=UTF-8
    username=root
    password=root

    5.日志文件

    log4j.properties

    #
    # Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
    #
    # The five logging levels used by Log are (in order):
    #
    #   1. DEBUG (the least serious)
    #   2. INFO
    #   3. WARN
    #   4. ERROR
    #   5. FATAL (the most serious)
    
    
    # Set root logger level to WARN and append to stdout
    log4j.rootLogger=DEBUG,stdout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.Target=System.out
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    
    # Pattern to output the caller's file name and line number.
    log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
    
    # Print only messages of level ERROR or above in the package noModule.
    log4j.logger.noModule=FATAL
    
    #log4j.logger.com.opensymphony.xwork2=DEBUG
    #log4j.logger.org.apache.struts2=DEBUG

    5.消息转码文件

    message_zh_CH.properties

    AbstractAccessDecisionManager.accessDenied=u4E0Du5141u8BB8u8BBFu95EE
    AbstractLdapAuthenticationProvider.emptyPassword=u574Fu7684u51EDu8BC1
    AbstractSecurityInterceptor.authenticationNotFound=u672Au5728SecurityContextu4E2Du67E5u627Eu5230u8BA4u8BC1u5BF9u8C61
    AbstractUserDetailsAuthenticationProvider.badCredentials=u574Fu7684u51EDu8BC1
    AbstractUserDetailsAuthenticationProvider.credentialsExpired=u7528u6237u51EDu8BC1u5DF2u8FC7u671F
    AbstractUserDetailsAuthenticationProvider.disabled=u7528u6237u5DF2u5931u6548
    AbstractUserDetailsAuthenticationProvider.expired=u7528u6237u5E10u53F7u5DF2u8FC7u671F
    AbstractUserDetailsAuthenticationProvider.locked=u7528u6237u5E10u53F7u5DF2u88ABu9501u5B9A
    AbstractUserDetailsAuthenticationProvider.onlySupports=u4EC5u4EC5u652Fu6301UsernamePasswordAuthenticationToken
    AccountStatusUserDetailsChecker.credentialsExpired=u7528u6237u51EDu8BC1u5DF2u8FC7u671F
    AccountStatusUserDetailsChecker.disabled=u7528u6237u5DF2u5931u6548
    AccountStatusUserDetailsChecker.expired=u7528u6237u5E10u53F7u5DF2u8FC7u671F
    AccountStatusUserDetailsChecker.locked=u7528u6237u5E10u53F7u5DF2u88ABu9501u5B9A
    AclEntryAfterInvocationProvider.noPermission=u7ED9u5B9Au7684Authenticationu5BF9u8C61({0})u6839u672Cu65E0u6743u64CDu63A7u9886u57DFu5BF9u8C61({1})
    AnonymousAuthenticationProvider.incorrectKey=u5C55u793Au7684AnonymousAuthenticationTokenu4E0Du542Bu6709u9884u671Fu7684key
    BindAuthenticator.badCredentials=u574Fu7684u51EDu8BC1
    BindAuthenticator.emptyPassword=u574Fu7684u51EDu8BC1
    CasAuthenticationProvider.incorrectKey=u5C55u793Au7684CasAuthenticationTokenu4E0Du542Bu6709u9884u671Fu7684key
    CasAuthenticationProvider.noServiceTicket=u672Au80FDu591Fu6B63u786Eu63D0u4F9Bu5F85u9A8Cu8BC1u7684CASu670Du52A1u7968u6839
    ConcurrentSessionControlStrategy.exceededAllowed=u5DF2u7ECFu8D85u8FC7u4E86u5F53u524Du4E3Bu4F53({0})u88ABu5141u8BB8u7684u6700u5927u4F1Au8BDDu6570u91CF
    DigestAuthenticationFilter.incorrectRealm=u54CDu5E94u7ED3u679Cu4E2Du7684Realmu540Du5B57({0})u540Cu7CFBu7EDFu6307u5B9Au7684Realmu540Du5B57({1})u4E0Du543Bu5408
    DigestAuthenticationFilter.incorrectResponse=u9519u8BEFu7684u54CDu5E94u7ED3u679C
    DigestAuthenticationFilter.missingAuth=u9057u6F0Fu4E86u9488u5BF9'auth' QOPu7684u3001u5FC5u987Bu7ED9u5B9Au7684u6458u8981u53D6u503C; u63A5u6536u5230u7684u5934u4FE1u606Fu4E3A{0}
    DigestAuthenticationFilter.missingMandatory=u9057u6F0Fu4E86u5FC5u987Bu7ED9u5B9Au7684u6458u8981u53D6u503C; u63A5u6536u5230u7684u5934u4FE1u606Fu4E3A{0}
    DigestAuthenticationFilter.nonceCompromised=Nonceu4EE4u724Cu5DF2u7ECFu5B58u5728u95EEu9898u4E86uFF0C{0}
    DigestAuthenticationFilter.nonceEncoding=Nonceu672Au7ECFu8FC7Base64u7F16u7801; u76F8u5E94u7684nonceu53D6u503Cu4E3A {0}
    DigestAuthenticationFilter.nonceExpired=Nonceu5DF2u7ECFu8FC7u671F/u8D85u65F6
    DigestAuthenticationFilter.nonceNotNumeric=Nonceu4EE4u724Cu7684u7B2C1u90E8u5206u5E94u8BE5u662Fu6570u5B57uFF0Cu4F46u7ED3u679Cu5374u662F{0}
    DigestAuthenticationFilter.nonceNotTwoTokens=Nonceu5E94u8BE5u7531u4E24u90E8u5206u53D6u503Cu6784u6210uFF0Cu4F46u7ED3u679Cu5374u662F{0}
    DigestAuthenticationFilter.usernameNotFound=u7528u6237u540D{0}u672Au627Eu5230
    JdbcDaoImpl.noAuthority=u6CA1u6709u4E3Au7528u6237{0}u6307u5B9Au89D2u8272
    JdbcDaoImpl.notFound=u672Au627Eu5230u7528u6237{0}
    LdapAuthenticationProvider.badCredentials=u574Fu7684u51EDu8BC1
    LdapAuthenticationProvider.credentialsExpired=u7528u6237u51EDu8BC1u5DF2u8FC7u671F
    LdapAuthenticationProvider.disabled=u7528u6237u5DF2u5931u6548
    LdapAuthenticationProvider.expired=u7528u6237u5E10u53F7u5DF2u8FC7u671F
    LdapAuthenticationProvider.locked=u7528u6237u5E10u53F7u5DF2u88ABu9501u5B9A
    LdapAuthenticationProvider.emptyUsername=u7528u6237u540Du4E0Du5141u8BB8u4E3Au7A7A
    LdapAuthenticationProvider.onlySupports=u4EC5u4EC5u652Fu6301UsernamePasswordAuthenticationToken
    PasswordComparisonAuthenticator.badCredentials=u574Fu7684u51EDu8BC1
    #PersistentTokenBasedRememberMeServices.cookieStolen=Invalid remember-me token (Series/token) mismatch. Implies previous cookie theft attack.
    ProviderManager.providerNotFound=u672Au67E5u627Eu5230u9488u5BF9{0}u7684AuthenticationProvider
    RememberMeAuthenticationProvider.incorrectKey=u5C55u793ARememberMeAuthenticationTokenu4E0Du542Bu6709u9884u671Fu7684key
    RunAsImplAuthenticationProvider.incorrectKey=u5C55u793Au7684RunAsUserTokenu4E0Du542Bu6709u9884u671Fu7684key
    SubjectDnX509PrincipalExtractor.noMatching=u672Au5728subjectDN: {0}u4E2Du627Eu5230u5339u914Du7684u6A21u5F0F
    SwitchUserFilter.noCurrentUser=u4E0Du5B58u5728u5F53u524Du7528u6237
    SwitchUserFilter.noOriginalAuthentication=u4E0Du80FDu591Fu67E5u627Eu5230u539Fu5148u7684u5DF2u8BA4u8BC1u5BF9u8C61

    6.说明文档

    如果用tomcat 8.0运行该Maven项目 访问地址为:localhost:8080/excel
    数据的名称:spring_security
    管理员账号:757671834@qq.com
    管理员密码:password
    
    普通用户账号:393993507@qq.com
    普通用户密码:password

    7.数据库相关信息

    -- MySQL dump 10.13  Distrib 5.7.9, for Win64 (x86_64)
    --
    -- Host: localhost    Database: spring_security
    -- ------------------------------------------------------
    -- Server version    5.7.10-log
    
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
    /*!40103 SET TIME_ZONE='+00:00' */;
    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
    /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
    
    --
    -- Table structure for table `t_user`
    --
    
    DROP TABLE IF EXISTS `t_user`;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE `t_user` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `user_name` varchar(80) DEFAULT NULL,
      `user_password` varchar(80) DEFAULT NULL,
      `user_other` varchar(80) DEFAULT NULL,
      `user_role` varchar(80) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Dumping data for table `t_user`
    --
    
    LOCK TABLES `t_user` WRITE;
    /*!40000 ALTER TABLE `t_user` DISABLE KEYS */;
    INSERT INTO `t_user` VALUES (1,'757671834@qq.com','abe4420dd6f2242792e291ef1497619d','超级管理员','ROLE_ADMIN'),(2,'393993507@qq.com','3aa6d08e2c3087b2ee52921b6a21ecc6','普通用户','ROLE_USER');
    /*!40000 ALTER TABLE `t_user` ENABLE KEYS */;
    UNLOCK TABLES;
    /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
    
    /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
    /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
    /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
    
    -- Dump completed on 2016-03-05 22:44:53

    8.最最主要的源码附件

     源码里有两个sql文件,请使用SecurityTwo.sql

    ....我去?为什么不能增加附件????????????

    我只能放到我百度云盘里了。如果有懂得可以跟我说下怎么上传附件

    http://pan.baidu.com/s/1ntZdfZV

    9.最最重要的,要说明下来源:

    这个项目是别人写的,我只是整理数出来。项目是在github上,具体的地址我不记得了。

    开源中国里可以搜索到。但是网上代码不全,我补全了,做了一个基本框架。有兴趣的可以留言探讨下。

  • 相关阅读:
    [转] 献给所有正在找路的人
    在同一表单内,多个提交按钮的处理方式
    javascript高级选择器querySelector和querySelectorAll
    一位年轻女董事长的37条忠告很受启发吧?
    函数的延迟加载
    WCF的CommunicationObjectFaultedException异常问题
    WCF Test Client对象数组输入问题
    [转载]C#开发Winform记录用户登录状态的方法
    using(C#)
    使用 SCTP 优化网络
  • 原文地址:https://www.cnblogs.com/lr393993507/p/5251033.html
Copyright © 2020-2023  润新知