This page describes the editor support for Spring beans configuration files. For hyperlinking support in the editor, see SpringSupportNavigation.
Every bean in a Spring beans configuration file references a Java class and its members. For example, the class attribute of the <bean> element holds the fully qualified name of the class which implements the bean. Code completion assists the users of Spring by providing all possible values for such classes and their entities, which greatly improves the productivity of the end user.
A detailed list of code completion scenarios is also available.
For the UI workflow regarding bean class' FQN completion, please refer SpringXMLClassPathCompletionUI
Another example is the smart code completion, which can:
Since a beans configuration file contains numerous references to the java sources in the project, there are possibilities of errors introduced due to references to non existing or altered entities. For example, a bean may refer a class which is not on the projects classpath. It is important to catch these errors before manual testing of the project. As the user edits the file, it is validated and error conditions, if any, are shown to the user with the help of editor annotations, and wherever possible, the user is given a suggestion to correct those errors. For example:
<bean id=”foo” class=”com.example.FooBar”/>
If the FooBar class does not exist on the project classpath, the user will be given a suggestion to create the class.
| Cause | Possible corrections |
| bean class is defined in the config file, but its not on project classpath | Provide the option of creating a new bean class |
| bean tag defines a property which is not present in the bean class | Provide the option to create a new property and getter and setter |
| bean tag defines a bean class with no constructor arguments | Provide the option of creating constructor arguments |
| bean tag property refers a property which is non existent in the current or any of the imported config files | Provide the option to create a new bean tag |
| bean tag defines a replace-method which is non existent in the bean class | Provide the option to create a new method |
| bean tag defines a replacer attribute in the replace-method tag, but its non existent in the current or any of the imported config file | Provide the option to create a new bean which is being referenced |
| bean tag references a bean in lookup-method tag but which is non existent in current or any of the imported config file | Provide the option to create a new bean tag |
| code_completion.PNG | ![]() |
30697 bytes |