乐趣区

关于springboot:在jsp里-调用容器使用sevice

  • jsp 获取 spring 容器
<%

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

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

%>
  • service demo

@Service(“redisService”)

退出移动版