본문 바로가기

Spring Boot15

스프링 부트에서 HATEOAS 를 적용하는 2가지 방법 1. ResourceSupport 를 사용하는 방법 public class EventResource extends ResourceSupport { // Hateoas 적용에서 추가된 코드 ( HAL 적용 ) //@JsonUnwrapped // 있으면 리턴 값이 아래와 같다. - JsonUnwrapped 를 쓴게 파싱하기 더 편하다 //{"id":1,"name":"Spring","description":"REST API Development with Spring","beginEnrollmentDateTime":"2018-11-23T14:21:00","closeEnrollmentDateTime":"2018-11-24T14:21:00","beginEventDateTime":"2018-11-25T14:21:00.. 2019. 2. 8.
스프링 gradle database 2개 있는 경우 1 2 3 4 5 6 7 8 9 10 11 12 dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-hateoas' implementation 'org.springframework.boot:spring-boot-starter-web' runtimeOnly 'com.h2database:h2' runtimeOnly 'org.postgresql:postgresql' compileOnly 'org.projectlombok:lombok' testImplementation 'org.springframewor.. 2019. 1. 10.
spring boot 1.5.17 버전 jpa 로 데이터 베이스 조작 mysql 스프링으로 웹 개발을 할 때 DB에 어떻게 접근하는게 좋을까 몇가지 방법이 있다. 1. 직접 자바 코드를 작성해서 DB에 접근 2. ORM을 사용하는 방법 1번은 권장하지 않는다. 접근을 수월하게 해주는 ORM 이라는 도구가 있기 때문이다. 쿼리를 매핑해주는 Mybatis 를 쓰기도 한다. DB 조작시 많이 사용되는 것은 3가지가 있다. 1. Mybatis - xml 을 활용해서 쿼리를 매핑한다. 2. JPA - ORM 으로써 자바 코드로 DB 조작을 더 수월하게 할 수 있게 한다. 3. Hibernate - ORM 으로써 자바 코드로 DB 조작을 더 수월하게 할 수 있게 한다. 사실 Mybatis 는 우리나라에서만 많이 쓴다. 그것도 좋지 않은 SI 에서만. 아무튼 spring boot 에서 많이 쓰이.. 2018. 11. 15.
spring boot thymeleaf , 스프링 부트 타임리프 사용하기 스프링 부트 타임리프 사용하기 코드 구조 이렇다. pom.xml 구조 이렇다. 타임리프와 웹만 있어도 웹페이지는 표시 된다. com.artwork의 ArtworkApplication.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 package com.artwork; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework... 2018. 11. 6.
Spring boot Reference Guide 6 Spring boot Reference Guide 6 스프링 부트 패키지 이름에 관한 이야기 패키지를 만들지 않고 바로 클래스를 생성하면 default 패키지가 생성됩니다. 스프링 부트 에서는 이렇게 default 패키지에 클래스를 생성하는 것을 권장하지 않습니다. 스프링 부트를 사용해서 개발하다 보면 @Componentscan을 통해서 특정 패키지에 위치한 파일을 읽어야 할 때가 있는데 default 는 패키지에 이름을 지정하지 않았기 때문에 문제가 됩니다. -프로젝트를 생성하면 나타나는 @SpringBootApplication에 관한 이야기 @SpringBootApplication 애너테이션은 @Configuration , @EnableAutoConfiguration , @ComponentScan 3.. 2018. 3. 29.