Friday, January 3, 2014

Spring Course: V8 Setting Bean Properties

Setting Bean Properties

if you have a class like the one below, the class has a property which is taxId, in order to inject the value taxId from beans.xml, you should define a set method (keep the camel convention)

Now you can inject this value like this in beans.xml

we use <property> tag for that.

The difference between bean ID and bean name
when you define a bean you can set an id and name, the id and name are the same in everything, however you cannot use special characters in id like # for example
in addition you can define aliases for a bean, this can be done only by using the name field but not the id field
<bean id="x" name="x,y,z"/>
with this you can use any name to get the bean (x or y or z).

No comments:

Post a Comment