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

5.0.0-RC3 BUG - Controllers Render as Content-Type: application/xhtml depending on random Service Injection #12057

Closed
codeconsole opened this issue Sep 8, 2021 · 1 comment · Fixed by grails/grails-data-mapping#1535

Comments

@codeconsole
Copy link
Contributor

codeconsole commented Sep 8, 2021

At first I thought this issue had to do with the hibernate plugin, but now I believe it is much more serious and based on the order of dependency injection.
Controllers will respond as Content-Type: application/xhtml and the browser will render it as such by showing a bunch of xml.

This Example App demonstrates the issue
https://github.com/codeconsole/gormbug

sdk use grails 5.0.0-RC3
git clone https://github.com/codeconsole/gormbug
cd gormbug
grails run-app

Using Chrome or Safari in a private window
http://localhost:8080/link

Notice page is sent with content type xhtml

application/xhtml+xml;charset=UTF-8

Next, do either of the following:

rm grails-app/domain/org/pilotaid/Schedule.groovy
rm grails-app/services/org/pilotaid/ScheduleService.groovy

or edit ./grails-app/services/org/pilotaid/MainService.groovy and just comment out the following line

// @Autowired SpringSecurityService springSecurityService

then

grails run-app

Using Chrome or Safari in a private window
http://localhost:8080/link

and notice the problem went away and the page renders correctly.

@codeconsole
Copy link
Contributor Author

Example updated to Grails 5.0.0-RC3

@codeconsole codeconsole changed the title 5.0.0.RC2 BUG - Controllers Render as Content-Type: application/xhtml depending on random Service Injection 5.0.0-RC3 BUG - Controllers Render as Content-Type: application/xhtml depending on random Service Injection Sep 12, 2021
puneetbehl added a commit to grails/grails-data-mapping that referenced this issue Oct 1, 2021
Previously, the getObjectType method was returning NULL because the closure in AbstractDatastoreInitializer is not called earlier in the bean processing. So, in order to resolve
the type the AbstractBeanFactory initialize the MethodInvokingFactoryBean which results in initializing objectDefinitionSource(AnnotaionFilterInvocationDefinition) early before creating servletContext.

Fixes grails/grails-core#12057
puneetbehl added a commit to grails/gorm-hibernate5 that referenced this issue Oct 1, 2021
Pass serviceClass to the constructor while loading DataService because sometime the closure is not evaluated early enough
to set it in the arguments which causes grails/grails-core#12057.
puneetbehl added a commit to grails/gorm-mongodb that referenced this issue Oct 1, 2021
Pass serviceClass to the constructor while loading DataService because sometime the closure is not evaluated early enough
to set it in the arguments which causes grails/grails-core#12057.
puneetbehl added a commit to grails/gorm-neo4j that referenced this issue Oct 1, 2021
Pass serviceClass to the constructor while loading DataService because sometime the closure is not evaluated early enough
to set it in the arguments which causes grails/grails-core#12057.
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

Successfully merging a pull request may close this issue.

1 participant