|
2 | 2 |
|
3 | 3 | import com.baeldung.domain.Country;
|
4 | 4 | import com.baeldung.domain.CountryRepository;
|
| 5 | + |
5 | 6 | import org.springframework.boot.CommandLineRunner;
|
6 | 7 | import org.springframework.stereotype.Component;
|
7 | 8 |
|
8 | 9 | @Component
|
9 | 10 | class StaticDataLoader implements CommandLineRunner {
|
10 |
| - private final CountryRepository countries; |
11 | 11 |
|
12 |
| - public StaticDataLoader(CountryRepository countries) { |
13 |
| - this.countries = countries; |
14 |
| - } |
| 12 | + private final CountryRepository countries; |
| 13 | + |
| 14 | + public StaticDataLoader(CountryRepository countries) { |
| 15 | + this.countries = countries; |
| 16 | + } |
15 | 17 |
|
16 |
| - @Override |
17 |
| - public void run(String... args) { |
18 |
| - countries.save(new Country(1L, "US", "United States", ":us:")); |
19 |
| - countries.save(new Country(2L, "CA", "Canada", ":canada:")); |
20 |
| - countries.save(new Country(3L, "GB", "United Kingdom", ":uk:")); |
21 |
| - countries.save(new Country(4L, "AU", "Romania", ":romania:")); |
22 |
| - } |
| 18 | + @Override |
| 19 | + public void run(String... args) { |
| 20 | + countries.save(new Country(1L, "US", "United States", ":us:")); |
| 21 | + countries.save(new Country(2L, "CA", "Canada", ":canada:")); |
| 22 | + countries.save(new Country(3L, "GB", "United Kingdom", ":uk:")); |
| 23 | + countries.save(new Country(4L, "AU", "Romania", ":romania:")); |
| 24 | + } |
23 | 25 | }
|
0 commit comments