类:
@Component
@ConfigurationProperties(prefix = "com.example.opensource")
@PropertySource(value = "classpath:resource.properties")
public class Resource {
private String name;
private String website;
private String language;
错误描述
Description:
Field resource in com.example.controller.HelloController required a bean of type 'com.example.pojo.Resource' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.example.pojo.Resource' in your configuration.
这个问题是因为启动类 要放到最外边