|
@@ -5,13 +5,14 @@
|
|
|
<!--配置Bean-->
|
|
|
<!-- <bean id="bookDao" class="org.starter.learning.dao.impl.BookDaoImpl" />-->
|
|
|
<!--配置方式2:工厂模式-->
|
|
|
- <bean id="bookDao" class="org.starter.learning.factory.BookDaoFactory" factory-method="getBookDao" />
|
|
|
+<!-- <bean id="bookDao" class="org.starter.learning.factory.BookDaoFactory" factory-method="getBookDao" />-->
|
|
|
<!-- 配置方式3:实例工厂模式 -->
|
|
|
<!-- 将实例工厂本身实例化 -->
|
|
|
- <bean id="bookServiceFactory" class="org.starter.learning.factory.BookServiceFactory" />
|
|
|
+<!-- <bean id="bookServiceFactory" class="org.starter.learning.factory.BookServiceFactory" />-->
|
|
|
<!-- 通过工厂本身来创建对象 -->
|
|
|
- <bean id="book" factory-bean="bookServiceFactory" factory-method="getBookService" />
|
|
|
-
|
|
|
+<!-- <bean id="book" factory-bean="bookServiceFactory" factory-method="getBookService" />-->
|
|
|
+ <!-- 配置方式4:FactoryBean方式实例化 -->
|
|
|
+ <bean id="bookDao" class="org.starter.learning.factory.BookDaoFactoryBean" />
|
|
|
<bean id="bookService" class="org.starter.learning.service.impl.BookServiceImpl">
|
|
|
<!--配置Service和Dao之间的关系-->
|
|
|
<!--property标签表示配置当前bean的属性-->
|