简体   繁体   中英

springboot 1.5.2 + hibernate-search-orm

I want to use springboot and hibernate-search-orm but can't get the project to compile.

I think it is because of compatability issues between hibernate versions?

I am using Gradle and Intellij Idea.

build.gradle

buildscript {
ext {
    springBootVersion = '1.5.2.RELEASE'
}
repositories {
    mavenCentral()
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}

ext["thymeleaf.version"] = "3.0.2.RELEASE"
ext["thymeleaf-layout-dialect.version"] = "2.0.1"

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

version = '0.0.5-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}
dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-jdbc')
    compile('org.springframework.boot:spring-boot-starter-thymeleaf')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile 'org.springframework.boot:spring-boot-starter-security'

    compile ("org.thymeleaf.extras:thymeleaf-extras-springsecurity4:3.0.0.RELEASE")

    compile group: 'org.springframework.boot', name: 'spring-boot-starter-logging', version: '1.5.2.RELEASE'
    compile group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-springsecurity4', version: '2.1.2.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure', version: '1.5.2.RELEASE'

    compile group: 'org.hibernate', name: 'hibernate-search-orm', 

    version: '5.1.0.Final'

        compile("org.springframework.boot:spring-boot-devtools")
        compile('mysql:mysql-connector-java')
        testCompile('org.springframework.boot:spring-boot-starter-test')
    }

        bootRun {
            addResources = true
        }

And the output when I run build

    5:40:30 PM: Executing external task 'build'...
C:\Users\Owner\IdeaProjects\test\src\main\java\com\example\controllers\planController.java:27: warning: sym is internal proprietary API and may be removed in a future release
import static com.sun.org.apache.xalan.internal.xsltc.compiler.sym.error;
                                                              ^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
:compileJava
:processResources UP-TO-DATE
:classes
:findMainClass
:jar
:bootRepackage
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test

com.example.Demo3ApplicationTests > contextLoads FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: java.lang.AbstractMethodError

1 test completed, 1 failed
:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///C:/Users/Owner/IdeaProjects/test/build/reports/tests/test/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 23.392 secs
There were failing tests. See the report at: file:///C:/Users/Owner/IdeaProjects/test/build/reports/tests/test/index.html
5:40:54 PM: External task execution finished 'build'.

I don't think hibernate-search-orm is part of springboot so I have added it to my build.gradle file explicitly.

If I try to run my project the root error appears to be:

Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available)

You need to Specify the versions of dependencies that you are using. And they should be compatible to each other.Go through https://mvnrepository.com and find your spring boot version and check Compile Dependencies. Do it with all other dependencies that you are using .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM