形势 @Autowired属性:我有我类属性与@Autowired注解:春:怎么不理,如果豆没有定义
public class MyClass {
@Autowired
protected MyAutoWiredBean myAutowiredBean;
}
是否有可能以制作布线这个bean可选,即如果这样的bean是在一些配置文件中定义 - 接线,但如果没有定义这样的绿豆 - 只是继续未抛出的工作:
org.springframework.beans.factory.BeanCreationException:
Could not autowire field: protected MyAutoWiredBean...;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No matching bean of type [com.mypackage.MyAutoWiredBean] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.
是的,是完美的作品,谢谢。 – dim1902