Skip to content

Commit a857284

Browse files
izeyefmbenhassine
authored andcommitted
Polish
1 parent 9883fac commit a857284

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

README.adoc

+9-10
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ This service pulls in all the dependencies you need for an application and does
2828
. Choose either Gradle or Maven and the language you want to use. This guide assumes that you chose Java.
2929
. Click *Dependencies* and select *Spring Batch* and *HyperSQL Database*.
3030
. Click *Generate*.
31-
. Download the resulting ZIP file, which is an archive of a web application that is configured with your choices.
31+
. Download the resulting ZIP file, which is an archive of an application that is configured with your choices.
3232

3333
NOTE: If your IDE has the Spring Initializr integration, you can complete this process from your IDE.
3434

35-
NOTE: You can also fork the project from Github and open it in your IDE or other editor.
35+
NOTE: You can also fork the project from GitHub and open it in your IDE or other editor.
3636

3737
[[initial]]
3838
== Business Data
@@ -125,7 +125,7 @@ parses each line item with enough information to turn it into a `Person`.
125125
* `processor()` creates an instance of the `PersonItemProcessor` that you defined earlier,
126126
meant to convert the data to upper case.
127127
* `writer(DataSource)` creates an `ItemWriter`. This one is aimed at a JDBC destination and
128-
automatically gets a copy of the dataSource created by Spring Boot. It
128+
automatically gets a `DataSource` created by Spring Boot. It
129129
includes the SQL statement needed to insert a single `Person`, driven by Java record components.
130130

131131
The last chunk (from `src/main/java/com/example/batchprocessing/BatchConfiguration.java`)
@@ -188,14 +188,13 @@ include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/
188188
Note that `SpringApplication.exit()` and `System.exit()` ensure that the JVM exits upon job completion.
189189
See the https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-application-exit[Application Exit section in Spring Boot Reference documentation] for more details.
190190

191-
For demonstration purposes, there is code to create a `JdbcTemplate`, query the database,
191+
For demonstration purposes, there is code to inject a `JdbcTemplate`, query the database,
192192
and print out the names of people the batch job inserts.
193193

194194
[NOTE]
195195
====
196196
Note how the application does not use the `@EnableBatchProcessing` annotation.
197197
Previously, `@EnableBatchProcessing` could be used to enable Spring Boot's auto-configuration of Spring Batch.
198-
Starting from Spring Boot v3.0, this annotation is no longer required and should be removed from applications that want to use Spring Boot's auto-configuration.
199198
A bean that is annotated with `@EnableBatchProcessing` or that extends Spring Batch's `DefaultBatchConfiguration` can now be defined to tell the auto-configuration
200199
to back off, allowing the application to take complete control of how Spring Batch is configured.
201200
====
@@ -216,11 +215,11 @@ Converting (Person[firstName=Joe, lastName=Doe]) into (Person[firstName=JOE, las
216215
Converting (Person[firstName=Justin, lastName=Doe]) into (Person[firstName=JUSTIN, lastName=DOE])
217216
Converting (Person[firstName=Jane, lastName=Doe]) into (Person[firstName=JANE, lastName=DOE])
218217
Converting (Person[firstName=John, lastName=Doe]) into (Person[firstName=JOHN, lastName=DOE])
219-
Found <{Person[firstName=JILL, lastName=DOE]}> in the database.
220-
Found <{Person[firstName=JOE, lastName=DOE]}> in the database.
221-
Found <{Person[firstName=JUSTIN, lastName=DOE]}> in the database.
222-
Found <{Person[firstName=JANE, lastName=DOE]}> in the database.
223-
Found <{Person[firstName=JOHN, lastName=DOE]}> in the database.
218+
Found <Person[firstName=JILL, lastName=DOE]> in the database.
219+
Found <Person[firstName=JOE, lastName=DOE]> in the database.
220+
Found <Person[firstName=JUSTIN, lastName=DOE]> in the database.
221+
Found <Person[firstName=JANE, lastName=DOE]> in the database.
222+
Found <Person[firstName=JOHN, lastName=DOE]> in the database.
224223
----
225224
====
226225

complete/src/main/java/com/example/batchprocessing/BatchConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public JdbcBatchItemWriter<Person> writer(DataSource dataSource) {
4848

4949
// tag::jobstep[]
5050
@Bean
51-
public Job importUserJob(JobRepository jobRepository,Step step1, JobCompletionNotificationListener listener) {
51+
public Job importUserJob(JobRepository jobRepository, Step step1, JobCompletionNotificationListener listener) {
5252
return new JobBuilder("importUserJob", jobRepository)
5353
.listener(listener)
5454
.start(step1)
@@ -59,7 +59,7 @@ public Job importUserJob(JobRepository jobRepository,Step step1, JobCompletionNo
5959
public Step step1(JobRepository jobRepository, DataSourceTransactionManager transactionManager,
6060
FlatFileItemReader<Person> reader, PersonItemProcessor processor, JdbcBatchItemWriter<Person> writer) {
6161
return new StepBuilder("step1", jobRepository)
62-
.<Person, Person> chunk(3, transactionManager)
62+
.<Person, Person>chunk(3, transactionManager)
6363
.reader(reader)
6464
.processor(processor)
6565
.writer(writer)

complete/src/main/java/com/example/batchprocessing/JobCompletionNotificationListener.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ public JobCompletionNotificationListener(JdbcTemplate jdbcTemplate) {
2323

2424
@Override
2525
public void afterJob(JobExecution jobExecution) {
26-
if(jobExecution.getStatus() == BatchStatus.COMPLETED) {
26+
if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
2727
log.info("!!! JOB FINISHED! Time to verify the results");
2828

2929
jdbcTemplate
3030
.query("SELECT first_name, last_name FROM people", new DataClassRowMapper<>(Person.class))
31-
.forEach(person -> log.info("Found <{{}}> in the database.", person));
31+
.forEach(person -> log.info("Found <{}> in the database.", person));
3232
}
3333
}
3434
}

complete/src/main/java/com/example/batchprocessing/PersonItemProcessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public Person process(final Person person) {
1616

1717
final Person transformedPerson = new Person(firstName, lastName);
1818

19-
log.info("Converting (" + person + ") into (" + transformedPerson + ")");
19+
log.info("Converting ({}) into ({})", person, transformedPerson);
2020

2121
return transformedPerson;
2222
}

0 commit comments

Comments
 (0)