Module org.mule.sdk.api
Annotation Interface ConfigOverride
@Target({PARAMETER,FIELD})
@Retention(RUNTIME)
@Documented
@MinMuleVersion("4.5.0")
public @interface ConfigOverride
Binds the annotated member with the
When annotated with
For example, if we declare the operation:
ParameterModel of the same name and
type that exists in the config associated to the
container of the annotated member. When annotated with
ConfigOverride, the parameter will be injected with the same value of the
bound parameter of the config that's been associated to the execution. For example, if we declare the operation:
public void request(@Config ConfigType config, @ConfigOverride int maxRetries)
Where the configuration ConfigType declares a parameter as:
@Parameter
@Optional(defaultValue = "10")
@int maxRetries;
Then we can have three different cases:
1) We use the default value of the maxRetries parameter provided by the config. In this case, the operation
request will be injected with 10 as the value for maxRetries
<mule>
<ns:config name="sampleConfig">
<flow>
<ns:request config-ref="sampleConfig">
</flow>
</mule>
2) We provide a value for the maxRetries parameter in the config. In this case, the operation request will be
injected with 2 as the value for maxRetries
<mule>
<ns:config name="sampleConfig" maxRetries=2>
<flow>
<ns:request config-ref="sampleConfig">
</flow>
</mule>
3) We provide a value for the maxRetries parameter in the operation. In this case, the operation request will
be injected with 5 as the value for maxRetries
<mule>
<ns:config name="sampleConfig" maxRetries=2>
<flow>
<ns:request config-ref="sampleConfig" maxRetries=5>
</flow>
</mule>
This annotation can either be applied to an argument of an operation method or to a field of a class which extends the
Source class. It is not to be used on configurations nor connections.
- Since:
- 1.0