解决spring-boot-configuration-processor导入之后,任没有提示问题
idea在导入spring-boot-configuration-processor依赖之后,任然没有提示,在检查pom文件以及自己代码之后发现并没有问题
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
检查注解
@ConfigurationProperties
也已经使用
@Component
@ConfigurationProperties
public class Student {
private Integer stuId;
private String stuName;
private Boolean graduated;
private String[] subject;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date birthday;
private Map<String, String> teachers;
private Address address;
public Student() {
}
public Student(Integer stuId, String stuName, Boolean graduated, String[] subject, Date birthday, Map<String, String> teachers, Address address) {
this.stuId = stuId;
this.stuName = stuName;
this.graduated = graduated;
this.subject = subject;
this.birthday = birthday;
this.teachers = teachers;
this.address = address;
}
public Integer getStuId() {
return stuId;
}
public void setStuId(Integer stuId) {
this.stuId = stuId;
}
public String getStuName() {
return stuName;
}
public void setStuName(String stuName) {
this.stuName = stuName;
}
public Boolean getGraduated() {
return graduated;
}
public void setGraduated(Boolean graduated) {
this.graduated = graduated;
}
public String[] getSubject() {
return subject;
}
public void setSubject(String[] subject) {
this.subject = subject;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Map<String, String> getTeachers() {
return teachers;
}
public void setTeachers(Map<String, String> teachers) {
this.teachers = teachers;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
@Override
public String toString() {
return "Student{" +
"stuId=" + stuId +
", stuName='" + stuName + '\'' +
", graduated=" + graduated +
", subject=" + Arrays.toString(subject) +
", birthday=" + birthday +
", teachers=" + teachers +
", address=" + address +
'}';
}
}
在检查之后得出:
导完所有依赖之后刷新maven工程,还有重要的一步,将工程重新build
问题解决:
版权声明:本文为pleading原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。