-
-
Notifications
You must be signed in to change notification settings - Fork 953
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-8921: Support for Scheduling via Spring's @Scheduled annotation #2216
Comments
cdeszaq said: |
graemerocher said: |
zyro said: |
brownj said: |
zyro said: |
brownj said: |
At my company, have been using @scheduled in a grails application that was running on 3.1.0.RC2. Recently it stopped working after attempting to upgrade to 3.1.9. Further investigation indicates that @scheduled stopped working in 3.1.7. I was considering creating an issue to get some feedback on the problem from a grails perspective, but this looks too closely related for a new issue. I've dug through things a little and noticed that 3.1.7 includes an upgrade from Spring Boot 1.3.3 to 1.3.5. Somewhere in the Spring Boot 1.3.4 changes they updated to Spring Framework 4.2.6. That's about as far as I've gotten. Using @scheduled does make scheduling tasks way simpler, so I'd like to see this supported. |
Are you using it on services? If yes then add |
On services indeed. I will give that a try in a moment. Side note, I tried creating a sample app , and neither with 3.1.6 nor 3.1.0.RC2 was I able to get @scheduled working out of the box. It would take a while to figure out what of the things we've done in our app makes the difference, but it appears there is something. |
@graemerocher I added that answer to this stackoverflow, feel free to add the answer yourself and I'll delete mine (I don't want to steal your answer / rep unnecessarily). |
Before my comments, based on this issue I would have concluded @scheduled is not supported in Grails. Are we doing something weird to get that working? And is there something I could try / do to help move support for it forward? |
maybe a pull request to check whether |
I was able to get the code written. However, I'm still having trouble creating a basic sample app that works with @scheduled, and our app that is using @scheduled in the service is giving me trouble that appears associated with switching from 3.1.x to 3.2.x. Regardless I wanted to get the code out so that (a) I can learn and (b) you have something to work with. |
nevermind. I got our app working with my dev grails on 3.2.0.BUILD-SNAPSHOT. But it appears I have to still hard code |
My code is definitely running, but it appears that setting the bd.lazyInit does not actually cause lazyInit to happen. |
I was able to get things to work if my service had |
This is fixed in Spring 4.3 RC2 -- https://jira.spring.io/browse/SPR-12872 so should work without needing to add lazyInit = true with grails 3.3.x |
Grails 3.2 also uses Spring 4.3 |
I was just forced to use the "lazyInit" fix in a fresh grails 3.3.3 app. Spring version is 4.3.14.RELEASE. |
We specifically published a guide on this earlier this year http://guides.grails.org/grails-scheduled/guide/index.html |
Original Reporter: sothmann
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-8921
I'd like to see support for Spring's @scheduled annotation in Grails services.
See http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/scheduling.html#scheduling-annotation-support-scheduled
Currently Grails 2.0.1 seems to not support @scheduled annotation in services.
If this annotation would be supported, there would be no need to use a separate plugin for this (quartz plugin) and scheduling would become much more simple in Grails.
The text was updated successfully, but these errors were encountered: