求教spring小白问题
饼饼也是饼 2014-09-17 11:48:39 各位大神,
<bean id="zsgltj.zsgltjService" class="com.wiscom.app.gzgz.zsgltj.service.impl.ZsgltjServiceImpl">
<property name="dataSource" ref="dataSource" />
<property name="dataService" ref="dataService" />
</bean>
这是一个配置文件里的 ,然后在另外一个配置文件的bean里引用了这个bean
<bean id="viewController" class="com.wiscom.app.gzgz.zsgltj.controller.ZsdqfxViewDBController" parent="fusionChartQueryController">
<property name="viewName" value="zsgltj/dbfx/zsdqfx/view" />
<property name="zsgltjService" ref="zsgltj.zsgltjService"/>
</bean>
然后在 class文件直接 写 private ZsgltjService zsgltjService;
就会自动去取 zsgltj.zsgltjService 的实例吗 ?
不需要 用
ClassPathXmlApplicationContext applictionContext = new ClassPathXmlApplicationContext("beans.xml");
ZsdqfxViewDBController service2 = (ZsdqfxViewDBController) applictionContext.getBean("zsgltj.zsgltjService");
去new他的实例吗 ?我看项目里 直接在class文件里就直接能用zsgltjService.xxx()方法吗 ?