在jsp里, 调用容器,使用sevice

  • jsp获取spring容器
<%

ServletContext sc = this.getServletConfig().getServletContext();
ApplicationContext ac2 = WebApplicationContextUtils.getWebApplicationContext(sc);

RedisService redisService=(RedisService)ac2.getBean("redisService");

%>
  • service demo

@Service("redisService")

你可能感兴趣的:(springbootjsp)