运行juint时,出现错误,错误信息如下:

java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes [Generic bean: class [com.lich.DemoApplication]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [D:\idea_workspace\demo\target\classes\com\lich\DemoApplication.class], Generic bean: class [com.lich.WebConfig]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [D:\idea_workspace\demo\target\classes\com\lich\WebConfig.class]]at org.springframework.util.Assert.state(Assert.java:70)at org.springframework.boot.test.context.SpringBootConfigurationFinder.scanPackage(SpringBootConfigurationFinder.java:69)at org.springframework.boot.test.context.SpringBootConfigurationFinder.findFromPackage(SpringBootConfigurationFinder.java:59)at org.springframework.boot.test.context.SpringBootConfigurationFinder.findFromClass(SpringBootConfigurationFinder.java:52)at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.getOrFindConfigurationClasses(SpringBootTestContextBootstrapper.java:201)at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.processMergedContextConfiguration(SpringBootTestContextBootstrapper.java:137)at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:397)at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:311)at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:265)at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:105)at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.buildTestContext(SpringBootTestContextBootstrapper.java:82)at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:120)at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:105)at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:152)at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:143)at org.springframework.test.context.junit4.SpringRunner.<init>(SpringRunner.java:49)at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)at java.lang.reflect.Constructor.newInstance(Constructor.java:423)at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

对此找到对应的config配置类,看到如下信息:

@SpringBootConfiguration
public class WebConfig extends WebMvcConfigurationSupport{@Overrideprotected void addInterceptors(InterceptorRegistry registry) {super.addInterceptors(registry);registry.addInterceptor(new ApiInterceptor());}}

因为@SpringBootConfiguration这个注解,所以导致上述的问题,因为注解@SpringBootApplication包含了@SpringBootConfiguration这个注解,导致重复加载所致,所以,注释掉自己配置的即可运行juint了,其实最主要的问题是在配置拦截器时使用的注解不对,应该使用@Configuration

Found multiple @SpringBootConfiguration annotated classes相关推荐

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

    上报错信息 java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes [Ge ...

  2. Prior to Segment: Foreground Cues for Weakly Annotated Classes in Partially Supervised Inseg

    摘要 部分监督实例分割的目的是利用更丰富的弱框标签来改善有限掩码标签的掩码预测.在这项工作中,我们证明了在部分监督实例分割中常用的类不可知掩码头,仅使用框监督很难学习弱注释类的前景的一般概念.为了解决 ...

  3. 单元测试junit+mock

    单元测试 是什么? 单元测试(unit testing),是指对软件中的最小可测试单元进行检查和验证.至于"单元"的大小或范围,并没有一个明确的标准,"单元"可 ...

  4. Multiple Inheritance Considered Useful

    转 Multiple Inheritance Considered Useful 这篇博文较长,需要耐心看完 Multiple Inheritance Considered Useful By Jac ...

  5. 看看Spring的源码(一)——Bean加载过程

    首先Web项目使用Spring是通过在web.xml里面配置 org.springframework.web.context.ContextLoaderListener初始化IOC容器的. <l ...

  6. All About Angular 2.0

    2019独角兽企业重金招聘Python工程师标准>>> angular All About Angular 2.0 Posted by Rob Eisenberg on  Novem ...

  7. SprintBoot开发官方指导文档

    2019独角兽企业重金招聘Python工程师标准>>> http://docs.spring.io/spring-boot/docs/current/reference/html/b ...

  8. spring源码分析之@Conditional

    根源在AnnotationConfigApplicationContext和AnnotationConfigWebApplicationContext,以AnnotationConfigApplica ...

  9. spring 源码分析之BeanPostProcessor

    1.官方解答: Factory hook that allows for custom modification of new bean instances, e.g. checking for ma ...

  10. How does Spring @Transactional Really Work?--转

    原文地址:http://blog.jhades.org/how-does-spring-transactional-really-work/ In this post we will do a dee ...

最新文章

  1. php上传漏洞绕过gd库,jQuery File Upload任意文件上传漏洞
  2. OPC向UNIX的演进(OPC evolution toward UNIX)
  3. IPFS + 区块链 系列】 入门篇 - IPFS + Ethereum (上篇)-js-ipfs-api
  4. POJ 3984 迷宫问题 BFS求最短路线+路径记录
  5. 记录下UIButton的图文妙用和子控件的优先显示
  6. 赛码网算法: 上台阶 ( python3实现 、c实现)
  7. 问题 1052: [编程入门]链表合并
  8. 工程勘察设计收费标准2002修订版_全过程工程咨询收费模式超全解析
  9. springboot 前缀_springboot搭配thymeleaf访问html页面的时候,什么时候需要自定义前缀和后缀呢...
  10. 苹果XR信号差,可否要求苹果公司召回?
  11. V神已抵京,倒计时4天!6大理由告诉你为什么要参加“2019以太坊技术及应用大会”...
  12. 浅谈n个球和m个盒子之间的乱伦关系
  13. javascript 中的location.pathname
  14. linux环境变量的系统设置
  15. 2018-2019-2 20165118 《网络对抗技术》Exp4 恶意代码分析
  16. 2021SC@SDUSC Zxing开源代码(十六)PDF417二维码(二)
  17. svnserver 修改配置后重启
  18. Android10 BT MAC地址获取流程
  19. xml--通过DOM解析XML
  20. linux第一周作业

热门文章

  1. SAS PROC SQL
  2. 网络适配器突然消失的解决办法
  3. 初学太极拳须知--吴公仪
  4. echarts 正负条形图
  5. windows保护无法启动修复服务器,win10使用命令修复系统时提示Windows 资源保护无法启动修复服务怎么办...
  6. python未来怎么样至少现在很开心_Python的未来解析
  7. Dataframe两个表格合并
  8. 牛客--两种排序方法
  9. ps 自动生成html代码,ps怎么生成html网页文件 PS生成html网页文件的具体教程
  10. magento常用插件