栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

解决java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes [Generi

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

解决java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes [Generi

上报错信息
java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes [Generic bean: class [cn.hy.portal.PortalApplication]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [G:mavenShopshop-portaltargetclassescnhyportalPortalApplication.class], Generic bean: class [cn.hy.portal.PotalApplication]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [G:mavenShopshop-portaltargetclassescnhyportalPotalApplication.class]]

 at org.springframework.util.Assert.state(Assert.java:97)
 at org.springframework.boot.test.context.AnnotatedClassFinder.scanPackage(AnnotatedClassFinder.java:92)
 at org.springframework.boot.test.context.AnnotatedClassFinder.findFromPackage(AnnotatedClassFinder.java:82)
 at org.springframework.boot.test.context.AnnotatedClassFinder.findFromClass(AnnotatedClassFinder.java:68)
 at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.getOrFindConfigurationClasses(SpringBootTestContextBootstrapper.java:234)
 at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.processMergedContextConfiguration(SpringBootTestContextBootstrapper.java:151)
 at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:395)
 at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:312)
 at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:265)
 at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTe

解决办法 将多余的启动注解 注释掉


原因:
点进去这个注解,你会看到红框内引用了一个注解,这与我测试的注解冲突,于是注释掉这个注解。当测试完了,之后在把这个注解重新添加

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/315041.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号