Reputation: 453
I have following bean class. I want to define this bean into the xml file.
I want to know which objects of this bean are added as a property of the bean in the xml?
public class Mybean{
public String name;
public String address;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name=name;
}
public String getAddress()
{
return address;
}
}
Upvotes: 0
Views: 329
Reputation: 1019
Let your class implement InitializingBean, then in the afterPropertiesSet() method, you can check which property has been set by spring
Upvotes: 0
Reputation: 94429
Since you have getters and setters for the name and address fields they can both serve as properties.
<bean id="mybean" class="package.to.MyBean">
<property name="name" value="something"/>
<property name="address" value="something"/>
</bean>
Reference: http://www.springbyexample.org/examples/intro-to-ioc-basic-setter-injection.html
Upvotes: 2