报告 @Autowired
在 Spring bean 构造函数上的错误用法:多个 @Autowired
构造函数、没有匹配的 @Autowired
构造函数,等等。
示例:
@Component
public class MyComponent {
@Autowired
public MyComponent(BarBean bean) {...} // 报告 ‘只允许一个 @Autowired 构造函数’
@Autowired
public MyComponent(FooBean bean) {...} // 报告 “只允许一个 @Autowired 构造函数”
}
@Component
public class MyFactory { // 报告 “没有匹配的 @Autowired 构造函数”
public MyFactory(String str) {...}
public MyFactory(int count) {...}
}