简体   繁体   中英

AfterInterceptor does not work in Grails 3.0.1 anymore

I noticed that afterinterceptor does not work in Grails 3.0.1 controllers anymore. The same code works in Grails 2.4.4. Here is my controller code:

class TestAfterInterceptController {

    def afterInterceptor = { model, modelAndView ->
        println "##################################################"
        println "Current view is ${modelAndView.viewName}"
    }

    def index() {
        println "##################################################"
        render 'Hello world'
    }
}

when I call the controller with http://localhost:8080/testAfterIntercept , it completely ingnores the after interceptor method and it only prints what is in the index() method.

controller level interceptors have not been implemented in Grails 3.0 since we have the new Interceptor type. See http://grails.github.io/grails-doc/latest/guide/theWebLayer.html#interceptors

If there is enough demand we will restore controller level interceptors.

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