Spring Boot Framework에서는 @Spring Application Configuration, @Web Integration이 권장되지 않는 적절한 주석은 무엇입니까?
이후 적절한 주석은 무엇입니까?@SpringApplicationConfiguration그리고.@WebIntegrationSpring Boot Framework 1.4에서는 권장되지 않습니다.난 유닛 테스트에 열중하고 있어.
권장되지 않는 클래스의 JavaDocs를 살펴봅니다.
* @deprecated as of 1.4 in favor of
* {@link org.springframework.boot.test.context.SpringBootTest} with
* {@code webEnvironment=RANDOM_PORT} or {@code webEnvironment=DEFINED_PORT}.
*/
...
@Deprecated
public @interface WebIntegrationTest {
* @deprecated as of 1.4 in favor of {@link SpringBootTest} or direct use of
* {@link SpringBootContextLoader}.
*/
...
@Deprecated
public @interface SpringApplicationConfiguration {
TestRestTemplate()를 대체할 수 있는 것도 있나요?
네, 여기 있습니다.
* @deprecated as of 1.4 in favor of
* {@link org.springframework.boot.test.web.client.TestRestTemplate}
*/
@Deprecated
public class TestRestTemplate extends RestTemplate {
지금 바로 시작하는 것이 좋습니다.Spring Boot 1.4의 개선 테스트.
기본적인 샘플은 다음과 같습니다.
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)
public class MyTest {
}
다음 중 하나를 대체하기 위한 것입니다.
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(MyApp.class)
@WebIntegrationTest
public class MyTest {
}
@Enable을 사용할 수 있습니다.AutoConfiguration 또는 @SpringBootApplication.
테스트 목적으로 @SpringBootTest(webEnvironment='your value') 또는 간단히 @SpringBoot를 사용할 수 있습니다.시험
를 참조해 주세요.
http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html
REST를 테스트하려면 @RestClientTest를 사용하여 RestTemplateBuilder를 구성할 수 있습니다.
다음 주석을 사용해야 합니다.
@ContextConfiguration(classes = main_class)
저는 지금까지 문제없이 아래를 사용하고 있습니다.
@ContextConfiguration(classes = Application.class)
반면 어플리케이션은 나의 메인 수업의 이름입니다.
언급URL : https://stackoverflow.com/questions/39417530/what-is-the-proper-annotation-since-springapplicationconfiguration-webintegra
'programing' 카테고리의 다른 글
| Spring Data Rest - 여러 속성 (0) | 2023.03.21 |
|---|---|
| 이미지: 이 파일 형식을 처리하려면 적절한 로더가 필요할 수 있습니다. (0) | 2023.03.21 |
| SQL Developer에 새 연결을 추가할 때 Oracle TNS 이름이 표시되지 않음 (0) | 2023.03.16 |
| WooCommerce 3에서 제품 판매 가격을 프로그래밍 방식으로 설정 (0) | 2023.03.16 |
| Spring Boot에서 SQL 문을 기록하려면 어떻게 해야 합니까? (0) | 2023.03.16 |