-
-
Notifications
You must be signed in to change notification settings - Fork 954
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
Grails 7.0.0-M1 - difficulties applying default constraints in application.groovy #14035
Comments
Attached is a bad app in a zip file. You need Make and docker installed to follow the steps below. Unzip and in root directory run You can run the image with Once its started if you go to The reason is that the application.groovy in the war is not loaded when the app starts, so the default constraints included in that file do not get added to the domain classes. One of the test record saves has a null property, so that save fails. This works if you run using bootRun. The application.groovy is added to the PropertySources, and so the default constraints are applied. Finally - the build.gradle contains a commented out ref to |
Thank you @boardbloke for reporting this. We've added it to the next milestone. For reference, here's the gradle dependency graph of the library that causes the problem:
|
Expected Behavior
No response
Actual Behaviour
Not completely sure of precise cause atm, but behaviour i was seeing was that application.groovy was not being merged into PropertySources and default constraints were not being applied.
Works if you bootRun
Also - related, but separate, if I include CXF's starter-jaxws as an implementation dependency, then, boitRun also fails - it seems the auto wiring of grailsapplication does not occur in DefaultContraintEvaluatorFactory so it doesn't wire in the default constraints. If I take that starter out, and just use CXF classes the grailApplication is correctly injected
I'll try to find time to produce a minimal criminal, and attach
In the meantime, I worked around the application.groovy issue by creating a listener similar to that used in external-config library to manually load appliccation.groovy, slurp it and create a PropertySource which I add to the end of the list
Steps To Reproduce
Built a web based Grails app with a domain class
Have a application.yml and application.groovy in grails-app/conf
In application.groovy have a grails.gorm.default.constraints closure
Run in Tomcat with an external application.properties with the its location specified as a Spring.config.location
Environment Information
No response
Example Application
No response
Version
7.0.0-M1
The text was updated successfully, but these errors were encountered: