Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <bean class="org.springframework.web.context.support.ServletContextAttributeExporter">
- <property name="attributes">
- <map>
- <entry key="jobbie" value-ref="springifiedJobbie"/>
- </map>
- </property>
- </bean>
- SpringifiedJobbie jobbie = (SpringifiedJobbie) getServletContext().getAttribute("jobbie");
- public class MyServlet extends HttpServlet {
- @Autowired
- private MyService myService;
- public void init(ServletConfig config) {
- super.init(config);
- SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
- config.getServletContext());
- }
- }
- WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
- SpringifiedJobbie jobbie = (SpringifiedJobbie)context.getBean("springifiedJobbie");
Add Comment
Please, Sign In to add comment