Skip to content

Commit 5975aff

Browse files
committed
modified code to match blog post
1 parent 44fb22f commit 5975aff

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

spring-boot/static/src/main/java/io/reflectoring/staticdata/QuotesProperties.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import org.springframework.boot.context.properties.ConfigurationProperties;
44
import org.springframework.stereotype.Component;
55

6-
import java.util.ArrayList;
76
import java.util.List;
87

98
@Component
@@ -16,7 +15,7 @@ public QuotesProperties(List<Quote> quotes) {
1615
this.quotes = quotes;
1716
}
1817

19-
public List<Quote> getQuotes(){
18+
public List<Quote> getQuotes() {
2019
return this.quotes;
2120
}
2221

spring-boot/static/src/test/java/io/reflectoring/staticdata/QuotesPropertiesTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
import org.junit.jupiter.api.Test;
44
import org.springframework.beans.factory.annotation.Autowired;
55
import org.springframework.boot.test.context.SpringBootTest;
6-
import org.springframework.test.context.TestPropertySource;
76

87
import static org.assertj.core.api.Assertions.assertThat;
98

10-
@SpringBootTest
11-
// @TestPropertySource cannot load YML files directly (using the "locations" attribute)
12-
// so we simply tell Spring Boot to load the properties via spring.config.location.
13-
@TestPropertySource(properties = { "spring.config.location = file:./quotes.yml" })
9+
@SpringBootTest(properties = {"spring.config.location = ./,file:./quotes.yml"})
1410
class QuotesPropertiesTest {
1511

1612
@Autowired

0 commit comments

Comments
 (0)