Spring 自动装配的问题
<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.0.xsd" default-autowire="no">
<bean id="testService" class="com.ipi.service.impl.TestServiceImpl" autowire="no">
<property name="testDao" ref="testDao"></property>
</bean>
<bean id="testDao" class="com.ipi.dao.impl.TestDaoImpl">
</bean>
<bean id="sfid"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean></beans>
这里
default-autowire="no"
我已经禁用了自动装配 为什么 student = testService.test(); 这里的testService 还是会自动的初始化 ,怎么才能禁用自动注入啊??
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.0.xsd" default-autowire="no">
<bean id="testService" class="com.ipi.service.impl.TestServiceImpl" autowire="no">
<property name="testDao" ref="testDao"></property>
</bean>
<bean id="testDao" class="com.ipi.dao.impl.TestDaoImpl">
</bean>
<bean id="sfid"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean></beans>
这里
default-autowire="no"
我已经禁用了自动装配 为什么 student = testService.test(); 这里的testService 还是会自动的初始化 ,怎么才能禁用自动注入啊??
...全文
相关推荐
autowiring-bug-boot:带有有限泛型的服务的Spring Boot自动装配问题
自动接线错误引导 带有有限泛型的服务的Spring Boot自动装配问题
Spring 自动装配的二义性实例解析
主要介绍了Spring 自动装配的二义性实例解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
Spring自动装配Bean实现过程详解
主要介绍了Spring自动装配Bean实现过程详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
Spring实现自动装配
本项目为Java项目,使用Spring实现自动装配,根据类型方式实现自动装配。适合初学者了解Spring不同装配方式。
spring中的自动装配实例byName、byType
spring中的自动装配实例byName、byType,两种装配方式的实例。有需要学习的朋友可以看一下。


Web 开发
