Creating an inner bean
When there are beans that can only be called once by some certain top-level beans, it will be easier to manage the ApplicationContext
definition if we allow these objects to be inner beans. This recipe will show you how to create inner beans to some objects that exclusively use them.
Getting started
Both the ch02-xml
and ch02-xml
projects can be utilized separately on this recipe since each container creates inner beans differently.
How to do it...
Perform the following to create inner beans:
- In the
ch02-xml
, inject anEmployee
object, applying method injection for the actual values:
<bean id="empRec4" class="org.packt.starter.ioc.model.Employee"> <property name="firstName" value="Gabriela"/> <property name="lastName" value="Silang"/> <property name="age" value="67"/> <property name="birthdate" value="June 19, 1950"/> <property name="position" value="writer"/> <property name="salary" value="897000"/> </bean...