shiro(2)-集成spring

• 加入 Spring 和 Shiro 的 jar 包
• 配置 Spring 及 SpringMVC
• 参照:1.3.2\shiro-root-1.3.2-source-
release\shiro-root-1.3.2\samples\spring 配置
web.xml 文件和 Spring 的配置文件

1 pom.xml

        
        
        
            org.springframework
            spring-beans
            5.0.7.RELEASE
        
        
            org.springframework
            spring-core
            5.0.7.RELEASE
        
        
            org.springframework
            spring-context
            5.0.7.RELEASE
        
        
            org.springframework
            spring-expression
            5.0.7.RELEASE
        

        
        
            org.springframework
            spring-tx
            5.0.7.RELEASE
        
        
            org.springframework
            spring-jdbc
            5.0.7.RELEASE
        

        
        
            mysql
            mysql-connector-java
            5.1.35
        

        
        
            commons-dbcp
            commons-dbcp
            1.4
        

        
        
            org.mybatis
            mybatis
            3.4.5
        

        
        
            org.mybatis
            mybatis-spring
            1.3.1
        

        
        
        
        
            org.springframework
            spring-aspects
            5.0.7.RELEASE
        
        
            aopalliance
            aopalliance
            1.0
        
        


        
        
        
            org.springframework
            spring-webmvc
            5.0.7.RELEASE
        
        
            org.springframework
            spring-web
            5.0.7.RELEASE
        

        
        
            javax.servlet
            jstl
            1.2
        

        
        
            javax.servlet
            javax.servlet-api
            3.1.0
            provided
        

        
            org.springframework
            spring-context-support
            5.0.7.RELEASE
        

        
            com.fasterxml.jackson.core
            jackson-databind
            2.9.6
        


        

        
        
            org.springframework
            spring-test
            5.0.7.RELEASE
        

        
        
            junit
            junit
            4.12
        

        
        
            commons-fileupload
            commons-fileupload
            1.3.1
        

        
        
            org.apache.shiro
            shiro-all
            1.3.2
        

        
        
            net.sf.ehcache
            ehcache-core
            2.4.3
        

2 web.xml

   
    
        ssm
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:spring/springmvc.xml
        
        2
    
    
        ssm
        /
    

    
    
        contextConfigLocation
        
        
        
            classpath:spring/applicationContext-*.xml
        
    

    
    
        org.springframework.web.context.ContextLoaderListener
    

    
    
        CharacterEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            utf-8
        
    
    
        CharacterEncodingFilter
        /*
    

    
    
    
        shiroFilter
        org.springframework.web.filter.DelegatingFilterProxy
        
            targetFilterLifecycle
            true
        
    

    
        shiroFilter
        /*
    

3 db.properties

db.driverClassName=com.mysql.jdbc.Driver
db.url=jdbc:mysql://xxx/online_retailer?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false
db.username=root
db.password=root

4 log4j.properties

#dev env [debug] product env [info]
log4j.rootLogger=DEBUG, stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

5 ehcache.xml



    
    
    
    
    

    
    

    
    

    
    

    

    
    

    
    

    



6 applicationContext-dao.xml


    

    
    
        
        
        
        
    
    
    
        
        

        
        

    

    
    
        
        

    

7 applicationContext-service.xml


    

8 applicationContext-tx.xml

    
    

9 springmvc.xml

    
    

    
    
    
    
    
    
        
        
    
    

    
    
    
        
        
    

你可能感兴趣的:(shiro(2)-集成spring)