Skip to content

Commit f30cc9c

Browse files
committed
Update to PropertySourcesPlaceholderConfigurer
This commit replaces deprecated usage of PropertyPlaceholderConfigurer in favor of PropertySourcesPlaceholderConfigurer
1 parent c64b086 commit f30cc9c

19 files changed

+23
-23
lines changed

config/src/integration-test/java/org/springframework/security/config/ldap/LdapProviderBeanDefinitionParserTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void ldapAuthenticationProviderWorksWithPlaceholders() {
169169
this.appCtx = new InMemoryXmlApplicationContext("<ldap-server />" + "<authentication-manager>"
170170
+ " <ldap-authentication-provider user-dn-pattern='uid={0},ou=${udp}' group-search-filter='${gsf}={0}' />"
171171
+ "</authentication-manager>"
172-
+ "<b:bean id='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer' class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer' />");
172+
+ "<b:bean id='org.springframework.context.support.PropertySourcesPlaceholderConfigurer' class='org.springframework.context.support.PropertySourcesPlaceholderConfigurer' />");
173173

174174
ProviderManager providerManager = this.appCtx.getBean(BeanIds.AUTHENTICATION_MANAGER, ProviderManager.class);
175175
assertThat(providerManager.getProviders()).hasSize(1);

config/src/test/java/org/springframework/security/config/authentication/UserServiceBeanDefinitionParserTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void namePasswordAndAuthoritiesSupportPlaceholders() {
6868
System.setProperty("principal.pass", "joespassword");
6969
System.setProperty("principal.authorities", "ROLE_A,ROLE_B");
7070
// @formatter:off
71-
setContext("<b:bean class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer'/>"
71+
setContext("<b:bean class='org.springframework.context.support.PropertySourcesPlaceholderConfigurer'/>"
7272
+ "<user-service id='service'>"
7373
+ " <user name='${principal.name}' password='${principal.pass}' authorities='${principal.authorities}'/>"
7474
+ "</user-service>");

config/src/test/java/org/springframework/security/config/http/FilterSecurityMetadataSourceBeanDefinitionParserTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void expressionsAreSupported() {
9292
public void interceptUrlsSupportPropertyPlaceholders() {
9393
System.setProperty("secure.url", "/secure");
9494
System.setProperty("secure.role", "ROLE_A");
95-
setContext("<b:bean class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer'/>"
95+
setContext("<b:bean class='org.springframework.context.support.PropertySourcesPlaceholderConfigurer'/>"
9696
+ "<filter-security-metadata-source id='fids' use-expressions='false'>"
9797
+ " <intercept-url pattern='${secure.url}' access='${secure.role}'/>"
9898
+ "</filter-security-metadata-source>");

config/src/test/java/org/springframework/security/config/http/customconfigurer/CustomHttpSecurityConfigurerTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
import org.junit.jupiter.api.Test;
2525

2626
import org.springframework.beans.factory.annotation.Autowired;
27-
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
2827
import org.springframework.context.ConfigurableApplicationContext;
2928
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
3029
import org.springframework.context.annotation.Bean;
3130
import org.springframework.context.annotation.Configuration;
31+
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
3232
import org.springframework.mock.web.MockFilterChain;
3333
import org.springframework.mock.web.MockHttpServletRequest;
3434
import org.springframework.mock.web.MockHttpServletResponse;
@@ -125,11 +125,11 @@ SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
125125
}
126126

127127
@Bean
128-
static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
128+
static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
129129
// Typically externalize this as a properties file
130130
Properties properties = new Properties();
131131
properties.setProperty("permitAllPattern", "/public/**");
132-
PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer();
132+
PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
133133
propertyPlaceholderConfigurer.setProperties(properties);
134134
return propertyPlaceholderConfigurer;
135135
}
@@ -153,11 +153,11 @@ SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
153153
}
154154

155155
@Bean
156-
static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
156+
static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
157157
// Typically externalize this as a properties file
158158
Properties properties = new Properties();
159159
properties.setProperty("permitAllPattern", "/public/**");
160-
PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer();
160+
PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
161161
propertyPlaceholderConfigurer.setProperties(properties);
162162
return propertyPlaceholderConfigurer;
163163
}

config/src/test/resources/org/springframework/security/config/http/HttpHeadersConfigTests-DefaultsDisabledWithPlaceholder.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<intercept-url pattern="/**" access="permitAll"/>
3030
</http>
3131

32-
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
32+
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
3333

3434
<b:bean name="simple" class="org.springframework.security.config.http.HttpHeadersConfigTests.SimpleController"/>
3535

config/src/test/resources/org/springframework/security/config/http/HttpHeadersConfigTests-DisabledWithPlaceholder.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<intercept-url pattern="/**" access="permitAll"/>
3030
</http>
3131

32-
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
32+
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
3333

3434
<b:bean name="simple" class="org.springframework.security.config.http.HttpHeadersConfigTests.SimpleController"/>
3535

config/src/test/resources/org/springframework/security/config/http/MiscHttpConfigTests-CustomFilters.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<custom-filter ref="userFilter" after="LOGOUT_FILTER"/>
3232
</http>
3333

34-
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
34+
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
3535

3636
<b:bean name="userFilter" class="org.mockito.Mockito" factory-method="mock">
3737
<b:constructor-arg value="jakarta.servlet.Filter" type="java.lang.Class"/>

config/src/test/resources/org/springframework/security/config/http/MiscHttpConfigTests-X509.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<intercept-url pattern="/**" access="authenticated"/>
3030
</http>
3131

32-
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
32+
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
3333

3434
<b:import resource="MiscHttpConfigTests-controllers.xml"/>
3535
<b:import resource="userservice.xml"/>

config/src/test/resources/org/springframework/security/config/http/MiscHttpConfigTests-X509WithSecurityContextHolderStrategy.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</b:constructor-arg>
3636
</b:bean>
3737

38-
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
38+
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
3939

4040
<b:import resource="MiscHttpConfigTests-controllers.xml"/>
4141
<b:import resource="userservice.xml"/>

config/src/test/resources/org/springframework/security/config/http/PlaceHolderAndELConfigTests-AccessDeniedPage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<access-denied-handler error-page="${accessDenied}"/>
3030
</http>
3131

32-
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
32+
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
3333

3434
<b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/>
3535

0 commit comments

Comments
 (0)