org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type
This exception occurs when the bean is not defined and we are referring the same.
So to resolved this issue you can either use @Component("BeanName") with the bean name to define bean or can define a bean in applicationContext.xml or beans.xml.
Below is sample code for both ways.
1-In java class using annotation
@Component("myservice")
public class StudentService{
}
2-In XML files
<bean id="myservice" class="com.skuera.service.StudentService">
</bean>
So to resolved this issue you can either use @Component("BeanName") with the bean name to define bean or can define a bean in applicationContext.xml or beans.xml.
Below is sample code for both ways.
1-In java class using annotation
@Component("myservice")
public class StudentService{
}
2-In XML files
<bean id="myservice" class="com.skuera.service.StudentService">
</bean>
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type
Reviewed by JavaInstance
on
11:17:00 AM
Rating:
No comments: