Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ dependencies {
testLibrary("org.springframework.boot:spring-boot-starter-test:3.0.0")
testLibrary("org.springframework.boot:spring-boot-starter-web:3.0.0")
testLibrary("org.springframework.boot:spring-boot-starter-security:3.0.0")

// tests don't work with spring boot 4 yet
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-test:3.+") // documented limitation
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-web:3.+") // documented limitation
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-security:3.+") // documented limitation
}

// spring 6 requires java 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
@Configuration
class ServletFilterConfig {

private static final boolean testLatestDeps = Boolean.getBoolean("testLatestDeps");

@Bean
Filter servletFilter() {
return new Filter() {
Expand Down Expand Up @@ -54,6 +56,9 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
} else if (endpoint == ServerEndpoint.ERROR) {
resp.sendError(endpoint.getStatus(), endpoint.getBody());
} else if (endpoint == ServerEndpoint.EXCEPTION) {
if (testLatestDeps) {
throw new IllegalArgumentException(endpoint.getBody());
}
throw new IllegalStateException(endpoint.getBody());
} else if (endpoint == ServerEndpoint.INDEXED_CHILD) {
INDEXED_CHILD.collectSpanAttributes(req::getParameter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ protected Class<?> filterConfigClass() {
protected ConfigurableApplicationContext setupServer() {
SpringApplication app =
new SpringApplication(FilteredAppConfig.class, securityConfigClass(), filterConfigClass());
app.setDefaultProperties(Map.of("server.port", port, "server.error.include-message", "always"));

app.setDefaultProperties(
Map.of(
"server.port",
port,
testLatestDeps ? "spring.web.error.include-message" : "server.error.include-message",
"always"));
return app.run();
}

Expand Down Expand Up @@ -96,5 +102,9 @@ protected SpanDataAssert assertResponseSpan(
protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setResponseCodeOnNonStandardHttpMethod(400);
if (testLatestDeps) {
options.setExpectedException(
new IllegalArgumentException(ServerEndpoint.EXCEPTION.getBody()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ public void configurePathMatch(PathMatchConfigurer configurer) {}
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer
.favorPathExtension(false)
.favorParameter(true)
.ignoreAcceptHeader(true)
.useJaf(false)
.defaultContentTypeStrategy(webRequest -> Collections.singletonList(MediaType.TEXT_PLAIN));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ public void configure(IgnoredTypesBuilder builder) {
.allowClass("org.springframework.boot.logging.logback.")
.allowClass("org.springframework.boot.web.filter.")
.allowClass("org.springframework.boot.web.servlet.")
.allowClass("org.springframework.boot.servlet.filter.")
.allowClass("org.springframework.boot.web.server.servlet.context.")
.allowClass("org.springframework.boot.web.embedded.netty.GracefulShutdown$$Lambda")
.allowClass("org.springframework.boot.web.embedded.tomcat.GracefulShutdown$$Lambda")
.allowClass("org.springframework.boot.tomcat.GracefulShutdown$$Lambda")
.allowClass("org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory$$Lambda")
.allowClass(
"org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory$$Lambda")
.allowClass(
Expand All @@ -123,6 +127,9 @@ public void configure(IgnoredTypesBuilder builder) {
"org.springframework.boot.autoconfigure.web.WebProperties$Resources$Cache$Cachecontrol$$Lambda")
.allowClass("org.springframework.boot.web.embedded.netty.NettyWebServer$")
.allowClass("org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext$$Lambda")
.allowClass("org.springframework.boot.tomcat.TomcatEmbeddedContext$$Lambda")
.allowClass("org.springframework.boot.tomcat.TomcatWebServer$")
.allowClass("org.springframework.boot.tomcat.TomcatEmbeddedWebappClassLoader")
.allowClass(
"org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer$")
.allowClass(
Expand Down
Loading