2017-08-09 11 views
0

型に解決できないと私はバージョンにアップグレードするとアプリケーションが正常にコンパイルされますが、1.5.6.RELEASEアプリケーションはもうコンパイルされません、私はクラスとインターフェイスの参照を探しましたが、私はこのバージョンでそれについて何も見つけませんでした、誰も助けてくれますか?春ブーツ1.5.6.RELEASE JpaVendorAdapterは、私は、バージョン<strong>春ブーツの1.5.4.RELEASE</strong>を使用していた

の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; 
    } 
} 

エラー:

Error

+0

ローカルMavenレポをパージしてから更新してください。 'mvn dependency:purge-local-repository'を実行するか、' .m2'ディレクトリに移動してリポジトリを一掃してください。 –

+0

これは完璧に機能し、私が承認する答えとして入れました – Passella

答えて

1

レアこれは、Spring Boot Parentのバージョンを更新するときに起こります。これは、それが使用する推移的な依存性を多く更新します。これらは正しくダウンロードされず、インポートエラーが発生する可能性があります。あなたはどちらかとリポジトリをクリアすることができ

mvn dependency:purge-local-repositoryまたはちょうどあなたの.m2ディレクトリに移動し、Mavenプラグインを使用してリポジトリ

を一掃するには、引数を渡すか、無視することができるというようないくつかの利点がありますまた、Eclipseでmavenコンソールを開いた場合や、CLIからmvn installを実行しただけでjarが正しくダウンロードされなかったかどうかを確認することもできます。通常は、warnは、jarに不正なヘッダーがあるか、読み取れませんでした。

関連する問題