From 23cd261b6b1440d2c45479ccb4f13518636e3eb9 Mon Sep 17 00:00:00 2001 From: Sebastien Deleuze Date: Tue, 6 Aug 2019 11:28:32 +0200 Subject: [PATCH] Deprecate AnnotationConfigApplicationContext { } Kotlin extension Closes gh-23420 --- .../AnnotationConfigApplicationContextExtensions.kt | 3 ++- .../AnnotationConfigApplicationContextExtensionsTests.kt | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spring-context/src/main/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensions.kt b/spring-context/src/main/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensions.kt index bfa7ba8bc2..ee0e9ea42b 100644 --- a/spring-context/src/main/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensions.kt +++ b/spring-context/src/main/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,5 +23,6 @@ package org.springframework.context.annotation * @author Sebastien Deleuze * @since 5.0 */ +@Deprecated("Use regular apply method instead.", replaceWith = ReplaceWith("AnnotationConfigApplicationContext().apply(configure)")) fun AnnotationConfigApplicationContext(configure: AnnotationConfigApplicationContext.() -> Unit) = AnnotationConfigApplicationContext().apply(configure) diff --git a/spring-context/src/test/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensionsTests.kt b/spring-context/src/test/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensionsTests.kt index 167dad177c..77a8f38f0f 100644 --- a/spring-context/src/test/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensionsTests.kt +++ b/spring-context/src/test/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensionsTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,8 +27,9 @@ import org.springframework.context.support.registerBean * @author Sebastien Deleuze */ class AnnotationConfigApplicationContextExtensionsTests { - + @Test + @Suppress("DEPRECATION") fun `Instantiate AnnotationConfigApplicationContext`() { val applicationContext = AnnotationConfigApplicationContext { registerBean()