spring容器启动方式
程序员文章站
2022-07-14 08:49:21
...
什么时候spring容器启动?
其实就是程序中执行加载 xml配置文件的时候
1.应用程序下加载
2.web模式下加载
其实就是程序中执行加载 xml配置文件的时候
1.应用程序下加载
ApplicationContext ctx = new ClassPathXmlApplicationContext("testspring2.xml");
2.web模式下加载
web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-hibernate-mysql.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
上一篇: 补码的理解(-128的补码解释)