spring - How to access the ServletContext in resources.groovy for Grails 3? -


i need define several beans spring , configure beans need access servletcontext. in grails 2.x had code like

beans = {     ...     dataprovider(dataprovider) {         def context = servletcontextholder.getservletcontext()         // use context configure bean     }     ... } 

however in grails 3.x (3.1.10 specific), context variable null. if there place other resources.groovy file accomplish this, that's fine too.

i use

def context = application.maincontext.servletcontext 

Comments