本文介绍了什么是正确的注释,因为在Spring Boot Framework中不推荐使用@SpringApplicationConfiguration,@ WebIntegration?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从Spring Boot Framework 1.4开始,不推荐使用 @SpringApplicationConfiguration
和 @WebIntegration
,这是不正确的注释?我正在尝试使用单元测试。
What is the proper annotation since @SpringApplicationConfiguration
and @WebIntegration
are deprecated as of Spring Boot Framework 1.4? I'm trying to play around with unit testing.
推荐答案
查看已弃用类的JavaDocs:
Take a look into JavaDocs of deprecated classes:
* @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 {
是的,这里它是:
* @deprecated as of 1.4 in favor of
* {@link org.springframework.boot.test.web.client.TestRestTemplate}
*/
@Deprecated
public class TestRestTemplate extends RestTemplate {
这篇关于什么是正确的注释,因为在Spring Boot Framework中不推荐使用@SpringApplicationConfiguration,@ WebIntegration?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!