GraphQL 게시판 프로젝트 세팅

이재연·2021년 1월 14일
1

그래서? 공부를 해봤으니 직접 사용해보자.
간단하게 글을 작성할 수 있는 게시판을 구현해봤다.

이번 글에서는 프로젝트 세팅에 대해서만 다루겠습니다.

구현

프로젝트는 Spring Boot, GraphQL, JPA아주 약간의 thymeleaf를 사용했다.
우선 Graphql에 필요한 디펜던시를 추가해준다.

<dependency>
	<groupId>com.graphql-java</groupId>
	<artifactId>graphql-spring-boot-starter</artifactId>
	<version>5.0.2</version>
</dependency>
<dependency>
	<groupId>com.graphql-java</groupId>
	<artifactId>graphql-java-tools</artifactId>
	<version>5.2.4</version>
</dependency>

GraphQL을 쉽게 사용 할 수 있도록 해준다. 처음에는 graphql-spring-boot-stater를 안 썼는데 코드도 지저분하고 쿼리나 뮤테이션을 추가하기도 번거로워서 다시 바꿨다.

그리고 스프링부트와 Jpa, JDBC를 추가해준다.

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
  
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-web</artifactId>
</dependency>
	
<dependency>
	<groupId>org.postgresql</groupId>
	<artifactId>postgresql</artifactId>
</dependency>

개발 편의를 위한 디펜던시

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-devtools</artifactId>
</dependency>

<dependency>
	<groupId>org.projectlombok</groupId>
	<artifactId>lombok</artifactId>
	<optional>true</optional>
</dependency>

처음에는 자바 버전은 11을 썼는데

WARNING: An illegal reflective access operation has occurred
WARNING: Please consider reporting this to the maintainers of com.esotericsoftware.reflectasm.AccessClassLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

이런 에러가 떴다. 자바 버전 9부터 발생하는 에런데 구동에는 이상이 없지만 보기 싫으면 설정으로 에러를 안 보이게 하거나 자바 버전을 낮추면 된다.

어차피 많은 기능을 쓰지도 않을거고 간단하게 구현만 해보고 싶어서 1.8로 자바 버전을 낮췄다.

결과


프로젝트가 잘 구동된다!

0개의 댓글