在Grails中初始化过滤器

时间:2018-02-02 17:28:10

标签: grails

我正在运行Grails 2.3.3并引入了一个过滤器:

@include

当我使用run-app构建时,我收到此错误:

class HvFilters {

   def HvLoginDetailsService

   def filters = {
      all(controller:'*', action:'*') {
         before = {
         }
         after = { Map model ->
            model.myLoginDetails = HvLoginDetailsService.myLoginDetails()
         }
      }
   }
}

我已经查看了有关此GrailsContextLoader错误的各种帖子等等 - 所有迹象都表明需要在Bootstrap中初始化过滤器 - 我有一个去但仍然得到相同的错误:

2018-02-01 15:54:38,710 [localhost-startStop-1] ERROR context.GrailsContextLoader  - 
Error initializing the application: Method on class [homevu1.HvFilters] was 
used outside of a Grails application. 

0 个答案:

没有答案