Announcement Announcement Module
Collapse
No announcement yet.
Spring Service annotation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Service annotation

    Hi,

    I have a spring service

    like
    Code:
    @Service("UserService")
    public class UserService implements IUserService, UserDetailsService
    if i remove the ("UserService") I get the below error
    Code:
    Cannot resolve reference to bean 'UserService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'UserService' is defined
    My understanding is that if the service bean name is not provided, it will take the class name as bean name.
    But as per this error, it is not working like that.

    Is the bean name mandatory ? or am i missing some thing.

  • #2
    Your understanding is wrong... It takes the class name BUT with a lowercase first letter... so 'userService' instead of 'UserService'.

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      Your understanding is wrong... It takes the class name BUT with a lowercase first letter... so 'userService' instead of 'UserService'.
      Hi thanks, So silly of me to ask such a question.(I am new to annotations...) Thanks once again.

      Comment

      Working...
      X