I have a Grails 2.4.4 app. In it I have the following controllers:
myapp/
grails-app/
controllers/
fizzbuzz/
FizzController.groovy
BuzzController.groovy
... many others, etc.
I want to create Grails Filters for some of these, so I create a grails-app/conf/WidgetFilters.groovy
class:
class WidgetFilters {
def filters = {
fizzFilter(controller: 'fizz*', action: '*') {
before = {
println 'I intercepted a called to the Fizz Controller!'
}
}
buzzFilter(controller: 'buzz*', action: '*') {
before = {
println 'I intercepted a called to the Buzz Controller!'
}
}
}
}
When I start my app up and go to any Fizz/Buzz actions, I do not see the println
. I've also tried other logging statements (SLF4J) and put other code inside the before
closure and am 100% convinced they are not executing. Have I done something obviously wrong?
Did you tried to restart app + clean build?
I've copy-pasted your filters and mock controllers and they're working, here is a code.
Please check out also this properties :
将课程移至grails-app/conf
。
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.