如何在spring quartz类中拿到ServletContext

ContextLoader.getCurrentWebApplicationContext().getServletContext()

web.xml里加个:

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>  
posted @ 2018-10-10 11:41  星朝  阅读(153)  评论(0编辑  收藏  举报