본문 바로가기

분류 전체보기474

JPA 설정 및 테스트코드 예제 1 @Entity DTO에 JPA설정 @id 기본키 설정 @GeneratedValue 기본키 자동 생성(자동 증가) 사이트 참고 https://ithub.tistory.com/24 >> [User(id=1, name=null, email=null, createdAt=null, updateAt=null)] // 여러줄로 나뉘어서 줄력 userRepository.findAll().forEach(System.out::println); 내림차순으로 List에 저장하고 출력하는 예제 package com.example.bookmanager.repository; import com.example.bookmanager.domain.User; import org.junit.jupiter.api.Test; import or.. 2021. 7. 4.
JPA 개념 및 Test controller 작성, lombok을 이용한 dto 작성, h2를 이용한 데이터베이스 설정 ORM: 데이터베이스와 어플리케이션을 연결해주는 것 JPA: JAVA에서 ORM의 기능을 해주는 인터페이스 실습에 필요한 추가 요소 dependency 확인 (build.gradle) dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.h2database:h2' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.s.. 2021. 7. 3.
Swagger 설정 2 테스트를 진행할 예제: http://localhost:8080/swagger-ui/ 어노테이션 사용 예제 @Api: Swagger를 이용할 때 API Controller의 설명을 지정해 줄 수 있다. // @Api: Swagger를 이용할 때 API Controller의 설명을 지정해 줄 수 있다. @Api(tags = {"API 정보를 제공하는 Controller"}) @RestController @RequestMapping("/api") public class ApiController { @GetMapping("/hello") public String hello() { return "hello"; } } 화면 Get 방식 파라미터 변수마다 설명을 달아주는 방법 @ApiParam: 파라미터 하나 하나 .. 2021. 7. 3.
Swagger 설정 1 프로젝트 생성후 dependency의 Springfox Boot Starter 추가 https://mvnrepository.com/artifact/io.springfox/springfox-boot-starter/3.0.0 테스트를 진행할 controller 생성 package com.example.swagger.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMa.. 2021. 7. 3.
Swagger 개념 Swagger란 개발한 REST API를 편리하게 문서화 해주고 이를 통해서 관리 및 제3의 사용자가 편리하게 API를 호출해보고 테스트 할 수 있는 프로젝트이다. Spring Boot에서는 간단하게 springfox-boot-starter를 gradle dependencies에 추가 함으로 사용할 수 있다. 다만, 주의할 점은 운영환경과 같은 외부에 노출되면 안되는 곳에는 사용할 땐 주의 해야 한다. Annotation @Api 클래스를 스웨거의 리소스로 표시 @ApiOperation 특정 경로의 오퍼레이션 HTTP 메소드 설명 @ApiParam 오퍼레이션 파라미터에 메타 데이터 설명 @ApiResponse 오퍼레이션의 응답 지정 @ApiModelProperty 모델의 속성 데이터를 설명 @ApiImp.. 2021. 7. 3.
Parcel 시작 환경 세팅 초기화 명령어: npm init -y parcel bundler 다운 명령어: npm i -D parcel-bundler 해당 파일이 생성된거 확인 package.json 파일에 브라우저에 동작을 시키기위한 설정을 해준다. "scripts": { "dev": "parcel index.html", "build": "parcel build index.html" }, 예제를 작성할 html, js파일을 작성한다. 그 후 CSS를 초기화 사이트: reset.css cdn 검색 https://www.jsdelivr.com/package/npm/reset-css jsDelivr - A free, fast, and reliable CDN for Open Source Supports npm, GitHub, .. 2021. 7. 1.