@groovy.transform.CompileStatic class UrlMappingsBeanDefinitionsPostProcessor extends java.lang.Object implements BeanDefinitionRegistryPostProcessor, PriorityOrdered
Registers the URL-mapping bean definitions the url-mappings plugin previously contributed through
the doWithSpring() bean DSL. The grailsUrlMappingsHolder bean is a
ProxyFactoryBean (in reload mode), and UrlMappingsHandlerMapping takes a
constructor reference to it. Neither can be expressed through the
org.springframework.beans.factory.BeanRegistry API without hiding the produced type inside
an instance supplier — which breaks by-type autowiring of UrlMappingsHolder (e.g.
DefaultLinkGenerator, and UrlMappingsErrorPageCustomizer's bare
@Autowired UrlMappings). The definitions are therefore contributed here.
Each factory-bean definition declares what it produces through
FactoryBean#OBJECT_TYPE_ATTRIBUTE#OBJECT_TYPE_ATTRIBUTE. That is not decoration: a factory bean's produced type
must be answerable from the definition, because a property value cannot be. Asked for the
type without it, Spring builds a constructor-only instance of the proxy — no property values
applied, so no targetSource and no proxyInterfaces — whose
getObjectType() returns null. Spring then falls back to creating the factory bean
in full, which resolves the target source and the inner UrlMappingsHolderFactoryBean,
evaluates every mapping, and reaches the constraints machinery and its
List<MessageSource> injection. All of that would happen while bean definition registry
post-processors are still running, so any @ConfigurationProperties bean created along the
way is built before ConfigurationPropertiesBindingPostProcessor exists and is silently
left at its defaults — which is how Spring Boot's message source lost every base name except
messages, and with it every plugin and application-configured bundle.
Runs as a PriorityOrdered post-processor with highest precedence so the definitions
are registered before Spring Boot's configuration-class post-processor evaluates auto-configuration
conditions — the same visibility the doWithSpring() registration had.
| Constructor and description |
|---|
UrlMappingsBeanDefinitionsPostProcessor(boolean reloadEnabled, boolean corsFilterEnabled) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
int |
getOrder() |
|
void |
postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) |
| 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) |