Skip to content

Commit 646d582

Browse files
committed
Merge branch '2.6.x' into 2.7.x
Closes gh-31099
2 parents 8b611df + e407bae commit 646d582

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafReactiveAutoConfigurationTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.thymeleaf.TemplateEngine;
2828
import org.thymeleaf.context.Context;
2929
import org.thymeleaf.context.IContext;
30+
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;
3031
import org.thymeleaf.extras.springsecurity5.util.SpringSecurityContextUtils;
3132
import org.thymeleaf.spring5.ISpringWebFluxTemplateEngine;
3233
import org.thymeleaf.spring5.SpringWebFluxTemplateEngine;
@@ -36,6 +37,7 @@
3637
import org.thymeleaf.templateresolver.ITemplateResolver;
3738

3839
import org.springframework.boot.autoconfigure.AutoConfigurations;
40+
import org.springframework.boot.test.context.FilteredClassLoader;
3941
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
4042
import org.springframework.boot.test.system.CapturedOutput;
4143
import org.springframework.boot.test.system.OutputCaptureExtension;
@@ -216,6 +218,12 @@ void useSecurityDialect() {
216218
});
217219
}
218220

221+
@Test
222+
void securityDialectAutoConfigurationBacksOffWithoutSpringSecurity() {
223+
this.contextRunner.withClassLoader(new FilteredClassLoader("org.springframework.security"))
224+
.run((context) -> assertThat(context).doesNotHaveBean(SpringSecurityDialect.class));
225+
}
226+
219227
@Test
220228
void renderTemplate() {
221229
this.contextRunner.run((context) -> {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131
import org.thymeleaf.TemplateEngine;
3232
import org.thymeleaf.context.Context;
3333
import org.thymeleaf.context.WebContext;
34+
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;
3435
import org.thymeleaf.spring5.SpringTemplateEngine;
3536
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
3637
import org.thymeleaf.spring5.view.ThymeleafView;
@@ -231,6 +232,12 @@ void useSecurityDialect() {
231232
});
232233
}
233234

235+
@Test
236+
void securityDialectAutoConfigurationBacksOffWithoutSpringSecurity() {
237+
this.contextRunner.withClassLoader(new FilteredClassLoader("org.springframework.security"))
238+
.run((context) -> assertThat(context).doesNotHaveBean(SpringSecurityDialect.class));
239+
}
240+
234241
@Test
235242
void renderTemplate() {
236243
this.contextRunner.run((context) -> {

0 commit comments

Comments
 (0)