Take the 2-minute tour ×

I've managed to configure to spring to auto-detect my components using the @Autowire annotation. However the problem is that not all the components are being Auto wired.
Specifically My DAO's are being bound but my service objects aren't. I have to explicitly create a bean for my service object in the spring xml config file.

Any clue as to why this is happening?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

If spring is not complaining about anything but it's still not being wired, there are a few probable causes, from most to least likely:

  • The service implementation is missing the proper annotation; i.e @Component, @Controller, @Service or one of the other annotations.
  • If the implementation is not annotated it has to be present as an xml bean definition.
  • The classpath-scan you have set up in the xml file does not hit the service.
  • Your jar file with services is packed without directory structure.
share|improve this answer
add comment

Your Answer


