grails-core icon indicating copy to clipboard operation
grails-core copied to clipboard

Support for custom GrailsPluginManager in GrailsAutoConfiguration

Open rainboyan opened this issue 2 years ago • 0 comments

Feature description

Currently, DefaultGrailsPluginManager was hardcoded in GrailsApplicationPostProcessor. Grails has a ProfilingGrailsPluginManager, I want to use it for testing performance, but I can't.

    GrailsApplicationPostProcessor(GrailsApplicationLifeCycle lifeCycle, ApplicationContext applicationContext, Class...classes) {
        this.lifeCycle = lifeCycle
        if(lifeCycle instanceof GrailsApplicationClass) {
            this.applicationClass = (GrailsApplicationClass)lifeCycle
        }
        else {
            this.applicationClass = null
        }
        this.classes = classes != null ? classes : [] as Class[]
        grailsApplication = applicationClass != null ? new DefaultGrailsApplication(applicationClass) : new DefaultGrailsApplication()
        pluginManager = new DefaultGrailsPluginManager(grailsApplication)
        if(applicationContext != null) {
            setApplicationContext(applicationContext)
        }
    }

Also, I'm going to extend the Grails Plugins with some new methods that require a custom GrailsPluginManager to use it. Although there are some ways to achieve the goal, but not the best way. If Grails could provide this capability, it would bring more flexibility.

It is not complicated to realize this ability. If you also have such usage scenarios, we can discuss it together.

rainboyan avatar May 29 '22 11:05 rainboyan