Bonjour,
Je suis en spring 2.5 et je souhaite utiliser un fichier de properties pour initialiser des attributs de mes beans j'ai donc trouvé un bout de code avec un PropertyPlaceholderConfigurer qui devait résoudre mon problème en toute simplicité ... le seul soucis c'est que cette méthode ne fonctionne pas.
Il trouve bien mon fichier de properties, il semble bien trouvé les valeurs : pcp01_ejb_ref_moe et pcp01_ejb_ref_prod mais dans mon bean pour ces valeurs je retrouve null.
Auriez vous une idée ?
Merci d'avance
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 <?xml version="1.0" encoding="UTF-8"?> <!-- - Contexte d'application pour spring-mvc-webapp. --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <!-- Le view resolver --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" /> <!-- Pour l'accès au fichier de propriété --> <bean name="propertyPlaceholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations" value="classpath:chaineDocument.properties"/> </bean> <!-- Les beans controllers --> <bean name="/chaineDocument.html" class="fr.xxx.chaineDocument.ChaineDocumentController" /> <!-- Les beans de la couche service --> <bean id="chaineDocumentService" class="fr.xxxx.chaineDocument.services.ChaineDocumentService"> <property name="refJNDIMOE" value="${pcp01_ejb_ref_moe}"/> <property name="refJNDIProd" value="${pcp01_ejb_ref_prod}"/> </bean>
Partager