class Application extends GrailsAutoConfiguration {
    @Override
    Closure doWithSpring() {
        {->
            mySpringBean(MyType)
        }
    }
    ...
}4.2.3 The Application LifeCycle
Version: 3.3.2
4.2.3 The Application LifeCycle
The Application class also implements the GrailsApplicationLifeCycle interface which all plugins implement.
This means that the Application class can be used to perform the same functions as a plugin. You can override the regular plugins hooks such as doWithSpring, doWithApplicationContext and so on by overriding the appropriate method: