写了一个Spring的Demo加入一个log4j的属性文件,运行时弹出了一个LogFactor5的窗口,LogFactor5是一个方便查看日志的工具,但是再用一个Demo来测试情况不一样,没有弹出了一个LogFactor5的窗口,但对程序并无影响,若哪位大神能够帮忙分析再好不过了。
(1)
public class HelloSpring {
private String helloSpring;
public String getHelloSpring() {
return helloSpring;
}
public void setHelloSpring(String helloSpring) {
this.helloSpring = helloSpring;
}
}
(2)
public class SpringTest {
public static void main(String[] args){
Resource rs = new ClassPathResource("applicationContext.xml");
BeanFactory bf = new XmlBeanFactory(rs);
HelloSpring hello = (HelloSpring)bf.getBean("helloSpring");
System.out.println(hello.getHelloSpring());
}
}
(3)
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="helloSpring" class="com.rkb.spring.HelloSpring">
<property name="helloSpring">
<value>study Spring...</value>
</property>
</bean>
</beans>
图一:
图二: