Skip to content

Commit c598f05

Browse files
committed
Deprecate CommandLinePropertySource and associated implementations
Closes gh-31207
1 parent e7cf54d commit c598f05

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

spring-context/src/test/kotlin/org/springframework/context/support/BeanDefinitionDslTests.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ import org.junit.jupiter.api.Test
2323
import org.springframework.beans.factory.NoSuchBeanDefinitionException
2424
import org.springframework.beans.factory.getBean
2525
import org.springframework.context.support.BeanDefinitionDsl.*
26-
import org.springframework.core.env.SimpleCommandLinePropertySource
2726
import org.springframework.core.env.get
2827
import org.springframework.core.testfixture.env.MockPropertySource
2928
import java.util.stream.Collectors
@@ -77,6 +76,7 @@ class BeanDefinitionDslTests {
7776
}
7877

7978
@Test
79+
@Suppress("DEPRECATION")
8080
fun `Declare beans using environment condition with the functional Kotlin DSL`() {
8181
val beans = beans {
8282
bean<Foo>()
@@ -90,7 +90,7 @@ class BeanDefinitionDslTests {
9090
}
9191

9292
val context = GenericApplicationContext().apply {
93-
environment.propertySources.addFirst(SimpleCommandLinePropertySource("--name=foofoo"))
93+
environment.propertySources.addFirst(org.springframework.core.env.SimpleCommandLinePropertySource("--name=foofoo"))
9494
beans.initialize(this)
9595
refresh()
9696
}

spring-core/src/main/java/org/springframework/core/env/CommandLinePropertySource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@
204204
* @see PropertySource
205205
* @see SimpleCommandLinePropertySource
206206
* @see JOptCommandLinePropertySource
207+
* @deprecated since 6.1 with no plans for a replacement
207208
*/
209+
@Deprecated(since = "6.1")
208210
public abstract class CommandLinePropertySource<T> extends EnumerablePropertySource<T> {
209211

210212
/** The default name given to {@link CommandLinePropertySource} instances: {@value}. */

spring-core/src/main/java/org/springframework/core/env/JOptCommandLinePropertySource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@
6161
* @see CommandLinePropertySource
6262
* @see joptsimple.OptionParser
6363
* @see joptsimple.OptionSet
64+
* @deprecated since 6.1 with no plans for a replacement
6465
*/
66+
@Deprecated(since = "6.1")
6567
public class JOptCommandLinePropertySource extends CommandLinePropertySource<OptionSet> {
6668

6769
/**

spring-core/src/main/java/org/springframework/core/env/SimpleCommandLinePropertySource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -83,7 +83,9 @@
8383
* @since 3.1
8484
* @see CommandLinePropertySource
8585
* @see JOptCommandLinePropertySource
86+
* @deprecated since 6.1 with no plans for a replacement
8687
*/
88+
@Deprecated(since = "6.1")
8789
public class SimpleCommandLinePropertySource extends CommandLinePropertySource<CommandLineArgs> {
8890

8991
/**

spring-core/src/test/java/org/springframework/core/env/JOptCommandLinePropertySourceTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131
* @author Sam Brannen
3232
* @since 3.1
3333
*/
34+
@SuppressWarnings("deprecation")
3435
class JOptCommandLinePropertySourceTests {
3536

3637
@Test

spring-core/src/test/java/org/springframework/core/env/SimpleCommandLinePropertySourceTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* @author Sam Brannen
3030
* @since 3.1
3131
*/
32+
@SuppressWarnings("deprecation")
3233
class SimpleCommandLinePropertySourceTests {
3334

3435
@Test

0 commit comments

Comments
 (0)