Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple SiteMesh 2 Final Phase - remove GroovyPageLayoutFinder requirement #384

Open
codeconsole opened this issue Oct 13, 2023 · 0 comments

Comments

@codeconsole
Copy link
Contributor

GroovyPageLayoutFinder.groovy is coupled to too many things includingResponseRenderer.groovy

This could be solved by changing

    private GroovyPageLayoutFinder groovyPageLayoutFinder
    private GrailsPluginManager pluginManager

    @Generated
    @Autowired(required = false)
    void setGroovyPageLayoutFinder(GroovyPageLayoutFinder groovyPageLayoutFinder) {
        this.groovyPageLayoutFinder = groovyPageLayoutFinder
    

to

    private def groovyPageLayoutFinder
    private GrailsPluginManager pluginManager

    @Generated
    @Autowired(required = false)
    @Qualifier("groovyPageLayoutFinder") 
    void setGroovyPageLayoutFinder(def groovyPageLayoutFinder) {
        this.groovyPageLayoutFinder = groovyPageLayoutFinder
    }

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)
	

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant