Spring Unsatisfied dependency expressed through constructor argument with index 0 of type

后端 未结 4 1974
既然无缘
既然无缘 2021-02-07 22:24

The full message is

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
    Error creating bean with name \'userRepositoryUserDetailsSe         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-07 23:17

    [org.cru.cloud.management.data.UserRepository]: : No qualifying bean of type

    Can not find UserRepository bean. Maybe you forgot to put annotation to UserRepository.

    @Component
    public MyClass implements UserRepository{}
    

    if you autowire userRepository then you MyClass will be injected.

    Also :

    public MyClass implements UserRepository{}
    public YourClass implements UserRepository{}
    
    @Autowired
    public blabla(@Qualifier("myClass") UserRepository userRepo)
    
    @Autowired
    public blabla(@Qualifier("yourClass") UserRepository userRepo)
    

    I guess this will help.

提交回复
热议问题