سؤال

I have a situation where I need to declare the Grails Spring Security CAS plugin as a compile-time dependency like so (in my Grails app's BuildConfig.groovy):

plugins {
    // Other plugins omitted for brevity...

    compile ":spring-security-cas:1.0.5"
}

However, depending on logic that I don't have available to my app until runtime, I need to dynamically disable/re-enable the plugin on the fly, at runtime.

Is this possible to do? If so, how? If not, why?

هل كانت مفيدة؟

المحلول

In general the answer is no. There is nothing in Grails that allows you to express anything like "if a certain system property is set, completely disable some particular plugin". Grails plugins can do a lot of things that could not be undone or redone at runtime. For example, a plugin can modify web.xml at build time.

Plugins can be written such that they interrogate the environment at runtime and behave differently based on that, but that is up to the plugin author to have accounted for that. Some plugin behavior can also be modified at runtime by interacting with beans in the Spring application context. It really depends on the plugin and what kind of behavior you are trying to turn on and off.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top