Maven 弹簧静止数据

Maven 弹簧静止数据,maven,spring-boot,spring-data,dependency-management,spring-data-rest,Maven,Spring Boot,Spring Data,Dependency Management,Spring Data Rest,我试图使用文档中的演示应用程序公开Spring REST数据: package hello; import java.util.List; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.R

我试图使用文档中的演示应用程序公开Spring REST数据:

package hello;

import java.util.List;

import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

@RepositoryRestResource(collectionResourceRel = "people", path = "people")
public interface PersonRepository extends MongoRepository<Person, String> {

    List<Person> findByLastName(@Param("name") String name);

}

知道如何解决吗?

您应该能够删除额外的依赖项,因为Spring Boot的REST starter已经在正确版本中引入了所有依赖项


Spring Boot 1.2.3是指第二次维修版本中的Spring数据系列Evans。这可以归结为Spring数据REST 2.2.2。如果要升级到较新的发布序列(例如Fowler),请将
spring data releasetrain.version
属性的值更改为
Fowler GA
。然后,这将把SpringDataREST升级到2.3.0,并确保在匹配的版本中获得所有必需的依赖项。

谢谢,这似乎是Netbeans环境的一个问题。通过使用maven shell进行编译,它成功了。
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.3.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>
    </dependencies>
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-rest-core</artifactId>

    <type>jar</type>
    <version>2.3.0.RELEASE</version>
</dependency>
Caused by: java.lang.NoClassDefFoundError: org/springframework/data/rest/core/invoke/RepositoryInvokerFactory
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
    at java.lang.Class.getDeclaredMethods(Class.java:1855)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:571)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:488)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:474)
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:534)