Skip to content

Commit

Permalink
Deprecate CommandLinePropertySource and associated implementations
Browse files Browse the repository at this point in the history
Closes gh-31207
  • Loading branch information
sbrannen committed Sep 13, 2023
1 parent e7cf54d commit c598f05
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2023 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.
Expand All @@ -23,7 +23,6 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.NoSuchBeanDefinitionException
import org.springframework.beans.factory.getBean
import org.springframework.context.support.BeanDefinitionDsl.*
import org.springframework.core.env.SimpleCommandLinePropertySource
import org.springframework.core.env.get
import org.springframework.core.testfixture.env.MockPropertySource
import java.util.stream.Collectors
Expand Down Expand Up @@ -77,6 +76,7 @@ class BeanDefinitionDslTests {
}

@Test
@Suppress("DEPRECATION")
fun `Declare beans using environment condition with the functional Kotlin DSL`() {
val beans = beans {
bean<Foo>()
Expand All @@ -90,7 +90,7 @@ class BeanDefinitionDslTests {
}

val context = GenericApplicationContext().apply {
environment.propertySources.addFirst(SimpleCommandLinePropertySource("--name=foofoo"))
environment.propertySources.addFirst(org.springframework.core.env.SimpleCommandLinePropertySource("--name=foofoo"))
beans.initialize(this)
refresh()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@
* @see PropertySource
* @see SimpleCommandLinePropertySource
* @see JOptCommandLinePropertySource
* @deprecated since 6.1 with no plans for a replacement
*/
@Deprecated(since = "6.1")
public abstract class CommandLinePropertySource<T> extends EnumerablePropertySource<T> {

/** The default name given to {@link CommandLinePropertySource} instances: {@value}. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
* @see CommandLinePropertySource
* @see joptsimple.OptionParser
* @see joptsimple.OptionSet
* @deprecated since 6.1 with no plans for a replacement
*/
@Deprecated(since = "6.1")
public class JOptCommandLinePropertySource extends CommandLinePropertySource<OptionSet> {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 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.
Expand Down Expand Up @@ -83,7 +83,9 @@
* @since 3.1
* @see CommandLinePropertySource
* @see JOptCommandLinePropertySource
* @deprecated since 6.1 with no plans for a replacement
*/
@Deprecated(since = "6.1")
public class SimpleCommandLinePropertySource extends CommandLinePropertySource<CommandLineArgs> {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 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.
Expand Down Expand Up @@ -31,6 +31,7 @@
* @author Sam Brannen
* @since 3.1
*/
@SuppressWarnings("deprecation")
class JOptCommandLinePropertySourceTests {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @author Sam Brannen
* @since 3.1
*/
@SuppressWarnings("deprecation")
class SimpleCommandLinePropertySourceTests {

@Test
Expand Down

0 comments on commit c598f05

Please sign in to comment.