Skip to content

Commit 0e3fad9

Browse files
committed
Autowire TestRestTemplate for consistency
1 parent d07b581 commit 0e3fad9

File tree

2 files changed

+6
-2
lines changed
  • doma-spring-boot-samples
    • doma-spring-boot-sample-entity-listener/src/test/java/org/seasar/doma/boot/sample
    • doma-spring-boot-sample-event-handler/src/test/java/org/seasar/doma/boot/sample

2 files changed

+6
-2
lines changed

doma-spring-boot-samples/doma-spring-boot-sample-entity-listener/src/test/java/org/seasar/doma/boot/sample/ApplicationTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.List;
77

88
import org.junit.jupiter.api.Test;
9+
import org.springframework.beans.factory.annotation.Autowired;
910
import org.springframework.boot.resttestclient.TestRestTemplate;
1011
import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate;
1112
import org.springframework.boot.test.context.SpringBootTest;
@@ -19,7 +20,8 @@
1920
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
2021
@AutoConfigureTestRestTemplate
2122
class ApplicationTest {
22-
private final TestRestTemplate restTemplate = new TestRestTemplate();
23+
@Autowired
24+
private TestRestTemplate restTemplate;
2325
private final ParameterizedTypeReference<List<Message>> typedReference = new ParameterizedTypeReference<List<Message>>() {
2426
};
2527
@LocalServerPort

doma-spring-boot-samples/doma-spring-boot-sample-event-handler/src/test/java/org/seasar/doma/boot/sample/ApplicationTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.List;
77

88
import org.junit.jupiter.api.Test;
9+
import org.springframework.beans.factory.annotation.Autowired;
910
import org.springframework.boot.resttestclient.TestRestTemplate;
1011
import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate;
1112
import org.springframework.boot.test.context.SpringBootTest;
@@ -19,7 +20,8 @@
1920
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
2021
@AutoConfigureTestRestTemplate
2122
class ApplicationTest {
22-
private final TestRestTemplate restTemplate = new TestRestTemplate();
23+
@Autowired
24+
private TestRestTemplate restTemplate;
2325
private final ParameterizedTypeReference<List<Message>> typedReference = new ParameterizedTypeReference<List<Message>>() {
2426
};
2527
@LocalServerPort

0 commit comments

Comments
 (0)