소스:
https://github.com/julyinsung/springboot/tree/master/restapi-sample환경:
spring boot, gradle 1.8, web
개요:
Spring Boot를 이용하여 Rest서버 연습.
WAR파일로 배포.
1. RestAPI 서버 연습
기존과 다른것은 Controlller 클래스에 @RestController 어노테이션을 사용한다.
@RestController
public class RestSampleController {
@RequestMapping("/")
public FileInfo RestTest(HttpServletRequest request){
Files f = new JoinFile();
String filePath = null;
try {
filePath = new ClassPathResource("CC01_IF20170131_0002_REQ").getFile().getPath();
} catch (IOException e1) {
e1.printStackTrace();
}
f.processFile(filePath);
return f.getFileInfo();
}
}
2. WAR파일 배포
- build.gradle 파일에 plugin을 설정한다.
// war 설정
apply plugin: 'war'
// war 설정
war {
baseName = 'ROOT'
}
댓글 없음:
댓글 쓰기