简体   繁体   中英

Does Grails 3.3.0 support interceptors in plugins?

I created a Grails plugin which is used by my Grails app. I created an interceptor "TestInterceptor" in grails-app/controllers in the plugin. I used 'grails install' to install the plugin to my local maven repository.

When I run the app, the interceptor is not invoked.

When I examine the generated META-INF/grails-plugin.xml within my plugin JAR, the interceptor is not present. Other artefact types (services, controllers, domains) are present in grails-plugin.xml.

If I move the interceptor to my app, it gets invoked.

Does Grails 3.3.0 support interceptors in plugins? If so, what steps do I need to take to get the plugin to publish the interceptor so it gets loaded by my app?

I found another plugin in github with an interceptor and identified that my plugin was missing a required dependency in build.gradle. Namely, org.grails:grails-plugin-interceptors.

This seems obvious now, though I can't say why my plugin was missing that dependency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM