Results 1 to 3 of 3

Thread: Spring Service annotation

  1. #1
    Join Date
    Feb 2009
    Posts
    136

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Your understanding is wrong... It takes the class name BUT with a lowercase first letter... so 'userService' instead of 'UserService'.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Feb 2009
    Posts
    136

    Default

    Quote 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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •