您的位置:首页 > 编程语言 > Java开发

spring2.5搭建环境

2011-08-02 20:38 344 查看
降低组建之间的解哦
控制事务
提供单例模式
AOP面向切面
辅助类
对主流框架支持

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="personService" class="net.itdos.service.impl.PersonServiceBean"></bean>

</beans>


ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
PersonService personService = (PersonService)ctx.getBean("personService");
personService.save();


对配置文件读取

反射实例化bean

三种实例化方式

1调用默认构造器

2静态工厂

3实例工厂
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: