spring - Spring MVC 自定义 url 模式
问题描述
我已经配置了 Spring Security,但它不能工作。
我的 web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/dispatcherServlet-servlet.xml
/WEB-INF/security-config.xml
</param-value>
</context-param>
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/spring/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Spring Security filter -->
<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>
当我定义 DispatcherServlet 的 url-pattern / 时,它工作正常。但是当我将其更改为 /spring/* 时,虽然我配置了 /* 和 /spring/* 的过滤器映射的 url-pattern ,但它无法工作
在这种情况下,我该怎么办?请告诉我
解决方案
推荐阅读
- activemq - 如何在 ActiveMQ 中使用 JmsPooledConnectionFactory 设置异步发送
- ssl - 从 CRT 和 PEM 文件创建 JKS
- python - 尝试在 Jupyter Notebook 中加载数据集时出现 ConnectionRefusedError
- java - 不应该在 Jbutton.update 上使用 getGraphics(),为什么?
- reactjs - 如何使用reactjs获取检查的数据
- google-colaboratory - 在同一会话期间编码时无法保存两个用户更改
- git - 管理第三方存储库克隆的最简单方法?
- optimization - GAMS 中的迭代优化
- react-native - 状态未在指定函数内更新
- c# - 列表数据的 C# 深度克隆