IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

externaliser les propriétés


Sujet :

Spring Java

  1. #1
    Débutant
    Inscrit en
    Février 2003
    Messages
    54
    Détails du profil
    Informations forums :
    Inscription : Février 2003
    Messages : 54
    Points : 35
    Points
    35
    Par défaut externaliser les propriétés
    Bonjour,

    J'ai configuré mon fichier spring comme cela :
    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
    53
    54
    55
    <beans>
    
    
    	<!-- JNDI DataSource for J2EE environments -->
    	<bean id="dataSource"
    		class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName">
    			<value>java:comp/env/jdbc/OSWorkflowPool</value>
    		</property>
    	</bean>
    
    	<bean id="propertyConfigurer"
    		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="location" value="/WEB-INF/classes/osworkflow.properties" />
    	</bean>
    	
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
    		<property name="dataSource" ref="dataSource" />
    		<property name="mappingResources">
    			<list>
    				<value>
    					com/opensymphony/workflow/spi/hibernate/HibernateCurrentStep.hbm.xml
    				</value>
    				<value>
    					com/opensymphony/workflow/spi/hibernate/HibernateHistoryStep.hbm.xml
    				</value>
    				<value>
    					com/opensymphony/workflow/spi/hibernate/HibernateWorkflowEntry.hbm.xml
    				</value>
    				<value>
    					com/opensymphony/workflow/spi/hibernate/WorkflowDescriptor.hbm.xml
    				</value>
    				<value>
    					com/opensymphony/user/provider/hibernate/entity/HibernateGroup.hbm.xml
    				</value>
    				<value>
    					com/opensymphony/user/provider/hibernate/entity/HibernateUser.hbm.xml
    				</value>
    				<value>
    					com/opensymphony/module/propertyset/hibernate/PropertySetItemImpl.hbm.xml
    				</value>
    			</list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">
    					net.sf.hibernate.dialect.MySQLDialect
    				</prop>
    				<prop key="hibernate.show_sql">${hibernateShowSQL}</prop>
    				<prop key="hibernate.hbm2ddl.auto">create-update</prop>
    			</props>
    		</property>
    	</bean>
    J'ai créer un fichier osworkflow.properties inclu dans le dossier web-inf/classes de mon appli.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    spring-workflowsXML=spring-workflows.xml
    hibernateShowSQL=true
    quand je met directement true dans mon fichier de config spring, j'ai bien le résultat que je souhaite, mais quand je fais la liaison avec mon fichier properties comme ci-dessus, ca ne fonctionne pas ... Je ne comprend vraiment pas pourquoi ... quelqu'un a une idée ?

    Merci

  2. #2
    Futur Membre du Club
    Profil pro
    Inscrit en
    Août 2006
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 4
    Points : 5
    Points
    5
    Par défaut
    essaye de remplacer :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <bean id="propertyConfigurer"
    		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="location" value="/WEB-INF/classes/osworkflow.properties" />
    	</bean>
    par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    <bean id="propertyConfigurer"
    		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="location" value="classpath:osworkflow.properties" />
    	</bean>

Discussions similaires

  1. [Maven2] Externaliser les propriétés
    Par romaintaz dans le forum Maven
    Réponses: 6
    Dernier message: 31/07/2007, 16h52
  2. Réponses: 4
    Dernier message: 29/11/2004, 16h51
  3. Comment retrouver les propriétés d'un fichier ?
    Par JuanLopez1966 dans le forum x86 32-bits / 64-bits
    Réponses: 1
    Dernier message: 01/09/2004, 16h34
  4. Informations sur un exe (dans les propriétés windows)
    Par SteelBox dans le forum Windows
    Réponses: 6
    Dernier message: 06/07/2004, 18h20
  5. [VBA] Les propriétés de cellule dans Excel
    Par Kylen dans le forum API, COM et SDKs
    Réponses: 6
    Dernier message: 05/07/2004, 23h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo