【spring框架】beans.xml规范与ClassPathXmlApplicationContext
1.beans.xml规范: (由于以后用到其他标签会添加很多规范,这里只给出基础的规范) <?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="u" class="com.bjsxt.dao.impl.UserDAOImpl"> </bean> <bean id="userService" class="com.bjsxt.service.UserService"> <property name="userDAO" ref="u" /> </bean> </beans> 2.ClassPathXmlApplicationContext类介绍 ClassPathXmlApplicationContext这个类实现了BeanFactory、ApplicationContext等接口。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |