Title: How to give correct reference to Spring service who has acronym class name?
Tags: java;spring
Question: I have a service named "XMLService" and I want to give a reference to this service. What is the correct ref name for acronym? Is "xmlService" is correct?
My Bean;
<bean id="xmlExecutorJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"&gt;
<property name="targetObject" ref="xmlService" /&gt;
<property name="targetMethod" value="saveXMLData" /&gt;
</bean&gt;
My Service;
@Service
public class XMLService{
public void saveXMLData(){
....
}
EDIT: When I run above code it gives;
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xmlService' is defined
When I update ref value to "xMLService" still gives error;
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xMLService' is defined
Comment: `ref="xmlService"` means: "Take `` with id `xmlService` "

Here is the accepted answer: If you use component scan / beans autodetection, you can explicitly define the bean name using the value attribute of the @Service annotation:
@Service("xmlService")
public class XMLService{
Otherwise, the bean name is what you have defined in the beans XML.
Comment for this answer: Yes I use autodetection but It gives "No bean named 'xmlService' is defined" exception.
Comment for this answer: Yes it is working with custom name but still I don't know what is default name for this service
Comment for this answer: Can you please try defining the bean name in the annotation? I.e. `@Service("xmlService")`

Here is another answer: The correct acronym is the one you name it.
<bean id="xmlService" class="your.package.XMLService"&gt;
<property name="anyDependency" ref="dependencyId" /&gt;
</bean&gt;
Is this what you are asking?
Comment for this answer: I am getting "No bean named 'xmlService' is defined" exception.
Comment for this answer: I use  for autodetection. Is there any other way without defining a custom bean?
Comment for this answer: you should put the code I gave you (with the right properties, if any) before the xmlExecutorJob bean

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:12/09/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<java><spring>', 'Title': 'How to give correct reference to Spring service who has acronym class name?', 'ViewCount': 119, 'id': 41055423, 'user_AboutMe': '<p>********************----------------------------***************************</p>\n', 'user_AccountId': 1467204.0, 'user_DisplayName': 'hellzone', 'user_Reputation': 5176.0, 'user_Views': 731.0, 'user_id': 1379734.0}}