Grails 3 call taglib from a service
问题 I'm trying to use grails internal taglib from a service but I receive this error: No signature of method: MyService.message() is applicable for argument types: (java.util.LinkedHashMap) values: [[code:default.app.name]] This is the code I'm using: class MyService { def myMethod() { def appName = message(code: 'default.app.name') } } 回答1: Grails 3 The solution is to inject the grailsApplication object and use its context to get the taglib bean: class MyService { def grailsApplication def