Skip to content

Commit 4ebc217

Browse files
committed
sync
1 parent 23c2f6d commit 4ebc217

File tree

1 file changed

+9
-20
lines changed
  • instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal

1 file changed

+9
-20
lines changed

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/DeprecatedConfigProperties.java

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,19 @@ public final class DeprecatedConfigProperties {
1919

2020
private static final Logger logger = Logger.getLogger(DeprecatedConfigProperties.class.getName());
2121

22-
public static Boolean getBoolean(
23-
ApplicationEnvironmentPreparedEvent applicationEnvironmentPreparedEvent,
22+
public static boolean getBoolean(
23+
InstrumentationConfig config,
2424
String deprecatedPropertyName,
25-
String newPropertyName) {
26-
warnIfUsed(applicationEnvironmentPreparedEvent, deprecatedPropertyName, newPropertyName);
27-
Boolean deprecatedValue =
28-
applicationEnvironmentPreparedEvent
29-
.getEnvironment()
30-
.getProperty(deprecatedPropertyName, Boolean.class);
31-
Boolean newValue =
32-
applicationEnvironmentPreparedEvent
33-
.getEnvironment()
34-
.getProperty(newPropertyName, Boolean.class);
35-
36-
// Return the new value if it exists, otherwise return the deprecated value
37-
return newValue != null ? newValue : deprecatedValue;
25+
String newPropertyName,
26+
boolean defaultValue) {
27+
warnIfUsed(config, deprecatedPropertyName, newPropertyName);
28+
boolean value = config.getBoolean(deprecatedPropertyName, defaultValue);
29+
return config.getBoolean(newPropertyName, value);
3830
}
3931

4032
private static void warnIfUsed(
41-
ApplicationEnvironmentPreparedEvent applicationEnvironmentPreparedEvent,
42-
String deprecatedPropertyName,
43-
String newPropertyName) {
44-
if (applicationEnvironmentPreparedEvent.getEnvironment().getProperty(deprecatedPropertyName)
45-
!= null) {
33+
InstrumentationConfig config, String deprecatedPropertyName, String newPropertyName) {
34+
if (config.getString(deprecatedPropertyName) != null) {
4635
logger.log(
4736
WARNING,
4837
"Deprecated property \"{0}\" was used; use the \"{1}\" property instead",

0 commit comments

Comments
 (0)