Skip to content

Commit bdebbb0

Browse files
committed
Update to Boot 4.0.0-SNAPSHOT
1 parent 8d33257 commit bdebbb0

File tree

8 files changed

+25
-56
lines changed

8 files changed

+25
-56
lines changed

samples/oauth2-login-custom-config/build.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id 'java'
3-
id 'org.springframework.boot' version '3.5.7'
3+
id 'org.springframework.boot' version '4.0.0-SNAPSHOT'
44
id 'io.spring.dependency-management' version '1.1.7'
55
}
66

@@ -10,10 +10,6 @@ java {
1010
sourceCompatibility = '17'
1111
}
1212

13-
repositories {
14-
mavenCentral()
15-
}
16-
1713
dependencies {
1814
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
1915
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'

samples/oauth2-login-custom-config/src/test/java/testjars/authorizationserver/SecurityConfig.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import org.springframework.security.config.Customizer;
2929
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
3030
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
31+
import org.springframework.security.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration;
32+
import org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer;
3133
import org.springframework.security.core.userdetails.User;
3234
import org.springframework.security.core.userdetails.UserDetails;
3335
import org.springframework.security.core.userdetails.UserDetailsService;
@@ -38,8 +40,6 @@
3840
import org.springframework.security.oauth2.server.authorization.client.InMemoryRegisteredClientRepository;
3941
import org.springframework.security.oauth2.server.authorization.client.RegisteredClient;
4042
import org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository;
41-
import org.springframework.security.oauth2.server.authorization.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration;
42-
import org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer;
4343
import org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings;
4444
import org.springframework.security.oauth2.server.authorization.settings.ClientSettings;
4545
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
@@ -53,22 +53,20 @@
5353
import java.security.interfaces.RSAPublicKey;
5454
import java.util.UUID;
5555

56-
import static org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer.authorizationServer;
57-
5856
@Configuration
5957
@EnableWebSecurity
6058
public class SecurityConfig {
6159

6260
@Bean
6361
@Order(1)
6462
public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http)
65-
throws Exception {
66-
OAuth2AuthorizationServerConfigurer authzServer = authorizationServer();
63+
{
6764
http
68-
.securityMatcher(authzServer.getEndpointsMatcher())
69-
.with(authzServer, (authz) -> authz
70-
.oidc(Customizer.withDefaults())
71-
)
65+
.oauth2AuthorizationServer((authorizationServer) -> {
66+
http.securityMatcher(authorizationServer.getEndpointsMatcher());
67+
authorizationServer
68+
.oidc(Customizer.withDefaults()); // Enable OpenID Connect 1.0
69+
})
7270
// Redirect to the login page when not authenticated from the
7371
// authorization endpoint
7472
.exceptionHandling((exceptions) -> exceptions

samples/oauth2-login/build.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id 'java'
3-
id 'org.springframework.boot' version '3.5.7'
3+
id 'org.springframework.boot' version '4.0.0-SNAPSHOT'
44
id 'io.spring.dependency-management' version '1.1.7'
55
}
66

@@ -10,10 +10,6 @@ java {
1010
sourceCompatibility = '17'
1111
}
1212

13-
repositories {
14-
mavenCentral()
15-
}
16-
1713
dependencies {
1814
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
1915
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'

settings.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ plugins {
1212
id "com.gradle.develocity" version "4.2.2"
1313
}
1414

15+
dependencyResolutionManagement {
16+
repositories {
17+
mavenCentral()
18+
maven {
19+
url 'https://repo.spring.io/snapshot'
20+
}
21+
}
22+
}
23+
1524
// FIXME: Perhaps this should be named spring-boot-webserver-commons-exec
1625
rootProject.name = 'spring-boot-testjars-build'
1726

spring-boot-testjars-maven/build.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@ java {
1717
sourceCompatibility = '17'
1818
}
1919

20-
repositories {
21-
mavenCentral()
22-
}
23-
2420
checkstyle {
2521
toolVersion = "9.3"
2622
}
2723

2824
dependencies {
2925
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.40")
3026
api project(':spring-boot-testjars')
31-
api platform('org.springframework.boot:spring-boot-dependencies:3.5.7')
27+
api platform('org.springframework.boot:spring-boot-dependencies:4.0.0-SNAPSHOT')
3228
api 'org.springframework.boot:spring-boot-starter'
3329
api "org.apache.maven:maven-resolver-provider:${mavenVersion}"
3430
api "org.apache.maven.resolver:maven-resolver-api:${mavenResolverVersion}"

spring-boot-testjars/build.gradle

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,18 @@ java {
1212
sourceCompatibility = '17'
1313
}
1414

15-
repositories {
16-
mavenCentral()
17-
}
18-
1915
checkstyle {
2016
toolVersion = "9.3"
2117
}
2218

2319
dependencies {
2420
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.40")
2521
compileOnly 'org.springframework.boot:spring-boot-loader'
26-
implementation platform('org.springframework.boot:spring-boot-dependencies:3.5.7')
22+
implementation platform('org.springframework.boot:spring-boot-dependencies:4.0.0-SNAPSHOT')
2723
implementation 'org.apache.commons:commons-exec:1.3'
2824
implementation 'org.springframework:spring-test'
29-
implementation 'org.springframework.boot:spring-boot-testcontainers'
25+
implementation 'org.springframework.boot:spring-boot-autoconfigure'
26+
implementation 'org.springframework.boot:spring-boot-web-server'
3027
testImplementation 'org.springframework.boot:spring-boot-loader'
3128
testImplementation 'org.springframework.boot:spring-boot-starter-test'
3229
testImplementation 'org.springframework:spring-web'

spring-boot-testjars/src/main/java/org/springframework/experimental/boot/test/context/DynamicPropertyDefinitionRegistrar.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@
2525
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
2626
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
2727
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
28-
import org.springframework.boot.testcontainers.properties.TestcontainersPropertySource;
2928
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
3029
import org.springframework.core.annotation.MergedAnnotation;
3130
import org.springframework.core.env.Environment;
3231
import org.springframework.core.type.AnnotationMetadata;
3332
import org.springframework.core.type.MethodMetadata;
3433
import org.springframework.test.context.DynamicPropertyRegistrar;
3534
import org.springframework.test.context.DynamicPropertyRegistry;
36-
import org.springframework.util.ClassUtils;
3735

3836
/**
3937
* Finds beans annotated with {@link DynamicProperty} and adds the properties to the
@@ -63,13 +61,7 @@ public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, B
6361
return;
6462
}
6563
if (this.beanFactory instanceof ConfigurableListableBeanFactory listableBeanFactory) {
66-
if (ClassUtils.isPresent("org.springframework.test.context.DynamicPropertyRegistrar",
67-
getClass().getClassLoader())) {
68-
registerDynamicPropertyRegistrar(listableBeanFactory, registry);
69-
}
70-
else {
71-
registerTestcontainersPropertySource(listableBeanFactory, registry);
72-
}
64+
registerDynamicPropertyRegistrar(listableBeanFactory, registry);
7365
}
7466
}
7567

@@ -93,21 +85,6 @@ private void registerDynamicPropertyRegistrar(ConfigurableListableBeanFactory be
9385
registry.registerBeanDefinition(REGISTRAR_BEAN_NAME, registrarBdb.getBeanDefinition());
9486
}
9587

96-
private void registerTestcontainersPropertySource(ConfigurableListableBeanFactory beanFactory,
97-
BeanDefinitionRegistry registry) {
98-
DynamicPropertyRegistry properties = TestcontainersPropertySource.attach(this.environment);
99-
for (String dynamicPropertyBeanName : beanFactory.getBeanNamesForAnnotation(DynamicProperty.class)) {
100-
BeanDefinition dynamicPropertyBeanDefinition = registry.getBeanDefinition(dynamicPropertyBeanName);
101-
DynamicPropertyRegistryProperty property = createRegistryProperty(dynamicPropertyBeanDefinition,
102-
dynamicPropertyBeanName);
103-
if (property == null) {
104-
throw new IllegalStateException(
105-
"Missing @DynamicProperty annotation on BeanDefinition of " + dynamicPropertyBeanName);
106-
}
107-
properties.add(property.name(), property.value());
108-
}
109-
}
110-
11188
private DynamicPropertyRegistryProperty createRegistryProperty(BeanDefinition dynamicPropertyBeanDefinition,
11289
String dynamicPropertyBeanName) {
11390
if (dynamicPropertyBeanDefinition instanceof AnnotatedBeanDefinition annotatedBeanDefinition) {
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
org.springframework.context.ApplicationListener=\
2-
org.springframework.boot.web.context.WebServerPortFileWriter
2+
org.springframework.boot.web.server.context.WebServerPortFileWriter

0 commit comments

Comments
 (0)