新建Java Daynamic Web项目

导入Spring、SpringMVC依赖包:

导入Spring & Spring MVC包(导入如下所有开发包):

Java-Shiro(三):Shiro与Spring MVC集成

Spring AOP依赖扩展包:

Java-Shiro(三):Shiro与Spring MVC集成

配置Spring : 

1)修改web.xml导入“#contextLoaderListener”

Java-Shiro(三):Shiro与Spring MVC集成

配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>shiro-web-01</display-name>
    <!-- 配置Spring的 ContextLoaderListener -->
    <!-- needed for ContextLoaderListener -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>

    <!-- Bootstraps the root web application context before servlet initialization -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
</web-app>
View Code

相关文章:

  • 2022-12-23
  • 2021-08-02
  • 2021-06-08
  • 2021-10-21
  • 2021-04-15
  • 2022-12-23
  • 2021-09-18
  • 2021-07-14
猜你喜欢
  • 2021-05-21
  • 2022-01-13
  • 2021-10-27
  • 2021-07-30
  • 2021-11-23
  • 2021-06-18
相关资源
相似解决方案