we are upgrading a grails 2.2.5 application to grails 3.1 and have an interesting error. What does this mean and how should it be resolved?
/myapp/grails-app/controllers/myapp/admin/AdminProjectController.groovy: -1:
The return type of java.lang.Object getGrailsApplication() in myapp.admin.AdminProjectController is incompatible with grails.core.GrailsApplication in grails.web.api.WebAttributes
. At [-1:-1] @ line -1, column -1.
Thanks to burtbeckwith on this issue.
"Controllers in Grails 2 and Grails 3 already have an implicit dependency injection for GrailsApplication, so you're adding a second. In Grails 2 it's not typed (def grailsApplication) but in Grails 3 it is typed (GrailsApplication grailsApplication), so you've effectively added an override, but with a less specific return type which is invalid. Just delete your def grailsApplication and use the one that's already there."
If you just remove def grailsApplication
from all controllers it will be fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With