[spring] comment referencer un bean existant dans applicationContext.xml
bonjour,
si qlq un a une idée sur la source de ce prb ca vas vraiment me débloqué.
j ai un bean servive ds le fichier applicationContext.xml que j utilise dans un autre fichier test1-servlet.xml , qd lance la page d acceuil de mon application j ai ce message :
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'Personnes.ListController'
defined in ServletContext resource [/WEB-INF/test1-servlet.xml]:
Cannot resolve reference to bean 'service'
while setting bean property 'service'
exception is org.springframework.beans.factory.NoSuchBeanDefinit
ionException: No bean named 'service' is defined
je vois pas comment faire pour ajouter applicationContext.xml ds la classpath du projet pour l exploiter ds test1-servlet.xml!!!!:cry:Merci pour votre aide
le fichier applicationContext.xml
<?xml version="1.0" encoding="ISO_8859-1"?>
<!--Ce fichier est exploité par le listener [ContextLoaderListener] avant même que [DispatcherServlet] ne soit instancié.-->
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| <!DOCTYPE beans SYSTEM "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>org.firebirdsql.jdbc.FBDriver</value>
</property>
<property name="url">
<!-- attention : ne pas laisser d'espaces entre les deux balises <value> -->
<value>jdbc:firebirdsql:localhost/3050:C:\Documents and Settings\Stage\Bureau\database\DBPERSONNES.GDB</value>
</property>
<property name="username">
<value>sysdba</value>
</property>
<property name="password">
<value>masterkey</value>
</property>
</bean>
<bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource"><!--[DataSource] connecté à la base de données-->
<ref local="dataSource"/>
</property>
<property name="configLocation"><!--fichier de configuration où sont externalisés les ordres SQL à exécuter-->
<value>classpath:sql-map-config-firebird.xml</value>
</property>
</bean>
<!-- la classes d'accès à la couche [dao] -->
<bean id="dao" class="code.dao.DaoImplCommon">
<property name="sqlMapClient">
<ref local="sqlMapClient"/>
</property>
</bean>
<!-- gestionnaire de transactions -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref local="dataSource"/>
</property>
</bean>
<!-- la classes d'accès à la couche [service] page 35 -->
<bean id="service"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="target">
<bean class="code.service.ServiceImpl">
<property name="dao">
<ref local="dao"/>
</property>
</bean>
</property>
<property name="transactionAttributes">
<!--indique quelles méthodes de [ServiceImpl] nécessitent une transaction et quels sont les attributs de celle-ci-->
<props>
<prop key="get*">PROPAGATION_SUPPORTS,readOnly</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
</beans> |