如何在spring quartz类中拿到ServletContext

ContextLoader.getCurrentWebApplicationContext().getServletContext()

web.xml里加个:

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>  

猜你喜欢

转载自www.cnblogs.com/jpfss/p/9765500.html