Quartz Plugin

Wrong bean name for jobs - dependency injection not working

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 0.3.3
  • Fix Version/s: 1.0-RC
  • Component/s: None
  • Labels:
    None

Description

Job bean names are wrong. E.g. the class MyJob leads to a bean named "MyJob" instead of "myJob". This differs from convention and it makes dependency injection by name impossible. For injecting the job into another bean, you would have to define a property like "def MyJob" instead of "def myJob", but this does not work because grails treats this as a class, not a variable name.
So quartz job beans should start with a lowercase character.

Activity

Hide
Soenke Sothmann added a comment -

When you put a job into a package, the bean name of the job is the full qualified class name.
So if you put Job "MyJob" into a package "com.mypackage", the bean name will be "com.mypackage.MyJob".
It should be "myJob".

Show
Soenke Sothmann added a comment - When you put a job into a package, the bean name of the job is the full qualified class name. So if you put Job "MyJob" into a package "com.mypackage", the bean name will be "com.mypackage.MyJob". It should be "myJob".
Hide
Sergey Nebolsin added a comment -

Could you please explain the usecase of autowiring the job into another bean? I'm just curious. Jobs are not singletons, and new instance of the job class is created for every execution, so dependency injection looks not so useful in this case.

Show
Sergey Nebolsin added a comment - Could you please explain the usecase of autowiring the job into another bean? I'm just curious. Jobs are not singletons, and new instance of the job class is created for every execution, so dependency injection looks not so useful in this case.
Hide
Sergey Nebolsin added a comment -

I still don't see any reason to inject a job class into some other class. What about conventions ? Grails controllers and taglibs also follow this bean naming pattern (like my.package.TestContoller, my.package.TestTagLib since they are not supposed to be injected into other classes by name.

Please, feel free to reopen the ticket if you have some objections.

Show
Sergey Nebolsin added a comment - I still don't see any reason to inject a job class into some other class. What about conventions ? Grails controllers and taglibs also follow this bean naming pattern (like my.package.TestContoller, my.package.TestTagLib since they are not supposed to be injected into other classes by name. Please, feel free to reopen the ticket if you have some objections.

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: