Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Java tools & IDE's > Конфликт бинов в STS в Spring MVC.


Автор: neo03 31.1.2013, 10:18
Привет всем! Читаю книгу Prospring3 Кларенса Хо и Роба Харропа. Дошел до главы16. Там говрится про использование удаленной обработки и рассматривается проект Spring MVC Project. В конфигурационном файле datasource-tx-jpa.xml когда вставляю тег <jpa:repositories base-package="com.apress.prospring3.ch16.repository" entity-manager-factory-ref="emf" transaction-manager-ref="transactionManager"/>, то появляется красная точка и он говорит, что произошел конфликт бинов. Все зависимости, которые есть в книге, я подключил.Если сталкивался, подскажите. Спасибо всем. Вот файл datasource-tx-jpa.xml:
<?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:context="http://www.springframework.org/schema/context"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd&quot;&gt;
    <jdbc:embedded-database id="dataSource" type="H2">
        <jdbc:script location="classpath:schema.sql"/>
        <jdbc:script location="classpath:test-data.sql"/>
    </jdbc:embedded-database>
    
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="emf"/>
    </bean>
    
    <tx:annotation-driven transaction-manager="transactionManager" />

    <bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
        </property>
        <property name="packagesToScan" value="com.apress.prospring3.ch16.domain"/>
        <property name="jpaProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
                <prop key="hibernate.max_fetch_depth">3</prop>
                <prop key="hibernate.jdbc.fetch_size">50</prop>
                <prop key="hibernate.jdbc.batch_size">10</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </bean>
    <context:annotation-config/>
    <jpa:repositories base-package="com.apress.prospring3.ch16.repository" entity-manager-factory-ref="emf" transaction-manager-ref="transactionManager"/>
    </beans>

Вот сообщение:
Multiple annotations found at this line:
    - Referenced file contains errors (jar:file:/home/vasiliy/.m2/repository/org/springframework/spring-beans/3.1.1.RELEASE/spring-beans-3.1.1.RELEASE.jar!/org/springframework/beans/factory/xml/
     spring-beans-3.0.xsd). For more information, right click on the message in the Problems View and select "Show Details..."
    - Referenced file contains errors (jar:file:/home/vasiliy/.m2/repository/org/springframework/spring-context/3.1.1.RELEASE/spring-context-3.1.1.RELEASE.jar!/org/springframework/context/config/
     spring-context-3.0.xsd). For more information, right click on the message in the Problems View and select "Show Details..."
    - Referenced file contains errors (jar:file:/home/vasiliy/.m2/repository/org/springframework/spring-beans/3.1.1.RELEASE/spring-beans-3.1.1.RELEASE.jar!/org/springframework/beans/factory/xml/
     spring-tool-3.0.xsd). For more information, right click on the message in the Problems View and select "Show Details..."

Автор: neo03 9.2.2013, 23:13
Уже решил. Там вместо бина spring-data-jpa версии 1.0.1.RELEASE нужно поставить версию 1.2.0.RELEASE

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)