However, XML has restrictions on the characters that can appear in the XML id attribute, but
usually you won't use those special characters in a bean name. Moreover, Spring allows you to specify
multiple names, separated by commas, for a bean in the name attribute. But you can't do so in the id
attribute because commas are not allowed there.
In fact, neither the bean name nor the bean ID is required for a bean. A bean that has no name
defined is called an anonymous bean . You will usually create beans like this that serve only to interact
with the Spring container itself; that you are sure you will only inject by type later on; or that you will
nest, inline, in the declaration of an outer bean.
Defining Bean Properties by Shortcut
Spring supports a shortcut for specifying the value of a simple type property. You can present a value
attribute in the <property> element instead of enclosing a <value> element inside.
<property name="prefix" value="30" />
<property name="suffix" value="A" />
<property name="initial" value="100000" />
This shortcut also works for constructor arguments.
<constructor-arg value="30" />
<constructor-arg value="A" />
<constructor-arg value="100000" />
Spring 2.0 provides another convenient shortcut for you to define properties. It's by using the p
schema to define bean properties as attributes of the <bean> element. This can shorten the lines of XML
<beans xmlns=" http://www.springframework.org/schema/beans"