自从 @SpringApplicationConfiguration、@WebIntegration 在 Spring Boot Framework 中弃用以来,正确的注释是什么?

新手上路,请多包涵

什么是正确的注释,因为 @SpringApplicationConfiguration@WebIntegration 从 Spring Boot Framework 1.4 开始被弃用?我正在尝试进行单元测试。

原文由 Person 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 323
1 个回答

查看已弃用类的 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 {

原文由 Artem Bilan 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题