Appendix F. Spring XML Configuration Tips

Note that auto-completion in Eclipse and STS is CTRL+Space, even on a Mac.

F.1. Empty Bean Definitions

Only the bean element is defined, no nested elements. If you do this first, then when you come to add contructor-arg or property sub-elements, auto-completion can be used to select the ref attribute value (see below).

Examples of empty bean definitions

Figure F.1. Examples of empty bean definitions



F.2. Bean Class Auto-Completion

The STS XML Editor is smart enough to know that the class attribute represents a fully-qualified Java classname. Type in the first 4 letters of the classname then use CTRL+Space to show all matching classes. Pick one and the FQCN becomes the class attribute value.

The example below shows using auto-completion by typing just the first letter of each component word in the classname. Thus typing "RNI" brings up RewardNetworkImpl and RewardNetworkImplTests.

Bean classname auto-completion

Figure F.2. Bean classname auto-completion



F.3. Ref Attribute Auto-Completion

Similarly using CTRL+Space in a ref attribute presents a list of all known bean ids. Works for both contructor-arg or property elements.

Constructor argument reference auto-completion

Figure F.3. Constructor argument reference auto-completion



F.4. Bean Properties Auto-Completion

This time CTRL+Space can be used to show available property names when defining a property element. Each name corresponds to a setter on the bean class.

Bean property name completion

Figure F.4. Bean property name completion