If I'm not mistaken, the default bean name of a bean declared with @Component is the name of its class its first letter in lower-case. This means that
@Component
public class SuggestionService {
declares a bean of type SuggestionService
, and of name suggestionService
. It's equivalent to
@Component("suggestionService")
public class SuggestionService {
or to
<bean id="suggestionService" .../>
You're redefining another bean of the same type, but with a different name, in the XML:
<bean id="SuggestionService" class="com.hp.it.km.search.web.suggestion.SuggestionService">
...
</bean>
So, either specify the name of the bean in the annotation to be SuggestionService
, or use the ID suggestionService
in the XML (don't forget to also modify the <ref>
element, or to remove it, since it isn't needed). In this case, the XML definition will override the annotation definition.