I Version 1.5.4.RELEASE des Frühlings-Boot mit wurde und die Anwendung kompiliert normalerweise, aber wenn ich ein Upgrade auf Version 1.5.6.RELEASE Die Anwendung kompiliert nicht mehr, ich habe nach der Referenz der Klassen und Interfaces gesucht, aber in dieser Version habe ich nichts dazu gefunden, kann mir jemand weiterhelfen?Frühling Stiefel 1.5.6.RELEASE JpaVendorAdapter kann nicht auf eine Art gelöst werden
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
PersistenceJPAConfig.java:
package com.example.demo;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@ComponentScan(basePackages = { "com.example.demo" })
@EnableTransactionManagement
@PropertySources({
@PropertySource(value = "file:${catalina.home}/webapps/mywebapp.properties", ignoreResourceNotFound = false) })
@EnableAspectJAutoProxy
@EnableJpaRepositories("com.example.demo")
public class PersistenceJPAConfig {
@Value("${driverClassName}")
private String driverClassName;
@Value("${url}")
private String url;
@Value("${userDataBase}")
private String userDataBase;
@Value("${password}")
private String password;
@Value("${hibernate.dialect}")
private String hibernatedialect;
@Value("${show_sql:false}")
private String show_sql;
@Value("${validationQuery:select 1 from dual}")
private String validationQuery;
@Autowired
JpaVendorAdapter jpaVendorAdapter;
@Bean()
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setJpaVendorAdapter(jpaVendorAdapter);
em.setPersistenceUnitName("MyWebApp");
em.setPackagesToScan(new String[] { "com.example.demo" });
em.setJpaProperties(additionalProperties());
em.afterPropertiesSet();
return em;
}
@Bean
public DataSource dataSource() {
org.apache.tomcat.jdbc.pool.DataSource dataSource = new org.apache.tomcat.jdbc.pool.DataSource();
dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(url);
dataSource.setUsername(userDataBase);
dataSource.setPassword(password);
dataSource.setInitialSize(2);
dataSource.setMaxIdle(15);
dataSource.setMinIdle(2);
dataSource.setRemoveAbandonedTimeout(60 * 60);
dataSource.setLogAbandoned(true);
dataSource.setTestOnBorrow(true);
dataSource.setValidationQuery(validationQuery);
dataSource.setTestOnReturn(true);
dataSource.setTestWhileIdle(true);
return dataSource;
}
@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
return new JpaTransactionManager(emf);
}
@Bean
public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
return new PersistenceExceptionTranslationPostProcessor();
}
Properties additionalProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.dialect", hibernatedialect);
properties.setProperty("hibernate.show_sql", show_sql);
properties.setProperty("hibernate.format_sql", "true");
properties.setProperty("hibernate.id.new_generator_mappings", "false");
return properties;
}
}
der Fehler:
Versuchen Sie, lokalen Maven Repo zu löschen und dann zu aktualisieren. 'mvn dependency: purge-local-repository' oder navigiere einfach in dein' .m2' Verzeichnis und lösche das Repository. –
Dies funktionierte perfekt, als Antwort für mich zu genehmigen – Passella