Я пытаюсь создать боб и чем пытаться внедрить то же самое в моем контроллере, но я получаю отказ создание боб error.Here мой кодсоздание Bean терпит неудачу (весна)
@Service("springSecurityLoginServiceImpl")
public class SpringSecurityLoginServiceImpl implements SpringSecurityLoginService
{
//impl
}
это как Я пытаюсь внедрить его в моем контроллере
@Controller
@RequestMapping("springSecurity/login.json")
public class SpringSecurityLoginController
{
@Autowired
@Qualifier("springSecurityLoginServiceImpl")
SpringSecurityLoginService springSecurityLoginService;
}
Там нет записи в Spring-MVC-конфигурационный файл XML, кроме этих аннотаций, но когда я начинаю сервер облицовочного следующего исключения
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0'
defined in ServletContext resource [/WEB-INF/config/spring-mvc-config.xml]:
Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'springSecurityLoginController':
Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: com.core.servicelayer.user.SpringSecurityLoginService com.storefront.controllers.pages.SpringSecurityLoginController.springSecurityLoginService;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No matching bean of type [com.core.servicelayer.user.SpringSecurityLoginService] found for dependency:
expected at least 1 bean which qualifies as autowire candidate for this dependency.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true),
@org.springframework.beans.factory.annotation.Qualifier(value=springSecurityLoginServiceImpl)}
я не уверен, что я делаю неправильно или что дополнительным я должен сделать
Можете ли вы показать тег компонента-сканирования, который вы используете в spring-mvc-config.xml? – gkamal