Skip to content

Commit fcb7315

Browse files
authored
Fix Spring webmvc latestDep tests for spring boot 4 (#15525)
1 parent a8cef2f commit fcb7315

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/build.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ dependencies {
3636
testLibrary("org.springframework.boot:spring-boot-starter-test:3.0.0")
3737
testLibrary("org.springframework.boot:spring-boot-starter-web:3.0.0")
3838
testLibrary("org.springframework.boot:spring-boot-starter-security:3.0.0")
39-
40-
// tests don't work with spring boot 4 yet
41-
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-test:3.+") // documented limitation
42-
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-web:3.+") // documented limitation
43-
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-security:3.+") // documented limitation
4439
}
4540

4641
// spring 6 requires java 17

instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/webmvc/v6_0/filter/ServletFilterTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ protected Class<?> filterConfigClass() {
5050
protected ConfigurableApplicationContext setupServer() {
5151
SpringApplication app =
5252
new SpringApplication(FilteredAppConfig.class, securityConfigClass(), filterConfigClass());
53-
app.setDefaultProperties(Map.of("server.port", port, "server.error.include-message", "always"));
53+
54+
app.setDefaultProperties(
55+
Map.of(
56+
"server.port",
57+
port,
58+
testLatestDeps ? "spring.web.error.include-message" : "server.error.include-message",
59+
"always"));
5460
return app.run();
5561
}
5662

instrumentation/spring/spring-webmvc/spring-webmvc-common/testing/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/filter/FilteredAppConfig.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ public void configurePathMatch(PathMatchConfigurer configurer) {}
4545
@Override
4646
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
4747
configurer
48-
.favorPathExtension(false)
4948
.favorParameter(true)
5049
.ignoreAcceptHeader(true)
51-
.useJaf(false)
5250
.defaultContentTypeStrategy(webRequest -> Collections.singletonList(MediaType.TEXT_PLAIN));
5351
}
5452

javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/ignore/AdditionalLibraryIgnoredTypesConfigurer.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,12 @@ public void configure(IgnoredTypesBuilder builder) {
105105
.allowClass("org.springframework.boot.logging.logback.")
106106
.allowClass("org.springframework.boot.web.filter.")
107107
.allowClass("org.springframework.boot.web.servlet.")
108+
.allowClass("org.springframework.boot.servlet.filter.")
109+
.allowClass("org.springframework.boot.web.server.servlet.context.")
108110
.allowClass("org.springframework.boot.web.embedded.netty.GracefulShutdown$$Lambda")
109111
.allowClass("org.springframework.boot.web.embedded.tomcat.GracefulShutdown$$Lambda")
112+
.allowClass("org.springframework.boot.tomcat.GracefulShutdown$$Lambda")
113+
.allowClass("org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory$$Lambda")
110114
.allowClass(
111115
"org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory$$Lambda")
112116
.allowClass(
@@ -123,6 +127,9 @@ public void configure(IgnoredTypesBuilder builder) {
123127
"org.springframework.boot.autoconfigure.web.WebProperties$Resources$Cache$Cachecontrol$$Lambda")
124128
.allowClass("org.springframework.boot.web.embedded.netty.NettyWebServer$")
125129
.allowClass("org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext$$Lambda")
130+
.allowClass("org.springframework.boot.tomcat.TomcatEmbeddedContext$$Lambda")
131+
.allowClass("org.springframework.boot.tomcat.TomcatWebServer$")
132+
.allowClass("org.springframework.boot.tomcat.TomcatEmbeddedWebappClassLoader")
126133
.allowClass(
127134
"org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer$")
128135
.allowClass(

0 commit comments

Comments
 (0)