2019独角兽企业重金招聘Python工程师标准>>>

import org.springframework.web.context.WebApplicationContext;public class ServicesSingleton {private WebApplicationContext servletContext;private static ServicesSingleton instance = null;protected ServicesSingleton() {}public static ServicesSingleton getInstance() {if (instance == null)instance = new ServicesSingleton();return instance;}public WebApplicationContext getServletContext() {return servletContext;}public void setServletContext(WebApplicationContext servletContext) {this.servletContext = servletContext;}
}
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.context.WebApplicationContext;public class InitServlet extends HttpServlet {@SuppressWarnings("resource")@Overridepublic void init() throws ServletException {/*WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());ServicesSingleton.getInstance().setServletContext(ctx);*/ApplicationContext context =new ClassPathXmlApplicationContext("classpath:META-INF/spring/*-context.xml");}
}
<servlet><servlet-name>initServlet</servlet-name><servlet-class>**.**.InitServlet</servlet-class><load-on-startup>0</load-on-startup></servlet>

转载于:https://my.oschina.net/reachwang/blog/288542

sap服务器应用webservice加载spring的机制问题相关推荐

  1. 通过ApplicationContextAware加载Spring上下文环境

    项目用到了ApplicationContextAware,通过它Spring容器会自动把上下文环境对象调用ApplicationContextAware接口中的setApplicationContex ...

  2. 手动加载spring, ApplicationContext怎么销毁

    手动加载spring, ApplicationContext怎么销毁 AbstractApplicationContext context = new ClassPathXmlApplicationC ...

  3. java spring包_java 自定义加载器,加载spring包,动态加载实现,jar包隔离,tomcat加载webapp方式...

    java 自定义加载器,加载spring包,动态加载实现,jar包隔离,tomcat加载webapp方式 发布时间:2018-08-20 12:02, 浏览次数:774 , 标签: java spri ...

  4. Web.xml配置详解之context-param (加载spring的xml,然后初始化bean看的)

    http://www.cnblogs.com/goody9807/p/4227296.html(很不错啊) 容器先加载spring的xml,然后初始化bean时,会为bean赋值,包括里面的占位符 转 ...

  5. 架设KMS服务器流程启动加载方法

    架设KMS服务器流程 启动加载方法 架设KMS服务器流程--启动加载方法 以下操作 root 一.准备Centos服务器CentOS-8.4.2105 1.下载http://mirrors.163.c ...

  6. SpringBoot加载spring.factories的价值

    SpringBoot加载spring.factories的价值 在springboot的各个依赖包下,我们经常看到META-INF/spring.factories这个文件.spring.factor ...

  7. K8s 集群使用 ConfigMap 优雅加载 Spring Boot 配置文件

    文章目录 1.Spring Boot 加载配置介绍 2.环境.软件准备 3.Spring Boot 示例工程 Demo 4.K8s ConfigMap 加载工程配置文件 4.1.直接加载环境的配置文件 ...

  8. 手动加载spring配置文件

    更多Java架构师核心资料持续更新中https://github.com/kepeihong/data.git,内推阿里请查看链接 手动加载Spring配置文件有两个类,分别是ClassPathXml ...

  9. aws ena模块加载_在AWS上全自动实时重新加载Spring Boot应用程序

    aws ena模块加载 在这篇文章中,我们将研究Spring Boot的最佳机密之一: Spring Boot DevTools . 尽管可以在本地计算机上进行测试,但在与生产环境尽可能相似的环境中开 ...

最新文章

  1. 史上更全面的数据库分库分表、数据一致性、主键分配思路!
  2. 9.Spring Security添加记住我功能
  3. 年轻人对于“绰号”的认识
  4. 第六届上海市大学生网络安全大赛 | Wp
  5. 对 cas 操作的理解
  6. Dotnet Core下的Channel, 你用了吗?
  7. 让Sql Server也能出现如VS一样的智能提示工具--资源更新
  8. 读取csv格式的数据
  9. python动力学仿真_python滑坡动力学
  10. SpringBoot项目优雅的http客户端工具,太香了!
  11. HTML+CSS网页制作——恒德电子
  12. python删除重复文件
  13. Aria2+motrix设置教程
  14. 华为鸿蒙的三大遗憾和一个好消息
  15. 中文字号和磅数的联系
  16. 渗透测试思路 - 工具篇
  17. 第三方开源项目名称_开源名称中有什么?
  18. win10本地组策略功能说明
  19. 股票自选股基本函数大全-7
  20. 让eclipse有像vs2005一样的智能感知能力

热门文章

  1. 如何破解Red Hat Enterprise 4的root密码(救援有密码)
  2. [学习笔记]最小圆覆盖
  3. 被神话的大数据——从大数据(big data)到深度数据(deep data)思维转变
  4. linux文本编辑器vim的基本使用
  5. 【翻译】CEDEC2012 SQUARE ENIX GPGPU实现高速GI烘培工具的方法
  6. flash里alert
  7. DKHadoop人力资源大数据解决方案架构
  8. util类中非静态方法中注入serivce,在controller层是使用util。
  9. android的五大布局(layout)
  10. windows共享wifi