Ich verwende Federprofil in meinem mvc-Dispatcher-Servlet.xml. Aber Fehler bekommen:Fehler mit Federprofil in XML
Ich bin nicht andere Bohnen im Profil hinzufügen, wie ich diese in beiden Profil verwendet werden möchte. Brauchen Sie Hilfe, um den Fehler zu beheben. Unten ist mein XML und der Fehler kommt bei line- bean id = "transaction" class = "org.springframework.orm.hibernate5.HibernateTransactionManager"> :
<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"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- Specifying base package of the Components like Controller, Service,
DAO -->
<context:component-scan base-package="com.mycompany.saas.*" />
<!-- Getting Database properties -->
<context:property-placeholder location="classpath:db.properties" />
<!-- Getting Configuration properties -->
<!-- <context:property-placeholder location="classpath:config.properties"
/> -->
<mvc:annotation-driven />
<beans profile="default">
<!-- DataSource -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${database.driverClass}" />
<property name="jdbcUrl" value="${database.url}" />
<property name="user" value="${database.username}" />
<property name="password" value="${database.password}" />
<property name="acquireIncrement" value="${connection.acquireIncrement}" />
<property name="minPoolSize" value="${connection.minPoolSize}" />
<property name="maxPoolSize" value="${connection.maxPoolSize}" />
<property name="maxIdleTime" value="${connection.maxIdleTime}" />
</bean>
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> -->
<prop key="hibernate.default_schema">${hibernate.default_schema}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.connection.shutdown">true</prop>
</props>
</property>
<property name="packagesToScan" value="com.mycompany.saas.model"></property>
</bean>
</beans>
<beans profile="test">
<!-- DataSource -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${database.driverClass}" />
<property name="jdbcUrl" value="${database.url}" />
<property name="user" value="${database.username}" />
<!-- <property name="password" value="${database.password}" /> -->
<property name="acquireIncrement" value="${connection.acquireIncrement}" />
<property name="minPoolSize" value="${connection.minPoolSize}" />
<property name="maxPoolSize" value="${connection.maxPoolSize}" />
<property name="maxIdleTime" value="${connection.maxIdleTime}" />
</bean>
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.connection.shutdown">true</prop>
</props>
</property>
<property name="packagesToScan" value="com.mycompany.saas.model"></property>
</bean>
</beans>
<!-- Transaction -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="applicationContextProvder" class="com.mycompany.saas.util.ApplicationContextProvider" />
<bean id="mcSaasUserDAO" class="com.mycompany.saas.dao.mcSaasUserDAOImpl"></bean>
<bean id="mcUserService" class="com.mycompany.saas.service.mcUserServiceImpl"></bean>
<bean id="emailContentGenerator" class="com.mycompany.saas.notifier.mcEmailContentGenerator">
<constructor-arg value="classpath:/mail.html" />
</bean>
</beans>
Enthält die Nachricht eine Zeilen-/Spaltennummer? (IMMER die GESAMTE Nachricht und Stack-Trace enthalten, falls zutreffend). Wenn Sie eine Zeilen-/Spaltennummer haben, geben Sie in der XML-Datei an, wo sich diese befindet. –
Es kommt in Zeile
user3396729
@JimGarrison Frage aktualisiert – user3396729