spring-projects / spring-batch

Spring Batch is a framework for writing batch applications using Java and Spring
http://projects.spring.io/spring-batch/
Apache License 2.0
2.63k stars 2.31k forks source link

Reduce formatter initializations in `DefaultFieldSet` #4548

Closed hpoettker closed 1 month ago

hpoettker commented 4 months ago

Resolves #1694.

The PR addresses the problem that the default value for the field numberFormat of DefaultFieldSet is currently initialized twice: Once by the assignment in the declaration and once in the constructor. As the construction of the default number format is expensive, this should be avoided.

It also addresses the problem that the expensive construction of the default numberFormat and dateFormat currently cannot be avoided in the case where the default values are overwritten after calling the constructor.

fmbenhassine commented 1 month ago

LGTM. Rebased and merged as 75abf1587ff1bf1043aa1b743ac2ad26609219fc. Thank you for your contribution!