2016-06-01 1 views
2

J'émigre un projet qui a utilisé xml pour la cartographie de printemps démarrage(.java fichier)Modifier la configuration du xml au printemps démarrage

Comment dois-je aller à ce sujet? Voici la configuration xml Jackrabbit ...

<bean id="repository" class="org.springframework.jndi.JndiObjectFactoryBean"> 
    <property name="jndiName" value="java:comp/env/jcr/myRepository"/> 
</bean> 

<bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory"> 
    <property name="repository" ref="repository" /> 
    <property name="credentials"> 
     <bean class="javax.jcr.SimpleCredentials"> 
     <constructor-arg index="0" value="admin" /> 
     <!-- create the credentials using a bean factory --> 
     <constructor-arg index="1"> 
      <bean factory-bean="password" factory-method="toCharArray" /> 
     </constructor-arg> 
     </bean> 
    </property> 
</bean> 

    <!-- create the password to return it as a char[] --> 
    <bean id="password" class="java.lang.String"> 
    <constructor-arg index="0" value="admin" /> 
    </bean> 

    <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate"> 
    <property name="sessionFactory" ref="jcrSessionFactory" /> 
    <property name="allowCreate" value="true" /> 
    </bean> 

<Resource name="jcr/myRepository" 
    auth="Container" 
    type="javax.jcr.Repository" 
    factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory" 
    configFilePath="D:/DMSRepo/repositoryFactlive.xml" 
    repHomeDir="D:/DMSRepo/factlivetrialVersion2/repo"/> 
+0

Petit int 'class' référence une classe ... Ces choses que vous pouvez créer avec' new'. Commence avec ça. –

Répondre

2

D'abord, vous devez créer un fichier de classe de configuration à l'aide @Configuration et importer votre fichier .xml en utilisant @ImportResource comme ceci: -

@Configuration 
@ImportResource("classpath:dmsRepository.xml") 
public class JackRabbitRepository { 

} 

Ensuite, vous devez conserver le contenu de votre ressource dans le fichier server.xml car il ne fonctionnera pas dans votre fichier XML actuel. Après cela, votre configuration de JackRabbit est terminée. Ensuite, faites ce que vous voulez faire dans DMS.