代码格式很不错,转载过来借鉴下。
原文链接:http://blog.csdn.net/jokes000/article/details/10998109
以下为原文:
最近项目需要进行高要求的Web权限管理,在比较Spring security和Shiro之后由于Shiro更大的灵活度和更强的配置性选择了Shiro。
不过官方的文档写的对于集成spring不太清楚,尤其是Realm怎样实现。
因此,在查阅一系列资料之后,将目前集成的步骤总结出来。
特别推荐博文:http://www.cnblogs.com/xql4j/archive/2013/03/30/2990841.html,此文对作者帮助极大,在此表示感谢!
具体步骤抽象:
修改配置文件:
首先是pom.xml
[html] view plain copy
<!-- Version of jars -->
<properties>
<spring.version>3.2.3.RELEASE</spring.version>
<hibernate.version>4.2.3.Final</hibernate.version>
<slf4j.version>1.7.5</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.11</junit.version>
<cglib.version>3.0</cglib.version>
<velocity.version>1.7</velocity.version>
<tiles.extras.version>3.0.1</tiles.extras.version>
<jsonlib.version>2.4</jsonlib.version>
<shiro.version>1.2.2</shiro.version>
</properties>
<dependencies>
<!-- Spring jars -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
<!-- end of Spring jars -->
<!-- Shiro security -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-cas</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<!-- end of Shiro security -->
<!-- Json -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-lgpl</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-lgpl</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>${jsonlib.version}</version>
<classifier>jdk15</classifier>
</dependency>
<!-- end of Json -->
<!-- Hibernate4 -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
<exclusions>
<exclusion>
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.10</version>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>5.0-1</version>
<!--<scope>provided</scope> -->
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<!--<scope>provided</scope> -->
</dependency>
<!-- end of Hibernate4 -->
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<!--<scope>provided</scope> -->
</dependency>
<!-- end of logging -->
<!-- provided -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>${cglib.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<!-- end of provided -->
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- end of Test -->
<!-- Database -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5-pre3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.21</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- end of Database -->
<!-- velocity -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity.version}</version>
</dependency>
<!-- end of velocity -->
<!-- fileUpload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
<!--io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- end of fileUpload -->
<!-- tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>${tiles.extras.version}</version>
<!-- it will include the rest -->
</dependency>
<!-- end of tiles -->
</dependencies>
<!-- Custom repositories -->
<repositories>
<repository>
<id>springsource-milestones</id>
<name>SpringSource Milestones Proxy</name>
<url>https://oss.sonatype.org/content/repositories/springsource-milestones</url>
</repository>
<repository>
<id>CentralM1</id>
<name>sonatype maven repository</name>
<url>https://repository.sonatype.org/content/shadows/centralm1/</url>
</repository>
</repositories>
<!-- end of Custom repositories -->
<!-- Build support -->
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>7.0.0.pre5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<!-- end of Build support -->
</project>
接下来:web.xml
[html] view plain copy
<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns="http://java.sun.xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>haiercloud-webapp</display-name>
<!-- context-params -->
<!-- webAppRootKey -->
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>haiercloud-webapp</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<!-- Spring configuration file location -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml,
classpath*:applicationContext.xml
</param-value>
</context-param>
<!-- end of context-params -->
<!-- Spring configuration -->
<!-- filters -->
<!-- Spring encoding filter -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<!-- Shiro security filter -->
<!-- The filter-name matches name of a 'shiroFilter' bean inside applicationContext.xml -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<!-- Make sure any request you want accessible to Shiro is filtered. /* catches all -->
<!-- requests. Usually this filter mapping is defined first (before all others) to -->
<!-- ensure that Shiro works in subsequent filters in the filter chain: -->
<!-- Encoding URL mapping -->
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- end of filters -->
<!-- Servlet configuration -->
<servlet>
<servlet-name>SpringDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispathcer-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SpringDispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<!-- end of Servlet configuration -->
<!-- Listeners -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- end of Listeners -->
<!-- jsp configuration -->
<jsp-config>
<jsp-property-group>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.jsp</url-pattern>
<el-ignored>false</el-ignored>
<page-encoding>utf-8</page-encoding>
</jsp-property-group>
</jsp-config>
<!-- end of jsp configuration -->
<!-- Error page definition -->
<!--
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/static_pages/error_pages/500.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/static_pages/error_pages/500.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/static_pages/error_pages/404.jsp</location>
</error-page>
-->
<!-- end of Error page definition -->
<!-- Welcome page definition -->
<!--
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
-->
<!-- end of Welcome page definition -->
</web-app>
原文链接:http://blog.csdn.net/jokes000/article/details/10998109
以下为原文:
最近项目需要进行高要求的Web权限管理,在比较Spring security和Shiro之后由于Shiro更大的灵活度和更强的配置性选择了Shiro。
不过官方的文档写的对于集成spring不太清楚,尤其是Realm怎样实现。
因此,在查阅一系列资料之后,将目前集成的步骤总结出来。
特别推荐博文:http://www.cnblogs.com/xql4j/archive/2013/03/30/2990841.html,此文对作者帮助极大,在此表示感谢!
具体步骤抽象:
修改配置文件:
首先是pom.xml
[html] view plain copy
<!-- Version of jars -->
<properties>
<spring.version>3.2.3.RELEASE</spring.version>
<hibernate.version>4.2.3.Final</hibernate.version>
<slf4j.version>1.7.5</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.11</junit.version>
<cglib.version>3.0</cglib.version>
<velocity.version>1.7</velocity.version>
<tiles.extras.version>3.0.1</tiles.extras.version>
<jsonlib.version>2.4</jsonlib.version>
<shiro.version>1.2.2</shiro.version>
</properties>
<dependencies>
<!-- Spring jars -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
<!-- end of Spring jars -->
<!-- Shiro security -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-cas</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<!-- end of Shiro security -->
<!-- Json -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-lgpl</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-lgpl</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>${jsonlib.version}</version>
<classifier>jdk15</classifier>
</dependency>
<!-- end of Json -->
<!-- Hibernate4 -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
<exclusions>
<exclusion>
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.10</version>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>5.0-1</version>
<!--<scope>provided</scope> -->
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<!--<scope>provided</scope> -->
</dependency>
<!-- end of Hibernate4 -->
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<!--<scope>provided</scope> -->
</dependency>
<!-- end of logging -->
<!-- provided -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>${cglib.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<!-- end of provided -->
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- end of Test -->
<!-- Database -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5-pre3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.21</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- end of Database -->
<!-- velocity -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity.version}</version>
</dependency>
<!-- end of velocity -->
<!-- fileUpload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
<!--io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- end of fileUpload -->
<!-- tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>${tiles.extras.version}</version>
<!-- it will include the rest -->
</dependency>
<!-- end of tiles -->
</dependencies>
<!-- Custom repositories -->
<repositories>
<repository>
<id>springsource-milestones</id>
<name>SpringSource Milestones Proxy</name>
<url>https://oss.sonatype.org/content/repositories/springsource-milestones</url>
</repository>
<repository>
<id>CentralM1</id>
<name>sonatype maven repository</name>
<url>https://repository.sonatype.org/content/shadows/centralm1/</url>
</repository>
</repositories>
<!-- end of Custom repositories -->
<!-- Build support -->
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>7.0.0.pre5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<!-- end of Build support -->
</project>
接下来:web.xml
[html] view plain copy
<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns="http://java.sun.xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>haiercloud-webapp</display-name>
<!-- context-params -->
<!-- webAppRootKey -->
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>haiercloud-webapp</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<!-- Spring configuration file location -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml,
classpath*:applicationContext.xml
</param-value>
</context-param>
<!-- end of context-params -->
<!-- Spring configuration -->
<!-- filters -->
<!-- Spring encoding filter -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<!-- Shiro security filter -->
<!-- The filter-name matches name of a 'shiroFilter' bean inside applicationContext.xml -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<!-- Make sure any request you want accessible to Shiro is filtered. /* catches all -->
<!-- requests. Usually this filter mapping is defined first (before all others) to -->
<!-- ensure that Shiro works in subsequent filters in the filter chain: -->
<!-- Encoding URL mapping -->
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- end of filters -->
<!-- Servlet configuration -->
<servlet>
<servlet-name>SpringDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispathcer-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SpringDispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<!-- end of Servlet configuration -->
<!-- Listeners -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- end of Listeners -->
<!-- jsp configuration -->
<jsp-config>
<jsp-property-group>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.jsp</url-pattern>
<el-ignored>false</el-ignored>
<page-encoding>utf-8</page-encoding>
</jsp-property-group>
</jsp-config>
<!-- end of jsp configuration -->
<!-- Error page definition -->
<!--
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/static_pages/error_pages/500.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/static_pages/error_pages/500.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/static_pages/error_pages/404.jsp</location>
</error-page>
-->
<!-- end of Error page definition -->
<!-- Welcome page definition -->
<!--
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
-->
<!-- end of Welcome page definition -->
</web-app>
相关推荐
**Maven**:Maven 是一个项目管理和综合工具,用于自动化构建、依赖管理和项目信息管理。在本项目中,Maven 负责管理所有依赖库的下载、编译、测试、打包和部署过程,通过在`pom.xml`文件中定义项目依赖关系,使得...
标题 "maven+springmvc+shiro+hibernate" 提到的是一个常见的Java Web开发技术栈,由四个核心组件组成:Maven、Spring MVC、Shiro和Hibernate。这些技术在构建现代、高效的企业级应用中起着至关重要的作用。 1. ...
在"maven+springmvc+hibernate+shiro权限控制"的项目中,Maven作为项目构建工具,管理项目的依赖关系,使得各个框架的集成更加便捷。Maven的pom.xml文件定义了项目所需的库和插件,通过简单的命令就可以完成编译、...
Hibernate4.2+Spring3.2+SpringMVC+shiro1.2.2+Maven整合和简单的登陆,导入工程后见description,内容简单基础,想做成脚手架供自己以后使用,望高手勿喷有什么宝贵意见望留言,谢谢
在这个案例中,我们将构建一个基于SpringMVC框架并集成Apache Shiro进行权限管理的系统。系统主要涉及到四个关键表:`t_user`、`t_role`、`t_user_role`以及`t_permission`。 1. **`t_user` 用户表**:用于存储用户...
spring_springMVC_hibernate_shiro_maven_demo maven项目 整合 hibernate、spring、springMvc、shiro、框架,所以在功能上很多 都没有实现,项目主要体现shiro的权限管理、授权功能、及身份验证
下面将详细解释这三个框架的集成以及 EasyUI 和 Maven 在项目搭建中的作用。 **Spring 框架** Spring 是一个全面的企业级应用框架,它通过提供 DI 和 AOP 实现了松耦合,使得代码更易于测试和维护。DI 允许外部容器...
SpringMVC整合Shiro,Shiro是一个强大易用的Java安全框架,提供了认证、授权、加密和会话管理等功能。 配置applicationContext-shiro.xml 1. 配置authorizingRealm ...
这个压缩包"SpringMVC+hibernate+spring+shiro+Ehcache所需jar包"提供了搭建基于SpringMVC、Spring 4.2、Hibernate 4.3、Shiro 1.2.4和Ehcache 2.0的基础组件,这些都是Java开发中非常流行和实用的工具。接下来,...
在IT领域,构建高效、可扩展的Web应用是至关重要的,而"spring+springMVC+jpa+hibernate框架整合"就是一个常见的解决方案。这个整合涉及到四个关键的技术栈:Spring框架、SpringMVC、JPA(Java Persistence API)...
基于ssm+easyUI+mysql+maven+shiro开发 本系统实现目标如下: ## 项目技术架构(Spring+SpringMVC+Mybatis) ## - Maven - Spring(IOC DI AOP 声明式事务处理) - SpringMVC(支持Restful风格) - Hibernate ...
spring+springMVC+hibernte+shiro框架(非maven) 空框架,没什么东西,hibernate entities自己改一下就能跑起来 ,也可以用hibernate 生成数据库 ,只做了些登陆验证 ,授权写起来太麻烦。 有点垃圾,请见谅哈!
以springmvc+hibernate+spring 为根本搭建起来的web项目架子。并后续添加各种功能。 master是主分支。 并以maven构建起来的三大框架为架子。后续的开发是以master主分支进行开发的。 bra_add_shiro 分支。 在master...
《构建企业级Web应用:Spring、SpringMVC、Hibernate、Shiro、Maven与EasyUI集成详解》 在现代企业级Web开发中,一个高效、稳定的框架组合是至关重要的。"tianyu"项目整合了Spring、SpringMVC、Hibernate、Shiro、...
采用的是maven管理工程 项目架构是 springmvc4.2.4.RELEASE+spring4.2.4.RELEASE+shiro1.22+hibernate5.1.0.Final 前端框架采用的是bootstrap 实现了角色+权限+用户的控制,另外为了能够更好的查看效果我加了一个实体...
本篇文章将详细介绍如何将这三个组件结合,构建一个基于SpringMVC+MyBatis的Shiro安全框架实例。 首先,让我们了解SpringMVC。它是Spring框架的一部分,主要处理HTTP请求,提供了模型-视图-控制器(MVC)的架构模式...
#####jty是由spring+springmvc+hibernate+shiro+quartz+maven+easyui写的一个框架集合,参考了springside,jeesite等一些优秀的开源项目,目前实现了一个基础的权限管理系统,界面美观(我觉的挺好看...囧),后面如果...
《2021-基于Maven+SpringMVC高校教务管理系统》是一个综合性的软件项目,主要用于高校的教务管理。这个系统利用了Maven作为项目构建工具,SpringMVC作为核心的MVC框架,实现了高效、灵活的教务管理功能。下面将详细...
基于ssm+easyUI+mysql+maven+shiro开发 本系统实现目标如下: ## 项目技术架构(Spring+SpringMVC+Mybatis) ## - Maven - Spring(IOC DI AOP 声明式事务处理) - SpringMVC(支持Restful风格) - Hibernate ...
【标题】中的"Spring+SpringMVC+Mybatis+Shiro+Hibernate验证+JSON+JSTL、EL+文件上传io jar包"涉及到的是一个经典的Java Web开发技术栈,通常用于构建企业级应用程序。下面将详细介绍这些技术及其在项目中的作用:...