Spring Boot 启动 Struts 报冲突

错误信息如下:

Caused by: com.opensymphony.xwork2.config.ConfigurationException: Bean type class com.opensymphony.xwork2.ObjectFactory with the name struts has already been loaded by bean - jar:file:/C:/Users/YuCheng/Documents/WorkDir/Ossez/cwiki-us/src/spring-boot-sample-struts2/target/spring-boot-sample-struts2-1.0.0-SNAPSHOT.war!/WEB-INF/lib/struts2-core-2.5.16.jar!/struts-default.xml:73:72
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:260) ~[struts2-core-2.5.16.jar!/:2.5.16]
        ... 19 common frames omitted

这个有可能是

<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.5.16</version>
</dependency>

和 Spring Boot 的环境有冲突。

你可以在上面的引用中添加一个 <scope>provided</scope> 然后修改为:

<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.5.16</version>
<scope>provided</scope>
</dependency>

https://www.cwiki.us/questions/41681342

原文地址:https://www.cnblogs.com/huyuchengus/p/10036105.html

时间: 2024-07-31 14:06:43

Spring Boot 启动 Struts 报冲突的相关文章

spring Boot启动报错Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes

spring boot 启动报错如下 org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure

spring boot入门实例报404问题

今天突然想对spring boot写个hello world,应用成功启动后,访问http://localhost:8080/hello报404. 场景说明:controller类所在包:com.yjl.test.controller  ,,,spring boot应用启动类所在包:com.yjl.test.springboot,按网上所查spring boot应用扫描类的说法,于是在应用启动类加有@ComponentScan(basePackages = {"com.yjl.test.cont

spring boot 整合kafka 报错 Exception thrown when sending a message with key=&#39;null&#39; and payload=JSON to topic proccess_trading_end: TimeoutException: Failed to update metadata after 60000 ms.

org.springframework.kafka.support.LoggingProducerListener- Exception thrown when sending a message with key='null' and payload='{"dataDts":["20180329","20180328","20180327","20180326","20180323"]

Spring Boot启动原理解析

Spring Boot启动原理解析http://www.cnblogs.com/moonandstar08/p/6550758.html 前言 前面几章我们见识了SpringBoot为我们做的自动配置,确实方便快捷,但是对于新手来说,如果不大懂SpringBoot内部启动原理,以后难免会吃亏.所以这次博主就跟你们一起一步步揭开SpringBoot的神秘面纱,让它不在神秘. 正文 我们开发任何一个Spring Boot项目,都会用到如下的启动类 从上面代码可以看出,Annotation定义(@Sp

spring boot启动原理步骤分析

spring boot最重要的三个文件:1.启动类 2.pom.xml 3.application.yml配置文件 一.启动类->main方法 1.spring boot通过fat jar方式用jdk命令java -jar jarname.jar启动的. fat jar就是包含被引用jar包的jar,因为会包含很多jar包,所以称为fat,肥胖. 2.spring  boot通过static void main方法启动,main方法是java程序总是最先运行的地方,这个是由jvm虚拟机决定的.任

Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动

之前在Spring Boot启动过程(二)提到过createEmbeddedServletContainer创建了内嵌的Servlet容器,我用的是默认的Tomcat. private void createEmbeddedServletContainer() { EmbeddedServletContainer localContainer = this.embeddedServletContainer; ServletContext localServletContext = getServ

Spring Boot启动过程(三)

我已经很精简了,两篇(Spring Boot启动过程(一).pring Boot启动过程(二))依然没写完,接着来. refreshContext之后的方法是afterRefresh,这名字起的真...好.afterRefresh方法内只调用了callRunners一个方法,这个方法从上下文中获取了所有的ApplicationRunner和CommandLineRunner接口的实现类,并执行这些实现类的run方法.例如Spring Batch的JobLauncherCommandLineRun

Spring Boot启动过程及回调接口汇总

Spring Boot启动过程及回调接口汇总 链接: https://www.itcodemonkey.com/article/1431.html 来自:chanjarster (Daniel Qian) 注:本文基于spring-boot 1.4.1.RELEASE, spring 4.3.3.RELEASE撰写. 启动顺序 Spring boot的启动代码一般是这样的: 1 2 3 4 5 6 @SpringBootApplication public class SampleApplica

Spring Boot 启动(二) 配置详解

Spring Boot 启动(二) 配置详解 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) Spring Boot 配置文件加载顺序 Spring Boot 配置文件加载分析 - ConfigFileApplicationListener 一.Spring Framework 配置 略... 二.Spring Boot 配置 2.1 随机数配置 name.value=${random.int} name.int=${