spring - Spring Security 与部署在 tomcat serverINFO 中的 Jersey REST 绑定:在类路径上未检测到 Spring WebApplicationInitializer 类型
问题描述
我有一个使用 Jersey Rest & Spring Security 实现的应用程序,位于 tomcat/webapps 文件夹下。我正在使用命令提示符使用 tomcat 启动命令并收到此消息。不幸的是,服务器开始工作。
我正在使用基于注释的方法来配置 bean。
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter
{
// My configuratio code
}
web.xml 有 spring & jersey
<?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_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>TestApplication</display-name>
<servlet>
<servlet-name>TestApplication</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.MyApplication</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>TestApplication</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>com.MyContextListener</listener-class>
</listener>
<!-- Configure ContextLoaderListener to use AnnotationConfigWebApplicationContext
instead of the default XmlWebApplicationContext -->
<context-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</context-param>
<!-- Configuration locations must consist of one or more comma- or space-delimited
fully-qualified @Configuration classes. Fully-qualified packages may also be
specified for component-scanning -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>com.infor.seService.ui.sso.WebSecurityConfig</param-value>
</context-param>
<!-- Bootstrap the root application context as usual using ContextLoaderListener -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<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>
</web-app>
我没有使用任何弹簧靴 我不确定是否需要修复此错误,因为我使用的是基于注释的方法。任何参考文章都非常适用。
解决方案
推荐阅读
- vba - 通过他们的 wparam 删除消息
- javascript - 比较对象、复选框检查、编辑复选框
- python - 直方图的自定义排序
- javascript - 带有默认应用程序 CSS 的 TinyMCE 内容
- javascript - 最小材料表演示 ID 列未呈现?
- youtube - 除了配额分配之外,Youtube Data API V3 还存在哪些限制?
- sql-server - 无法导入包。警告 SQL72012:目标中存在对象
- sql - 从另一个表中获取值后,如何从连接中递归查找值?
- javascript - Firebase 数据库规则:.exists() 始终为真
- python - 如何检查列表元素中是否存在值?