STS 이용하여 spring boot REST API 서버 JSON 웹 서비스 프로젝트 만들기

Posted by HULIA(휴리아)
2018. 3. 9. 10:41 백엔드개발/스프링부트
JDK 1.7
Spring Tool Suite 3.7.2
Maven 3.3.1
Spring Framework 4
Spring Boot 1.5.10

스프링 부트 개발 방법 세가지
1)스프링 부트 CLI커맨드라인 도구 사용
2)스프링 부트를 바로 사용할 수 있게 지원하는 STS와 같은 IDE 사용
3)http://start.spring.io에서 제공하는 스프링 이니셜라이저 프로젝트 활용

STS를 이용한 개발 프로젝트 생성 순서
1. new project

2. spring starter project

3. 프로젝트 명 지정

3. dependencies 선택(API)
Web, MyBatis, Lombok(옵션)
pom.xml에 추가
    <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.42</version>
<scope>runtime</scope>
</dependency>

mysql서버일때 application.properties
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://주소/데이터베이스명
spring.datasource.username=아이디
spring.datasource.password=비번

mybatis.config-location=classpath:mybatis/mybatisConfig.xml
mybatis.mapper-locations=classpath:mybatis/mapper/**/*.xml


3.1 dependencies 선택(JSP 웹 프로젝트)
Web, MyBatis
pom.xml에 추가
    <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.42</version>
<scope>runtime</scope>
</dependency>

mysql서버일때 application.properties
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://주소/데이터베이스명
spring.datasource.username=아이디
spring.datasource.password=비번

mybatis.config-location=classpath:mybatis/mybatisConfig.xml
mybatis.mapper-locations=classpath:mybatis/mapper/**/*.xml




참고 사이트
http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/

https://github.com/stunstunstun/awesome-spring-boot
https://github.com/stunstunstun/awesome-spring-boot/tree/master/spring-boot-mybatis-example/src/main/resources
https://www.holaxprogramming.com/2015/10/16/spring-boot-with-jdbc/
https://www.holaxprogramming.com/2015/10/18/spring-boot-with-mybatis/

http://jsijsi99.tistory.com/8?category=710810

http://joochang.tistory.com/84

http://millky.com/@origoni/post/1100