Browse Source

Update to PropertySourcesPlaceholderConfigurer

This commit replaces deprecated usage of PropertyPlaceholderConfigurer
in favor of PropertySourcesPlaceholderConfigurer
pull/17324/merge
Josh Cummings 4 months ago
parent
commit
f30cc9c5a9
No known key found for this signature in database
GPG Key ID: 869B37A20E876129
  1. 2
      config/src/integration-test/java/org/springframework/security/config/ldap/LdapProviderBeanDefinitionParserTests.java
  2. 2
      config/src/test/java/org/springframework/security/config/authentication/UserServiceBeanDefinitionParserTests.java
  3. 2
      config/src/test/java/org/springframework/security/config/http/FilterSecurityMetadataSourceBeanDefinitionParserTests.java
  4. 10
      config/src/test/java/org/springframework/security/config/http/customconfigurer/CustomHttpSecurityConfigurerTests.java
  5. 2
      config/src/test/resources/org/springframework/security/config/http/HttpHeadersConfigTests-DefaultsDisabledWithPlaceholder.xml
  6. 2
      config/src/test/resources/org/springframework/security/config/http/HttpHeadersConfigTests-DisabledWithPlaceholder.xml
  7. 2
      config/src/test/resources/org/springframework/security/config/http/MiscHttpConfigTests-CustomFilters.xml
  8. 2
      config/src/test/resources/org/springframework/security/config/http/MiscHttpConfigTests-X509.xml
  9. 2
      config/src/test/resources/org/springframework/security/config/http/MiscHttpConfigTests-X509WithSecurityContextHolderStrategy.xml
  10. 2
      config/src/test/resources/org/springframework/security/config/http/PlaceHolderAndELConfigTests-AccessDeniedPage.xml
  11. 2
      config/src/test/resources/org/springframework/security/config/http/PlaceHolderAndELConfigTests-AccessDeniedPageWithSpEL.xml
  12. 2
      config/src/test/resources/org/springframework/security/config/http/PlaceHolderAndELConfigTests-InterceptUrlAndFormLogin.xml
  13. 2
      config/src/test/resources/org/springframework/security/config/http/PlaceHolderAndELConfigTests-InterceptUrlAndFormLoginWithSpEL.xml
  14. 2
      config/src/test/resources/org/springframework/security/config/http/PlaceHolderAndELConfigTests-PortMapping.xml
  15. 2
      config/src/test/resources/org/springframework/security/config/http/PlaceHolderAndELConfigTests-RequiresChannel.xml
  16. 2
      config/src/test/resources/org/springframework/security/config/http/PlaceHolderAndELConfigTests-UnsecuredPattern.xml
  17. 2
      config/src/test/resources/org/springframework/security/config/http/RememberMeConfigTests-Sec2165.xml
  18. 2
      config/src/test/resources/org/springframework/security/config/method-security.xml
  19. 2
      config/src/test/resources/org/springframework/security/util/filtertest-valid.xml

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

@ -169,7 +169,7 @@ public class LdapProviderBeanDefinitionParserTests {
this.appCtx = new InMemoryXmlApplicationContext("<ldap-server />" + "<authentication-manager>" this.appCtx = new InMemoryXmlApplicationContext("<ldap-server />" + "<authentication-manager>"
+ " <ldap-authentication-provider user-dn-pattern='uid={0},ou=${udp}' group-search-filter='${gsf}={0}' />" + " <ldap-authentication-provider user-dn-pattern='uid={0},ou=${udp}' group-search-filter='${gsf}={0}' />"
+ "</authentication-manager>" + "</authentication-manager>"
+ "<b:bean id='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer' class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer' />"); + "<b:bean id='org.springframework.context.support.PropertySourcesPlaceholderConfigurer' class='org.springframework.context.support.PropertySourcesPlaceholderConfigurer' />");
ProviderManager providerManager = this.appCtx.getBean(BeanIds.AUTHENTICATION_MANAGER, ProviderManager.class); ProviderManager providerManager = this.appCtx.getBean(BeanIds.AUTHENTICATION_MANAGER, ProviderManager.class);
assertThat(providerManager.getProviders()).hasSize(1); assertThat(providerManager.getProviders()).hasSize(1);

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

@ -68,7 +68,7 @@ public class UserServiceBeanDefinitionParserTests {
System.setProperty("principal.pass", "joespassword"); System.setProperty("principal.pass", "joespassword");
System.setProperty("principal.authorities", "ROLE_A,ROLE_B"); System.setProperty("principal.authorities", "ROLE_A,ROLE_B");
// @formatter:off // @formatter:off
setContext("<b:bean class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer'/>" setContext("<b:bean class='org.springframework.context.support.PropertySourcesPlaceholderConfigurer'/>"
+ "<user-service id='service'>" + "<user-service id='service'>"
+ " <user name='${principal.name}' password='${principal.pass}' authorities='${principal.authorities}'/>" + " <user name='${principal.name}' password='${principal.pass}' authorities='${principal.authorities}'/>"
+ "</user-service>"); + "</user-service>");

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

@ -92,7 +92,7 @@ public class FilterSecurityMetadataSourceBeanDefinitionParserTests {
public void interceptUrlsSupportPropertyPlaceholders() { public void interceptUrlsSupportPropertyPlaceholders() {
System.setProperty("secure.url", "/secure"); System.setProperty("secure.url", "/secure");
System.setProperty("secure.role", "ROLE_A"); System.setProperty("secure.role", "ROLE_A");
setContext("<b:bean class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer'/>" setContext("<b:bean class='org.springframework.context.support.PropertySourcesPlaceholderConfigurer'/>"
+ "<filter-security-metadata-source id='fids' use-expressions='false'>" + "<filter-security-metadata-source id='fids' use-expressions='false'>"
+ " <intercept-url pattern='${secure.url}' access='${secure.role}'/>" + " <intercept-url pattern='${secure.url}' access='${secure.role}'/>"
+ "</filter-security-metadata-source>"); + "</filter-security-metadata-source>");

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

@ -24,11 +24,11 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockHttpServletResponse;
@ -125,11 +125,11 @@ public class CustomHttpSecurityConfigurerTests {
} }
@Bean @Bean
static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() { static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
// Typically externalize this as a properties file // Typically externalize this as a properties file
Properties properties = new Properties(); Properties properties = new Properties();
properties.setProperty("permitAllPattern", "/public/**"); properties.setProperty("permitAllPattern", "/public/**");
PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer(); PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
propertyPlaceholderConfigurer.setProperties(properties); propertyPlaceholderConfigurer.setProperties(properties);
return propertyPlaceholderConfigurer; return propertyPlaceholderConfigurer;
} }
@ -153,11 +153,11 @@ public class CustomHttpSecurityConfigurerTests {
} }
@Bean @Bean
static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() { static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
// Typically externalize this as a properties file // Typically externalize this as a properties file
Properties properties = new Properties(); Properties properties = new Properties();
properties.setProperty("permitAllPattern", "/public/**"); properties.setProperty("permitAllPattern", "/public/**");
PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer(); PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
propertyPlaceholderConfigurer.setProperties(properties); propertyPlaceholderConfigurer.setProperties(properties);
return propertyPlaceholderConfigurer; return propertyPlaceholderConfigurer;
} }

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

@ -29,7 +29,7 @@
<intercept-url pattern="/**" access="permitAll"/> <intercept-url pattern="/**" access="permitAll"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="simple" class="org.springframework.security.config.http.HttpHeadersConfigTests.SimpleController"/> <b:bean name="simple" class="org.springframework.security.config.http.HttpHeadersConfigTests.SimpleController"/>

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

@ -29,7 +29,7 @@
<intercept-url pattern="/**" access="permitAll"/> <intercept-url pattern="/**" access="permitAll"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="simple" class="org.springframework.security.config.http.HttpHeadersConfigTests.SimpleController"/> <b:bean name="simple" class="org.springframework.security.config.http.HttpHeadersConfigTests.SimpleController"/>

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

@ -31,7 +31,7 @@
<custom-filter ref="userFilter" after="LOGOUT_FILTER"/> <custom-filter ref="userFilter" after="LOGOUT_FILTER"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="userFilter" class="org.mockito.Mockito" factory-method="mock"> <b:bean name="userFilter" class="org.mockito.Mockito" factory-method="mock">
<b:constructor-arg value="jakarta.servlet.Filter" type="java.lang.Class"/> <b:constructor-arg value="jakarta.servlet.Filter" type="java.lang.Class"/>

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

@ -29,7 +29,7 @@
<intercept-url pattern="/**" access="authenticated"/> <intercept-url pattern="/**" access="authenticated"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:import resource="MiscHttpConfigTests-controllers.xml"/> <b:import resource="MiscHttpConfigTests-controllers.xml"/>
<b:import resource="userservice.xml"/> <b:import resource="userservice.xml"/>

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

@ -35,7 +35,7 @@
</b:constructor-arg> </b:constructor-arg>
</b:bean> </b:bean>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:import resource="MiscHttpConfigTests-controllers.xml"/> <b:import resource="MiscHttpConfigTests-controllers.xml"/>
<b:import resource="userservice.xml"/> <b:import resource="userservice.xml"/>

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

@ -29,7 +29,7 @@
<access-denied-handler error-page="${accessDenied}"/> <access-denied-handler error-page="${accessDenied}"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/> <b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/>

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

@ -29,7 +29,7 @@
<access-denied-handler error-page="#{'/go' + '-away'}"/> <access-denied-handler error-page="#{'/go' + '-away'}"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/> <b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/>

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

@ -34,7 +34,7 @@
<csrf disabled="true"/> <csrf disabled="true"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="unsecured" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/> <b:bean name="unsecured" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/>

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

@ -37,7 +37,7 @@
<csrf disabled="true"/> <csrf disabled="true"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/> <b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/>

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

@ -33,7 +33,7 @@
</port-mappings> </port-mappings>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/> <b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/>

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

@ -28,7 +28,7 @@
<intercept-url pattern="${secure.url}" access="ROLE_USER" requires-channel="${required.channel}"/> <intercept-url pattern="${secure.url}" access="ROLE_USER" requires-channel="${required.channel}"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/> <b:bean name="sc" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/>

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

@ -30,7 +30,7 @@
<intercept-url pattern="/**" access="ROLE_NUNYA"/> <intercept-url pattern="/**" access="ROLE_NUNYA"/>
</http> </http>
<b:bean name="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <b:bean name="propertyPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
<b:bean name="unsecured" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/> <b:bean name="unsecured" class="org.springframework.security.config.http.PlaceHolderAndELConfigTests.SimpleController"/>

2
config/src/test/resources/org/springframework/security/config/http/RememberMeConfigTests-Sec2165.xml

@ -31,7 +31,7 @@
token-validity-seconds="${security.rememberme.ttl}"/> token-validity-seconds="${security.rememberme.ttl}"/>
</http> </http>
<b:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <b:bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<b:property name="properties" value="security.rememberme.ttl=30"/> <b:property name="properties" value="security.rememberme.ttl=30"/>
</b:bean> </b:bean>

2
config/src/test/resources/org/springframework/security/config/method-security.xml

@ -28,7 +28,7 @@
<b:bean name="transactionManager" class="org.springframework.security.config.MockTransactionManager" /> <b:bean name="transactionManager" class="org.springframework.security.config.MockTransactionManager" />
<b:bean class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer'/> <b:bean class='org.springframework.context.support.PropertySourcesPlaceholderConfigurer'/>
<b:bean id="transactionalTarget" class="org.springframework.security.config.TransactionalTestBusinessBean"> <b:bean id="transactionalTarget" class="org.springframework.security.config.TransactionalTestBusinessBean">
<intercept-methods use-authorization-manager="false"> <intercept-methods use-authorization-manager="false">

2
config/src/test/resources/org/springframework/security/util/filtertest-valid.xml

@ -110,7 +110,7 @@
</sec:filter-chain-map> </sec:filter-chain-map>
</bean> </bean>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" /> <bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer" />
<bean id="sec1235FilterChainProxy" class="org.springframework.security.web.FilterChainProxy"> <bean id="sec1235FilterChainProxy" class="org.springframework.security.web.FilterChainProxy">
<constructor-arg> <constructor-arg>

Loading…
Cancel
Save