why does annotate class as @Service do not create bean?

前端 未结 4 1939
予麋鹿
予麋鹿 2021-01-25 04:19

I has class like this:

@Service(\"userDetailsService\") 
public class MyUserDetailsService implements UserDetailsService {
    ...

and trying t

4条回答
  •  面向向阳花
    2021-01-25 05:05

    @Service extends @Component which allows for classpath scanning.

    You can enable both classpath scanning and annotations

    
    
    

    I don't know what version are you using. Try this.

    
        
            
        
    
    

    Unless you provide, as you do, a name, it will be the class name. But you provide the same name it would be but stating another in the config file.

    If you @Service with no name then it would be fine.

提交回复
热议问题