Skip to content

Commit 1a32a6a

Browse files
royclarksonDave Syer
authored andcommitted
Fix issues with DeviceDelegatingViewResolverAutoConfiguration
- Log to the correct class - Set Auto-configure after Thymeleaf hint on main class instead of internal static class - Use 'thymeleafViewResolver' bean name instead of class for conditional bean checks - Fix class name in properties documentation Fixes gh-1052
1 parent b7d94d1 commit 1a32a6a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import org.springframework.core.env.Environment;
3737
import org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver;
3838
import org.springframework.web.servlet.ViewResolver;
39-
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
4039
import org.springframework.web.servlet.view.InternalResourceViewResolver;
4140
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
4241

@@ -52,10 +51,10 @@
5251
@Configuration
5352
@ConditionalOnWebApplication
5453
@ConditionalOnClass(LiteDeviceDelegatingViewResolver.class)
55-
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
54+
@AutoConfigureAfter({ WebMvcAutoConfiguration.class, ThymeleafAutoConfiguration.class })
5655
public class DeviceDelegatingViewResolverAutoConfiguration {
5756

58-
private static Log logger = LogFactory.getLog(WebMvcConfigurerAdapter.class);
57+
private static Log logger = LogFactory.getLog(DeviceDelegatingViewResolverAutoConfiguration.class);
5958

6059
private static abstract class AbstractDelegateConfiguration implements
6160
EnvironmentAware {
@@ -103,8 +102,7 @@ private int getAdjustedOrder(int order) {
103102
protected static class DeviceDelegatingViewResolverConfiguration {
104103

105104
@Configuration
106-
@ConditionalOnBean(ThymeleafViewResolver.class)
107-
@AutoConfigureAfter(ThymeleafAutoConfiguration.class)
105+
@ConditionalOnBean(name = "thymeleafViewResolver")
108106
protected static class ThymeleafViewResolverViewResolverDelegateConfiguration
109107
extends AbstractDelegateConfiguration {
110108

@@ -124,7 +122,7 @@ public LiteDeviceDelegatingViewResolver deviceDelegatingViewResolver() {
124122
}
125123

126124
@Configuration
127-
@ConditionalOnMissingBean(ThymeleafViewResolver.class)
125+
@ConditionalOnMissingBean(name = "thymeleafViewResolver")
128126
@ConditionalOnBean(InternalResourceViewResolver.class)
129127
protected static class InternalResourceViewResolverDelegateConfiguration extends
130128
AbstractDelegateConfiguration {

spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ content into your application; rather pick only the properties that you need.
292292
# SPRING MOBILE SITE PREFERENCE ({sc-spring-boot-autoconfigure}/mobile/SitePreferenceAutoConfiguration.{sc-ext}[SitePreferenceAutoConfiguration])
293293
spring.mobile.sitepreference.enabled=true # enabled by default
294294
295-
# SPRING MOBILE DEVICE VIEWS ({sc-spring-boot-autoconfigure}/mobile/DevceDelegatingViewResolverAutoConfiguration.{sc-ext}[DevceDelegatingViewResolverAutoConfiguration])
295+
# SPRING MOBILE DEVICE VIEWS ({sc-spring-boot-autoconfigure}/mobile/DeviceDelegatingViewResolverAutoConfiguration.{sc-ext}[DeviceDelegatingViewResolverAutoConfiguration])
296296
spring.mobile.devicedelegatingviewresolver.enabled=true # disabled by default
297297
spring.mobile.devicedelegatingviewresolver.normalPrefix=
298298
spring.mobile.devicedelegatingviewresolver.normalSuffix=

0 commit comments

Comments
 (0)