스프링 데이터 나머지를 처음 시도했지만, 내 저장소 엔드 포인트를 찾지 못했습니다. localhost:8080/books
구성이 잘못된 것을 누가 볼 수 있습니까?스프링 부트로 엔드 포인트를 찾을 수 없음
Application 클래스
@SpringBootApplication
@ComponentScan(basePackageClasses = {Book.class})
public class SpringDataMicroServiceApplication {
public static void main(String[] args) {
SpringApplication.run(SpringDataMicroServiceApplication.class, args);
}
}
도서 법인
@lombok.Getter
@lombok.Setter
@lombok.RequiredArgsConstructor
@lombok.EqualsAndHashCode(of = "isbn")
@lombok.ToString(exclude="id")
@Entity
public class Book implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private long id;
private String isbn;
private String title;
private String author;
private String description;
}
BookRepository
public interface BookRepository extends CrudRepository<Book, Long> {
}
Gradle을 파일 빌드
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'io.spring.gradle:dependency-management-plugin:0.5.4.RELEASE'
}
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'idea'
dependencyManagement {
imports {
mavenBom 'io.spring.platform:platform-bom:2.0.5.RELEASE'
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-aop')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.data:spring-data-rest-hal-browser')
compile('org.projectlombok:lombok:1.16.6')
compile('org.springframework.retry:spring-retry')
compile('org.springframework.boot:spring-boot-starter-validation')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-ws')
compile('org.springframework.boot:spring-boot-actuator')
runtime('com.h2database:h2')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.restdocs:spring-restdocs-mockmvc')
}
흥미롭게도 나는 그것을 잘 잘라내려고 노력할 것입니다. 스프링 부트가 모든 것을 찾으면 주석. 이것을 시험 할 때까지 기다릴 수 없습니다. –
시험해 보셨습니까? –
몇 가지 테스트가 끝난 후에 필자는 꼭 주석이 필요하다. 현재 패키지와 응용 프로그램 및 도메인이 있습니다. 이 세 가지 주석이 없으면 나는 책에 관한 어떤 끝점도로드하지 않는다. 구성 요소 검사를 제거 할 수있는 것처럼 보이지만 저장소 나 JpaRepositories를 제거하면 문제가 발생합니다. –