Can I inject a service into a filter in Grails?

后端 未结 3 1207
不思量自难忘°
不思量自难忘° 2021-02-14 15:32

I have a service to get and set the user in the session. I would like to pass in some user information to each view if there is a logged in user and thought a filter would be th

3条回答
  •  醉酒成梦
    2021-02-14 16:04

    It looks like there are some problems with services in filters. This bug might point you in the right direction: https://jira.grails.org/browse/GRAILS-5982

    You can also try to get a reference to your service through the ApplicationContext. Here's an example: How do I get an instance of a Grails service programmatically?

提交回复
热议问题