Grails run-command ask for application class argument

Viewed 329

I'm using grails 3.2.9 version. And trying to create custom command. I need a command because I need to have access to spring beans. So the code is simply like this:

class MyTestCommand implements GrailsApplicationCommand {

boolean handle() {
    def bean = applicationContext.getBean('myBean')
    bean.doSomething()
    return true
}

When I run it as

grails run-command my-test

I'm getting an error: "Missing application class name and script name arguments" I'am able to add application class as last param and everything seems works, but the question is, why I should add it? Does grails doesn't know about its Main Application class? I did some research about and there is no answers, in each examples i se only command name without Application class. But as I understand from this source we should pass main class always. Am I missed something?

0 Answers
Related