but first the constants should be moved out of GroovyPageLayoutFinder and into a new java class since they can be utilized by both SiteMesh 2 and 3.
Plugin Breaking
Because this is a trait, this change would break any plugin controller compiled with a previous version of Grails. So this would require a warning to any Grails users that depend on old plugins with controllers. It probably should not be done until the next major version of Grails, but if that is the case a decision should be made whether to get rid of SiteMesh 2 support altogether. Since SiteMesh 2 hasn't officially been released for Jakarta, if Grails 7 is going to be Jakarta, the simplest route would be to just remove SiteMesh 2 altogether from Grails and go straight to SiteMesh 3.
Here is an example on how this breaks existing plugins:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stompWebSocketHandlerMapping' defined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsInterceptorMappedInterceptor': Cannot create inner bean '(inner bean)#29dcd84a' of type [org.grails.plugins.web.interceptors.GrailsInterceptorHandlerInterceptorAdapter] while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#29dcd84a': Unsatisfied dependency expressed through method 'setInterceptors' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enabledInterceptor': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'groovyPageLayoutFinder' threw exception; nested exception is java.lang.AbstractMethodError: Receiver class org.grails.plugins.console.EnabledInterceptor does not define or inherit an implementation of the resolved method 'abstract java.lang.Object grails_artefact_controller_support_ResponseRenderer__groovyPageLayoutFinder$set(java.lang.Object)' of interface grails.artefact.controller.support.ResponseRenderer$Trait$FieldHelper.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsInterceptorMappedInterceptor': Cannot create inner bean '(inner bean)#29dcd84a' of type [org.grails.plugins.web.interceptors.GrailsInterceptorHandlerInterceptorAdapter] while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#29dcd84a': Unsatisfied dependency expressed through method 'setInterceptors' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enabledInterceptor': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'groovyPageLayoutFinder' threw exception; nested exception is java.lang.AbstractMethodError: Receiver class org.grails.plugins.console.EnabledInterceptor does not define or inherit an implementation of the resolved method 'abstract java.lang.Object grails_artefact_controller_support_ResponseRenderer__groovyPageLayoutFinder$set(java.lang.Object)' of interface grails.artefact.controller.support.ResponseRenderer$Trait$FieldHelper.
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:389)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#29dcd84a': Unsatisfied dependency expressed through method 'setInterceptors' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enabledInterceptor': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'groovyPageLayoutFinder' threw exception; nested exception is java.lang.AbstractMethodError: Receiver class org.grails.plugins.console.EnabledInterceptor does not define or inherit an implementation of the resolved method 'abstract java.lang.Object grails_artefact_controller_support_ResponseRenderer__groovyPageLayoutFinder$set(java.lang.Object)' of interface grails.artefact.controller.support.ResponseRenderer$Trait$FieldHelper.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:824)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enabledInterceptor': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'groovyPageLayoutFinder' threw exception; nested exception is java.lang.AbstractMethodError: Receiver class org.grails.plugins.console.EnabledInterceptor does not define or inherit an implementation of the resolved method 'abstract java.lang.Object grails_artefact_controller_support_ResponseRenderer__groovyPageLayoutFinder$set(java.lang.Object)' of interface grails.artefact.controller.support.ResponseRenderer$Trait$FieldHelper.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1744)
Caused by: org.springframework.beans.PropertyBatchUpdateException: Failed properties: Property 'groovyPageLayoutFinder' threw exception; nested exception is java.lang.AbstractMethodError: Receiver class org.grails.plugins.console.EnabledInterceptor does not define or inherit an implementation of the resolved method 'abstract java.lang.Object grails_artefact_controller_support_ResponseRenderer__groovyPageLayoutFinder$set(java.lang.Object)' of interface grails.artefact.controller.support.ResponseRenderer$Trait$FieldHelper.
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:135)
GroovyPageLayoutFinder.groovy is coupled to too many things includingResponseRenderer.groovy
This could be solved by changing
to
but first the constants should be moved out of
GroovyPageLayoutFinder
and into a new java class since they can be utilized by both SiteMesh 2 and 3.Plugin Breaking
Because this is a trait, this change would break any plugin controller compiled with a previous version of Grails. So this would require a warning to any Grails users that depend on old plugins with controllers. It probably should not be done until the next major version of Grails, but if that is the case a decision should be made whether to get rid of SiteMesh 2 support altogether. Since SiteMesh 2 hasn't officially been released for Jakarta, if Grails 7 is going to be Jakarta, the simplest route would be to just remove SiteMesh 2 altogether from Grails and go straight to SiteMesh 3.
Here is an example on how this breaks existing plugins: