Я до сих пор ничего особенного не делал, но получил раздражающее исключение:
java.lang.IllegalStateException: неоднозначные методы обработчика, отображаемые для пути HTTP 'http://localhost:8080/directoryWatches' : {public org.springframework.http.ResponseEntity org.springframework.data.rest.webmvc.RepositoryEntityController.headCollectionResource (org.springframework.data.rest.webmvc. выбрасывает org.springframework.web.HttpRequestMethodNotSupportedException, public org.springframework.hateoas.Resources org.springframework.data.rest.webmvc.RepositoryEntityController.getCollectionResourcec. .webmvc.support.DefaaledPageable, org.springframework.data.domain.Sort, org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler) выбрасывает org.springframework.data.rest.webmvc.ResourceNotFramework.ExpringException tMethodNotSupportedException}
Вот моя сущность:
@Entity
public class DirectoryWatch {
@Id
@GeneratedValue
private long id;
@Column(unique = true)
private String name;
//setters, getters and default constructor...
}
И мой DirectoryWatchRepository:
@RepositoryRestResource
public interface DirectoryWatchRepository extends PagingAndSortingRepository<DirectoryWatch, Long> {
}
Исключение возникает, когда я открываю браузер HAL и пытаюсь открыть методы HTTP NON-GET: < img src = "https://i.stack.imgur.com/iJeOD.png" alt = "введите описание изображения здесь">
Фрагменты моего файла pom:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.M2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
Dependencies:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-docs</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-remote-shell</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>
Есть ли у кого-нибудь полезная идея?
Спасибо, Кристиан