Browse Source

Deprecate AnnotationConfigApplicationContext { } Kotlin extension

Closes gh-23420
pull/23435/head
Sebastien Deleuze 5 years ago
parent
commit
23cd261b6b
  1. 3
      spring-context/src/main/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensions.kt
  2. 5
      spring-context/src/test/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensionsTests.kt

3
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * @author Sebastien Deleuze
* @since 5.0 * @since 5.0
*/ */
@Deprecated("Use regular apply method instead.", replaceWith = ReplaceWith("AnnotationConfigApplicationContext().apply(configure)"))
fun AnnotationConfigApplicationContext(configure: AnnotationConfigApplicationContext.() -> Unit) = fun AnnotationConfigApplicationContext(configure: AnnotationConfigApplicationContext.() -> Unit) =
AnnotationConfigApplicationContext().apply(configure) AnnotationConfigApplicationContext().apply(configure)

5
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * @author Sebastien Deleuze
*/ */
class AnnotationConfigApplicationContextExtensionsTests { class AnnotationConfigApplicationContextExtensionsTests {
@Test @Test
@Suppress("DEPRECATION")
fun `Instantiate AnnotationConfigApplicationContext`() { fun `Instantiate AnnotationConfigApplicationContext`() {
val applicationContext = AnnotationConfigApplicationContext { val applicationContext = AnnotationConfigApplicationContext {
registerBean<Foo>() registerBean<Foo>()

Loading…
Cancel
Save