@org.springframework.boot.autoconfigure.AutoConfiguration(beforeName = "org.grails.plugins.i18n.I18nAutoConfiguration") @org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @org.springframework.context.annotation.Import(GrailsLocaleResolverAutoConfiguration.RemoveWebMvcSupportLocaleResolverRegistrar.class) public class GrailsLocaleResolverAutoConfiguration extends java.lang.Object
When an application declares @EnableWebMvc, Spring's WebMvcConfigurationSupport
contributes its own localeResolver bean (an AcceptHeaderLocaleResolver). That bean
exists before I18nGrailsPlugin's generated I18nAutoConfiguration is
evaluated, so its @ConditionalOnMissingBean(name = "localeResolver") backs off and Grails'
configured resolver (a SessionLocaleResolver by default) never registers — silently
disabling ?lang= switching. This was not the case before WebMvcConfigurationSupport
gained a localeResolver bean: Grails' resolver used to take precedence, matching Grails 7
behavior.
This removes the WebMvcConfigurationSupport-contributed localeResolver so that
I18nGrailsPlugin's generated auto-configuration registers the Grails-configured resolver
instead. A localeResolver contributed by the application itself (for example via
resources.groovy or a user @Configuration) is left untouched, so an explicit
application resolver still wins. Ordered before that generated auto-configuration (by name, since
it does not exist as a compilable class for this class to reference directly) so the removal
happens before its condition is evaluated.
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |