I'm upgrading spring form 4.3.3 to 5.2.7 and I'm having this exception:
Exception:
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean' defined in com.test: Unsatisfied dependency expressed through method 'MyBean' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
code :
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@SuppressWarnings({ "unchecked" })
public MyBean MyBean(String url,
String user, String password, String id) {
return MyBean(url, user, password, id,
new HashMap<String, String>(),false);
}
PS 1: I'm using context.getBean with args to init my bean
PS 2: I'm facing this problem at the startup of the application even though im not using the bean at the startup ( I'm using @Scope("prototype") to init the bean whenever it's called)
PS 3: I didn't have the problem with spring 4.3.3