Skip to content

Commit dac8265

Browse files
prmrJay Bryant
authored andcommitted
Replace main with demo and explain control flow
1 parent d900e46 commit dac8265

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ include::complete/src/main/java/com/example/accessingdatajpa/AccessingDataJpaApp
141141
----
142142
====
143143

144+
`Application` includes a `demo()` method that puts the `CustomerRepository` through a few tests. First, it fetches the `CustomerRepository` from the Spring application context. Then it saves a handful of `Customer` objects, demonstrating the `save()` method and setting up some data to work with. Next, it calls `findAll()` to fetch all `Customer` objects from the database. Then it calls `findOne()` to fetch a single `Customer` by its ID. Finally, it calls `findByLastName()` to find all customers whose last name is "Bauer". The `demo()` method returns a `CommandLineRunner` bean that automatically runs the code when the application launches.
145+
144146
The `AccessingDataJpaApplication` class includes a `main()` method that puts the
145147
`CustomerRepository` through a few tests. First, it fetches the `CustomerRepository` from
146148
the Spring application context. Then it saves a handful of `Customer` objects,

0 commit comments

Comments
 (0)