问题描述

问题分析

没在根目录下写一个Spring Boot的启动类。

解决方案

方案一:Class

在根目录下写一个Spring Boot的启动类。

方案二:注解 

需要在注解上加上

@SpringBootTest(classes = Application.class)

或者

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {JPAConfig.class})

或者

@RunWith(SpringRunner.class)
@ContextConfiguration(classes = {JPAConfig.class})

或者

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(value={"myJPAConfig.xml"})

或者

@RunWith(SpringRunner.class)
@ContextConfiguration(value={"myJPAConfig.xml"})

参考文章

https://blog.csdn.net/csdn_am/article/details/79757097

https://blog.csdn.net/rhb99999/article/details/73550860

https://blog.csdn.net/weixin_39220472/article/details/80206449

Spring Boot——[java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration]解决方案相关推荐

  1. java.lang.IllegalStateException Unable to find a @SpringBootConfiguration错误解决方案(亲测)

    问题描述: java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @C ...

  2. spring boot:java.lang.IllegalStateException异常

    1.单元测试报错: java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @B ...

  3. java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Contex

    报这个错,是因为测试包名和项目包名不一致导致的.

  4. java.lang.IllegalStateException: Unable to read meta-data for class 问题的解决

    java.lang.IllegalStateException: Unable to read meta-data for class 问题的解决 参考文章: (1)java.lang.Illegal ...

  5. SpringBootTest测试类报错:Suppressed: java.lang.IllegalStateException: Unable to find a @SpringBootCon

    在一个特别简单的mybatisPlus测试类中,单元测试时,报错Suppressed: java.lang.IllegalStateException: Unable to find a @Sprin ...

  6. spring异常java.lang.IllegalStateException

    十月 26, 2017 11:23:24 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler [&q ...

  7. SSM 之 java.lang.IllegalStateException: Failed to load ApplicationContext 错误解决方案

    SSM框架搭建后台项目,为了便于接口开发测试,笔者在项目中使用了Junit测试用例来测试接口,在测试运行后,出现如下错误: java.lang.IllegalStateException: Faile ...

  8. java.lang.RuntimeException: Unable to start activity ComponentInfo解决方案

    java.lang.RuntimeException:Unable to start activityComponentInfo{com.example.newsreader/com.example. ...

  9. Spring 测试运行的时候提示 Unable to find a @SpringBootConfiguration 错误

    Spring 进行测试的时候提示的错误信息如下: SEVERE: Caught exception while closing extension context: org.junit.jupiter ...

最新文章

  1. Linux学习笔记之文件管理和目录管理类命令
  2. Java对象序列化详解6,Java对象的序列化与反序列化详解
  3. bzoj3270 博物馆
  4. 深度学习网络backbone?head、neck、bottleneck、GAP、Embedding、pretext task、downstream task、temperature parameter
  5. Docker存储和虚拟化存储需求不同
  6. 【资讯】CloudBase Framework工具推荐:前后端一体化部署,效能提升开源“神器”
  7. Spring Cloud基础教程
  8. [vue] 怎么访问到子组件的实例或者子元素?
  9. 自动生成三层结构代码(2)--生成实体类
  10. 挂服务器刷屏微信,谁知道微信群刷屏代码啊,跪求
  11. tensorflow之 feature_column + pre-made estimator组合实战
  12. .net C#实现图像对比
  13. 硬见小百科:机加工中获得工件尺寸精度的常用方法
  14. 【毕业设计】STM32智能药箱系统 - 单片机 嵌入式 物联网
  15. 电力监控服务器维修,地铁电力监控系统(PSCADA)发生故障应该如何处理
  16. 上海黄山自游二日游攻略
  17. ECSHOP二次开发帮助之全部程序文件说明
  18. 3种重新启动或强制关闭任何Mac死机的方法
  19. 数据分析师需要学习什么课程?
  20. Android Studio:使用SVN进行版本控制

热门文章

  1. java max sum_杭电1024 Max Sum Plus Plus状压dp(java)
  2. linux命令拉取windows的文件,find命令、文件名后缀以及Linux和Windows互传文件(示例代码)...
  3. openstack 重启mysql_突然断电导致mariadb数据库无法启动(openstack 命令无法使用)...
  4. springboot 前缀_SpringBoot配置文件的注入
  5. 怎样自动提取邮件的内容_流程自动化和人工智能如何创建智慧物流?
  6. Collections.sort()泛型集合排序的使用,和自定义类实现Comparable<T>接口重写compareTo(T o)方法完成Collections.sort()排序,以及自定义排序规则
  7. Java受查异常和运行时异常的理解
  8. linux空指针异常能捕获到吗,一次kernel panic分析--空指针in handle_IRQ_event
  9. java过滤4字节_乐字节Java8核心特性实战之四:方法引用
  10. mysql 热切换_热备服务器中,切换master中切换SQL