The situation . I have a class with a property annotated with @Autowired:
public class MyClass { @Autowired protected MyAutoWiredBean myAutowiredBean; }
Is it possible to make the wiring of this bean optional, i.e. if such a bean is defined in some configuration file - to post it, but if such a bean is not defined - just continue working without metaling:
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
source share