java Jboss 在类路径上未检测到 Spring WebApplicationInitializer 类型

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16898306/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-01 00:18:59  来源:igfitidea点击:

Jboss No Spring WebApplicationInitializer types detected on classpath

javaspringjboss7.x

提问by Samurai

I am trying to deploy my project in JBoss7.1.1 server. But I am getting below message and my project is not getting deployed.

我正在尝试在 JBoss7.1.1 服务器中部署我的项目。但是我收到以下消息并且我的项目没有得到部署。

 19:13:39,075 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "ips-configuration-dynamic.war" 
 19:13:42,731 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ips-configuration-dynamic]] (MSC service thread 1-8) No Spring WebApplicationInitializer types detected on classpath
 19:13:42,781 INFO  [org.jboss.web] (MSC service thread 1-8) JBAS018210: Registering web context: /ips-configuration-dynamic
 19:13:43,723 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "ips-configuration-dynamic.war"

I am using Spring 3.1.1 release jars. Thanks in advance.

我正在使用 Spring 3.1.1 发布 jars。提前致谢。

回答by Sotirios Delimanolis

In a typical servlet application, you would have a web.xmldescriptor file to declare your serlvets, filters, listeners, context params, security configuration, etc. for your application. Since servlet 3.0 you can do most of that programmatically.

在典型的 servlet 应用程序中,您将有一个web.xml描述符文件来为您的应用程序声明您的服务、过滤器、侦听器、上下文参数、安全配置等。从 servlet 3.0 开始,您可以以编程方式完成大部分工作。

Servlet 3.0 offers the interface ServletContainerInitializer, which you can implement. Your servlet container will look for your implementation of that class in META-INF/services/javax.servlet.ServletContainerInitializerfile, instantiate it, and call its onStartup()method.

Servlet 3.0 提供了ServletContainerInitializer可以实现的接口。您的 servlet 容器将在META-INF/services/javax.servlet.ServletContainerInitializer文件中查找该类的实现、实例化它并调用其onStartup()方法。

Spring has built WebApplicationInitializeron top of that interface, as an adapter/helper.

Spring 构建WebApplicationInitializer在该接口之上,作为适配器/助手。

You need either the web.xmldescriptor or a class that implements WebApplicationInitializerto setup and run your application.

您需要web.xml描述符或实现WebApplicationInitializer设置和运行应用程序的类。