学习SpringBoot遇到的问题(spring 版本报红、无效发行版、单元测试类没有启动按钮、@ConfigurationProperties报红)

1、版本报红

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->

2、Error:java: 无效的目标发行版: 11
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3、单元测试类没有启动按钮
在这里插入图片描述

4、@ConfigurationProperties报红
springboot配置注解处理器没有找到

@Component
@ConfigurationProperties(prefix = "person")    //2.1.9不配置用会爆红,不影响使用
public class Person {

    private String name;
    private Integer age;
    private Boolean happy;
    private Date birth;
    private Map<String,Object> maps;
    private List<Object> lists;
    private Dog dog;
<!-- 导入配置文件处理器,配置文件进行绑定就会有提示,需要重启 -->
<dependency>  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-configuration-processor</artifactId>
    <optional>true</optional>
</dependency>

版权声明:本文为weixin_43660497原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。