Bonjour,
je suis en train de suivre l'excellent tuto de Serge Tahé "Persistance Java 5 par la pratique".
J'ai pu suivre les premières parties sur les entités JPA sans trop de problème et j'en suis à ce qui m'intéresse réellement : l'utilisation de JPA dans une architecture multicouche.
Mon problème arrive à la configuration des couches, notamment avec le fichier spring-config.xml suivant :
J'ai vérifié plusieurs fois, bien que retapé à la main pour bien comprendre l'ensemble, ce fichier correspond bien à celui du tuto.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <!-- Couches applicatives --> <bean id="dao" class="dao.Dao"/> <bean id="service" class="service.Service"> <property name="dao" ref="dao" /> </bean> <!-- Couche de persistance JPA --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdaptater"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <!-- <property name="showSql" value="true"/> --> <property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect"/> <property name="generateDdl" value="true"/> </bean> </property> <property name="loadTimeWeaver"> <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/> </property> </bean> <!-- la source de données DBCP --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/jpa" /> <property name="username" value="jpa" /> <property name="password" value="jpa" /> </bean> <!-- Le gestionnaire de transaction --> <tx:annotation-driven transaction-manager="txManager"/> <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <!-- Traduction des exceptions --> <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /> <!-- annotations de persistance --> <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/> </beans>
Sauf que ce fichier génère trois erreurs :
Mes recherches sur le web n'ont pas été franchement fructueuses : j'ai trouvé quelques problèmes similaires mais sans trouver de solution...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 No setter found for property 'dataSource' in class 'org.springframework.orm.jpa.LocalEntityManagerFactoryBean' spring-config.xml /tuto_JPA-spring1/src line 17 Spring Beans Problem No setter found for property 'jpaVendorAdaptater' in class 'org.springframework.orm.jpa.LocalEntityManagerFactoryBean' spring-config.xml /tuto_JPA-spring1/src line 18 Spring Beans Problem No setter found for property 'loadTimeWeaver' in class 'org.springframework.orm.jpa.LocalEntityManagerFactoryBean' spring-config.xml /tuto_JPA-spring1/src line 27 Spring Beans Problem
voici l'arborescence du projet :
manque-t-il un jar pour que tout marche bien? j'ai bien ceux correspondants au tuto de serge Tahé, mais avec les nouvelles version peut-être me manque-t-il une dépendance?
Toute aide serait la bienvenue, merci d'avance![]()
Partager