问题一、项目中的properties配置文件,路径前的file、classpath是什么意思?在UNIX系统和Windows系统中有什么区别?
问题二、spring中classpath和classpath*的配置区别
问题三、有classpath与无classpath的区别
问题四、两种写法的区别
<!-- context:property-placeholder location="classpath*:*.properties"/-->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" id="propertyConfigurer">
<property name="locations">
<list>
<value>*.properties</value>
</list>
</property>
</bean>
问题五、
<span style="white-space:pre"> </span>ApplicationContext ctx = new ClassPathXmlApplicationContext(<code class="string" style="font-size: 1em !important; line-height: 1.1em !important; margin: 0px !important; padding: 0px !important; border: 0px !important; vertical-align: baseline !important; color: blue !important; outline: 0px !important; float: none !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; direction: ltr !important; display: inline !important;">"classpath:/applicationContext.xml"</code><code class="plain" style="font-size: 1em !important; line-height: 1.1em !important; margin: 0px !important; padding: 0px !important; border: 0px !important; vertical-align: baseline !important; outline: 0px !important; float: none !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; direction: ltr !important; display: inline !important;">);</code>
System.out.println(ctx.getClassLoader().getResource(
""
).getPath());
问题六、ant构建的启动方式
与spring容器配置实例化容器,用构造函数或bean的init-method方法启动
(详细见问题六)
问题七、
1、java项目通过这种方法实例化spring容器:
String conf = "applicationContext.xml";
AbstractApplicationContext ac = new ClassPathXmlApplicationContext(conf);
AbstractApplicationContext ac = new ClassPathXmlApplicationContext(conf);
2、web项目通过这种方法实例化spring容器:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
3、ant构建的项目间接的通过1方法实现spring容器的实例化:
执行一个main方法,main方法通过1中的方法实例化spring容器。
问题八、
1、注意spring组件加载的顺序,init-method,构造方法等尽量往后放;
2、Persistent在mq中是指启动mq服务前后是否保留