zno2

加载 bean.xml 的几种方式 (java or web project)

1. java project

ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:bean1.xml","classpath:bean2.xml");

2. web project

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>WEB-INF/beans.xml</param-value>
    </context-param>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

3. Test

org.springframework spring-test

 

posted on 2016-08-06 08:05  zno2  阅读(253)  评论(0编辑  收藏  举报

导航