这是我的设置
- IntelliJ IDEA
- 使用开发工具的 Spring Boot
- 龙目岛
一切正常,但大约每隔一秒自动服务器重启我都会收到以下错误消息:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field billingCode in com.whatever.model.BillingCodeRowMapper required a bean of type 'com.whatever.model.BillingCode' that could not be found.
Action:
Consider defining a bean of type 'com.whatever.model.BillingCode' in your configuration.
我的main
样子是这样的:
package com.whatever;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Application.class, args);
}
}
我的BillingCode
课看起来像这样:
package com.whatever.model;
import lombok.Data;
import org.springframework.stereotype.Component;
import java.util.Date;
@Component
@Data
public class BillingCode {
private int billingCodeId;
private String billingCodeName;
private Boolean billingCodeFuelSurcharge;
private Boolean billingCodeToll;
private String billingCodeAccount;
private float billingCodeVat;
private Date billingCodeDateAdded;
private Date billingCodeDateChanged;
private Boolean billingCodeShippingSurcharge;
private Boolean billingCodeCurrencySurcharge;
private String billingCodeMarking;
}
BillingCode
是@Autowired
在BillingCodeRowMapper
,如果我停止服务器并手动启动它一切正常。有时会以不同的顺序加载自动装配,还是 IJ 问题还是 Lombok 问题?