Recentemente ho riscontrato alcuni problemi relativi ai dati di primavera che non ho ancora risolto. Dopo un esame più attento ho scoperto che gli avvertimenti XML in cui spenti, e quando li ho acceso questi due avvertimenti laddove siano esposti:Bean di riferimento 'jpaMappingContext' non trovato
Multiple annotations found at this line:
- Referenced bean 'jpaMappingContext' not found [config set: test/test]
- Class 'org.springframework.orm.jpa.SharedEntityManagerCreator' is abstract [config set: test/
test]
Questa è la mia primavera-dati-rest.xml, avvertenze sono spettacolo al linea <jpa:repositories base-package="com.test"/>
<?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:jee="http://www.springframework.org/schema/jee"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd">
<bean class="org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration"/>
<bean class="org.springframework.data.web.config.HateoasAwareSpringDataWebConfiguration" />
<jpa:repositories base-package="com.test"/> <!-- warnings on this line-->
<bean class="org.springframework.orm.hibernate4.HibernateExceptionTranslator"/>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="postgreDataSource"/>
<property name="packagesToScan" value="com.test.model" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">validate</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
</bean>
</beans>
Ho cercato entrambi gli avvertimenti ma senza fortuna. Sto indovinando che ho bisogno di aggiungere un po 'di bean per la configurazione, o mi mancano alcune dipendenze. Inoltre ho cercato per il bean jpaMappingContext, ma non ho trovato nulla di valore.
Le dipendenze di primavera, ibernazione, json e postgre sono indicate di seguito.
<!-- PostgreSQL -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.2-1003-jdbc4</version>
</dependency>
<!-- JSon -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.5.1</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.8.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.8.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>4.3.8.Final</version>
</dependency>
<!-- Spring MVC -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<!-- spring aspect oriented -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<!-- Spring HATEOAS -->
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
<version>0.16.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
<!-- Spring data rest -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-core</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<!-- Spring data -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.7.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.9.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons-core</artifactId>
<version>1.4.1.RELEASE</version>
</dependency>
Come posso risolvere il problema segnalato?
Hai visto http://stackoverflow.com/questions/28945382/how-to-eliminate-bogus-referenced-bean-not-found-warnings-in-sts (supponendo che questo sia ancora in qualche modo rilevante per te)? – Marvin
Hai effettivamente degli errori durante il runtime? Sono solo degli avvisi in eclissi (supponendo che sia quello che stai usando)? –
Sto lavorando ad un altro progetto in questo momento, ma controllerò tra qualche settimana una volta che sarò di nuovo in pista con questo. Sì, Eclipse è in questione. – Miljac