Merge branch '6.1.x'

# Conflicts:
#	spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolutionIntegrationTests.java
This commit is contained in:
Juergen Hoeller 2024-07-08 19:54:07 +02:00
commit c6347025d6
3 changed files with 27 additions and 24 deletions

View File

@ -13,7 +13,7 @@ dependencies {
api(platform("io.netty:netty5-bom:5.0.0.Alpha5"))
api(platform("io.projectreactor:reactor-bom:2024.0.0-M3"))
api(platform("io.rsocket:rsocket-bom:1.1.3"))
api(platform("org.apache.groovy:groovy-bom:4.0.21"))
api(platform("org.apache.groovy:groovy-bom:4.0.22"))
api(platform("org.apache.logging.log4j:log4j-bom:2.21.1"))
api(platform("org.assertj:assertj-bom:3.26.0"))
api(platform("org.eclipse.jetty:jetty-bom:12.0.11"))
@ -55,9 +55,9 @@ dependencies {
api("io.r2dbc:r2dbc-spi:1.0.0.RELEASE")
api("io.reactivex.rxjava3:rxjava:3.1.8")
api("io.smallrye.reactive:mutiny:1.10.0")
api("io.undertow:undertow-core:2.3.13.Final")
api("io.undertow:undertow-servlet:2.3.13.Final")
api("io.undertow:undertow-websockets-jsr:2.3.13.Final")
api("io.undertow:undertow-core:2.3.14.Final")
api("io.undertow:undertow-servlet:2.3.14.Final")
api("io.undertow:undertow-websockets-jsr:2.3.14.Final")
api("io.vavr:vavr:0.10.4")
api("jakarta.activation:jakarta.activation-api:2.0.1")
api("jakarta.annotation:jakarta.annotation-api:2.0.0")
@ -100,12 +100,12 @@ dependencies {
api("org.apache.derby:derbyclient:10.16.1.1")
api("org.apache.derby:derbytools:10.16.1.1")
api("org.apache.httpcomponents.client5:httpclient5:5.3.1")
api("org.apache.httpcomponents.core5:httpcore5-reactive:5.2.4")
api("org.apache.httpcomponents.core5:httpcore5-reactive:5.2.5")
api("org.apache.poi:poi-ooxml:5.2.5")
api("org.apache.tomcat.embed:tomcat-embed-core:10.1.24")
api("org.apache.tomcat.embed:tomcat-embed-websocket:10.1.24")
api("org.apache.tomcat:tomcat-util:10.1.24")
api("org.apache.tomcat:tomcat-websocket:10.1.24")
api("org.apache.tomcat.embed:tomcat-embed-core:10.1.25")
api("org.apache.tomcat.embed:tomcat-embed-websocket:10.1.25")
api("org.apache.tomcat:tomcat-util:10.1.25")
api("org.apache.tomcat:tomcat-websocket:10.1.25")
api("org.aspectj:aspectjrt:1.9.22.1")
api("org.aspectj:aspectjtools:1.9.22.1")
api("org.aspectj:aspectjweaver:1.9.22.1")
@ -114,7 +114,7 @@ dependencies {
api("org.codehaus.jettison:jettison:1.5.4")
api("org.crac:crac:1.4.0")
api("org.dom4j:dom4j:2.1.4")
api("org.eclipse.jetty:jetty-reactive-httpclient:4.0.4")
api("org.eclipse.jetty:jetty-reactive-httpclient:4.0.5")
api("org.eclipse.persistence:org.eclipse.persistence.jpa:3.0.4")
api("org.eclipse:yasson:2.0.4")
api("org.ehcache:ehcache:3.10.8")

View File

@ -78,8 +78,8 @@ class WebFluxViewResolutionIntegrationTests {
@Test
void freemarkerWithInvalidConfig() {
assertThatRuntimeException()
.isThrownBy(() -> runTest(InvalidFreeMarkerWebFluxConfig.class))
.withMessageContaining("In addition to a FreeMarker view resolver ");
.isThrownBy(() -> runTest(InvalidFreeMarkerWebFluxConfig.class))
.withMessageContaining("In addition to a FreeMarker view resolver ");
}
@Test

View File

@ -16,7 +16,6 @@
package org.springframework.web.servlet.config.annotation;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
@ -48,10 +47,7 @@ import static org.assertj.core.api.Assertions.assertThatRuntimeException;
*/
class ViewResolutionIntegrationTests {
@BeforeAll
static void verifyDefaultFileEncoding() {
assertThat(System.getProperty("file.encoding")).as("JVM default file encoding").isEqualTo("UTF-8");
}
private static final boolean utf8Default = UTF_8.name().equals(System.getProperty("file.encoding"));
@Nested
@ -71,22 +67,26 @@ class ViewResolutionIntegrationTests {
@Test
void freemarkerWithInvalidConfig() {
assertThatRuntimeException()
.isThrownBy(() -> runTest(InvalidFreeMarkerWebConfig.class))
.withMessageContaining("In addition to a FreeMarker view resolver ");
.isThrownBy(() -> runTest(InvalidFreeMarkerWebConfig.class))
.withMessageContaining("In addition to a FreeMarker view resolver ");
}
@Test
void freemarkerWithDefaultEncoding() throws Exception {
// Since no explicit encoding or content type has been set, we expect ISO-8859-1,
// which is the default.
runTestAndAssertResults(DEFAULT_ENCODING, FreeMarkerDefaultEncodingConfig.class);
if (utf8Default) {
runTestAndAssertResults(DEFAULT_ENCODING, FreeMarkerDefaultEncodingConfig.class);
}
}
@Test // gh-16629, gh-33071
void freemarkerWithExistingViewResolverWithDefaultEncoding() throws Exception {
// Since no explicit encoding or content type has been set, we expect ISO-8859-1,
// which is the default.
runTestAndAssertResults(DEFAULT_ENCODING, ExistingViewResolverConfig.class);
if (utf8Default) {
runTestAndAssertResults(DEFAULT_ENCODING, ExistingViewResolverConfig.class);
}
}
@Test // gh-33071, gh-33119
@ -190,20 +190,23 @@ class ViewResolutionIntegrationTests {
}
}
@Nested
class GroovyMarkupTests {
@Test
void groovyMarkupInvalidConfig() {
assertThatRuntimeException()
.isThrownBy(() -> runTest(InvalidGroovyMarkupWebConfig.class))
.withMessageContaining("In addition to a Groovy markup view resolver ");
.isThrownBy(() -> runTest(InvalidGroovyMarkupWebConfig.class))
.withMessageContaining("In addition to a Groovy markup view resolver ");
}
@Test
void groovyMarkup() throws Exception {
MockHttpServletResponse response = runTest(GroovyMarkupWebConfig.class);
assertThat(response.getContentAsString()).isEqualTo("<html><body>Hello, Java Café</body></html>");
if (utf8Default) {
assertThat(response.getContentAsString()).isEqualTo("<html><body>Hello, Java Café</body></html>");
}
}