现在,当我从SpringDataNeo4J4.1.3切换到5.0.0时,SpringBoot失败

现在,当我从SpringDataNeo4J4.1.3切换到5.0.0时,SpringBoot失败,spring,spring-data-neo4j-5,Spring,Spring Data Neo4j 5,背景 我有一个使用spring数据neo4j的应用程序,我从4.1.3切换到了5.0.0 我相信我已经做了所有必要的更改来转换我的代码,但是仍然会出现错误 我目前的spring boot版本是 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot</artifactId> <version>1.

背景

我有一个使用spring数据neo4j的应用程序,我从4.1.3切换到了5.0.0

我相信我已经做了所有必要的更改来转换我的代码,但是仍然会出现错误

我目前的spring boot版本是

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot</artifactId>
    <version>1.4.1.RELEASE</version>
</dependency>
我的myproject.Application.java当前正在运行

@SpringBootApplication
@EnableTransactionManagement
@EnableSwagger2
@EntityScan(basePackages = "myproject.domain")
public class Application {

    public static void main(String[] args) {
        new SpringApplication(Application.class).run(args);
    }

    @Bean
    public Docket Api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build()
                .pathMapping("/")
                .apiInfo(apiInfo());
    }

    private springfox.documentation.service.ApiInfo apiInfo() {
        return new ApiInfoBuilder()
            .title("Service API")
    }
}
这并没有找到像myproject.controller.ActionController.java这样的控制器,它包含

...
@RestController
@Api(value = "Action", description = "Actions Management API")
@RequestMapping(value = "/api/action")
public class ActionController extends Controller<Action> {
...
错误变成了不太干净的东西:

...

2017-10-05 13:19:46.992 ERROR 561 --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.NoSuchMethodError: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional;
    at org.springframework.data.neo4j.repository.config.Neo4jRepositoryConfigurationExtension.postProcess(Neo4jRepositoryConfigurationExtension.java:110) ~[spring-data-neo4j-5.0.0.RELEASE.jar:5.0.0.RELEASE]
    at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:130) ~[spring-data-commons-1.12.0.RELEASE.jar:na]
    at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:83) ~[spring-data-commons-1.12.0.RELEASE.jar:na]

...
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) on project myproject: An exception occurred while running. null: InvocationTargetException: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional; -> [Help 1]
[ERROR] 

...
更新2

为了尝试使用@EnableNeo4jRepositoriesmyproject.repository并绕过更新1中的错误,我尝试:

mvn清洁安装弹簧靴:重新打包

它使构建成功,但同样的错误仍然存在:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) on project myproject: An exception occurred while running. null: InvocationTargetException: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional; -
更新3

我有了新的注释,并将我的pom更改为:

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>1.12.0.RELEASE</version>
    </dependency>

尝试在配置类上添加此批注:

@EnableNeo4jRepositories("myproject.repository")
更新:

我刚看到你在用弹簧靴1.4。SDN 5仅与Spring Boot 2.0兼容。
详细信息见。

我已经更新了pom,并且出现了一个新错误,可以在更新3中看到。感谢您的建议,我认为我正在朝着正确的方向前进。我还没有解决更新3中的问题,但我将接受您的回答,因为我认为您解决了最初的问题。Spring数据和Spring boot项目与发布序列的概念一起工作,以避免这种依赖性限制。发布系列将一组连贯的jar版本拉到一起工作。你应该看看这个例子:
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>1.12.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>
***************************
APPLICATION FAILED TO START
***************************

Description:

A component required a bean named 'getSessionFactory' that could not be found.


Action:

Consider defining a bean named 'getSessionFactory' in your configuration.
@EnableNeo4jRepositories("myproject.repository")