Prevent deprecation for DBCP2 username and password properties
Closes gh-40076
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 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.
|
||||
@@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.ItemMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.Metadata;
|
||||
import org.springframework.boot.configurationsample.deprecation.Dbcp2Configuration;
|
||||
import org.springframework.boot.configurationsample.record.RecordWithGetter;
|
||||
import org.springframework.boot.configurationsample.recursive.RecursiveProperties;
|
||||
import org.springframework.boot.configurationsample.simple.ClassWithNestedProperties;
|
||||
@@ -508,4 +509,11 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene
|
||||
assertThat(metadata).doesNotHave(Metadata.withProperty("record-with-getter.bravo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotMarkDbcp2UsernameOrPasswordAsDeprecated() {
|
||||
ConfigurationMetadata metadata = compile(Dbcp2Configuration.class);
|
||||
assertThat(metadata).has(Metadata.withProperty("spring.datasource.dbcp2.username").withNoDeprecation());
|
||||
assertThat(metadata).has(Metadata.withProperty("spring.datasource.dbcp2.password").withNoDeprecation());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2012-2024 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.configurationsample.deprecation;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import org.springframework.boot.configurationsample.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* Test configuration for DBCP2 {@link BasicDataSource}.
|
||||
*
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
public class Dbcp2Configuration {
|
||||
|
||||
@ConfigurationProperties(prefix = "spring.datasource.dbcp2")
|
||||
BasicDataSource basicDataSource() {
|
||||
return new BasicDataSource();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user