源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

JSP 获取Spring 注入对象示例

  • 时间:2022-09-20 22:42 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:JSP 获取Spring 注入对象示例
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@ page import="org.springframework.context.ApplicationContext"%>

ServletContext sc = this.getServletConfig().getServletContext();
ApplicationContext ac2 = WebApplicationContextUtils.getWebApplicationContext(sc);
要获取的对象 serv = (要获取的对象) ac2.getBean("spring配置文件中的id");
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部