1. 程式人生 > >如何在spring quartz類中拿到ServletContext

如何在spring quartz類中拿到ServletContext

gets web.xml uart text eba web .get () list

ContextLoader.getCurrentWebApplicationContext().getServletContext()

web.xml裏加個:

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

如何在spring quartz類中拿到ServletContext