- 在pom.xml中 引入依赖。
<!-- SpringSecurity对Web应用进行权限管理 -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.2.10.RELEASE</version>
</dependency><!-- SpringSecurity配置 -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.2.10.RELEASE</version>
</dependency><!-- SpringSecurity标签库 -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>4.2.10.RELEASE</version>
</dependency>
-
在web.xml中加入过滤器:
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> - 新建一个类,继承WebSecurityConfigurerAdapter类
- 此时启动,会报找不到 springSecurityFilterChain 这个bean
- 如何解决该问题:
方案二:修改源码:
SpringSecurity引入以及启动问题分析
最新推荐文章于 2024-07-21 10:42:02 发布