Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3961630
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:59:53+00:00 2026-05-20T02:59:53+00:00

in my grails application i’d like to invoke from a scheduled job class a

  • 0

in my grails application i’d like to invoke from a scheduled job class a method contained in a controller.

Reading this [http://www.grails.org/Job+Scheduling+(Quartz)], I can see that datasources and services are auto-wired by name in job classes. It seems this is not possible for controllers by default, probably ’cause controllers aren’t supposed to do this kind of stuff.

BTW, is there a way to get a controller method called from a job in grails?
And could this be such a bad practice to you (and why)?

Thanks in advance,
Luca

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:59:53+00:00Added an answer on May 20, 2026 at 2:59 am

    It’s bad practice because Controller is intended to handle web requests – with user session and everything.

    There is no user session in Quartz job.

    Second, keeping functionality in Controller is bad thing on its own – Controller should better only “control” invocations to other business logic method.

    I’d recommend you to move all the functionality to either a service, domain class or a POGO class in src.

    Of course, you can call new MyController().method(), but no beans will be injected into controller by default.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one grails application.In that I have one model class named Book. From
I'm attempting to debug a grails application and when I change controller code (method
My Grails application has a large number of enums that look like this: public
I need to use EJB remote calls from my grails application. For this in
how can i convert my grails application from http to https under Linux operating
In my grails application I want to read some values from properties file and
I started a grails application by grails create-app. For modularity, I feel like it
I'm working on a Grails application. There is a domain class participant - within
For our grails application, I've written a method that lets you upload a CSV
In my Grails application, I run some batch processes asynchronously, and would like the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.