Serge
Serge

Reputation: 626

Spring Batch property configuration

I have a reader class with the a sql property.

String sql;

The class containts a setter method for this string.

public void setSql (String sql) {...bunch of code...}

My configuration file looks like this.

<bean id="carryOverReader" class=...>
    <property name="sql" value="OVERRIDDEN" />
</bean>

My question is how does Spring set sql to the value "OVERRIDEN". Does it implicitly call the setter method? Or does it accomplish this another way? I'm asking this because the setter for sql contains more code, and I'm wondering if that is going to be executed by the property wiring?

Upvotes: 0

Views: 118

Answers (1)

Guillaume Darmont
Guillaume Darmont

Reputation: 5018

When using XML configuration, Spring search for matching setters. In your case, the setSql(String) method will be called, executing the whole code inside.

Upvotes: 1

Related Questions