VisualStudio Code로 스프링 설정하기

VisualStudio Code
홍윤's avatar
Sep 27, 2024
VisualStudio Code로 스프링 설정하기
 

1. Java버전 확인하기

  • 터미널에 java —version 입력 후 확인하기!
notion image

2. Extension 들어가서 확장 프로그램 Install 하기

1. Spring Boot Extension pack

notion image

2. Extension Pack for Java

notion image

3. JetBrains IDE, Fleet theme

  • 나는 인텔리j로 작업하고 있어서 JetBrains keymap, Fleet Theme을 Install했다.
notion image
notion image

3. 작업환경 설정하기

  • 작업을 하다 저장을 하면 자동 줄 맞춤(정렬) 설정
notion image
notion image
notion image

4. 워크스페이스 파일 설정 하기

notion image
notion image
{ "java.compile.nullAnalysis.mode": "automatic", "workbench.cloudChanges.autoResume": "onReload", "task.reconnection": true, "boot-java.rewrite.reconcile": true, "java.editor.reloadChangedSources": "auto" }

5. Spring Boot 프로젝트 생성 방법

notion image
notion image
notion image
notion image

6. Icon Theme 보기 좋게 설정하는 프로그램

notion image
notion image

7. application.yml 설정

notion image

8. Spring Boot 프로젝트 실행 확인하기

1. IndexController.java 생성 및 실행하기

notion image
notion image
💡
실행 단축키
실행 : shift+F9
종료 : shift+F5
필요 없는 import 지우기 :alt + shift+ F5
 

9. JBCrypt 설정하기

notion image
notion image
notion image

10. 자동완성 설정

notion image
{ "Code Split": { "prefix": "mcs", "body": [ "/**", "* $1", "* $2", "**/" ], "description": "Code Split" }, "Junit Test Method": { "prefix": "tt", "body": [ "@Test", "public void $1_test() throws Exception {", " // given", " $2", "", " // when", "", "", " // then", "", "}" ], "description": "Junit Test Method" }, "Log": { "prefix": "logd", "body": [ "log.debug(\"디버그 : $1\"$2);" ], "description": "logd" }, "Sysout": { "prefix": "syst", "body": [ "System.out.println(\"테스트 : $1\"$2);" ], "description": "sysout" }, "ReturnMapping": { "prefix": "rr", "body": [ "return new ResponseEntity<>(new ResponseDto<>(1, \"\", null), HttpStatus.OK);", ], "description": "ResponseMapping" }, "ErrorMapping": { "prefix": "err", "body": [ "return new ResponseEntity<>(new ResponseDto<>(-1, \"\", null), HttpStatus.BAD_REQUEST);", ], "description": "ResponseMapping" }, "GetMapping": { "prefix": "getm", "body": [ "@GetMapping(\"/$1\")", "public ResponseEntity<?> $2(){", " $3", "return new ResponseEntity<>(new ResponseDto<>(1, \"\", null), HttpStatus.OK);", "}", ], "description": "Mapping" }, "PostMapping": { "prefix": "postm", "body": [ "@PostMapping(\"/$1\")", "public ResponseEntity<?> $2(){", " $3", " return new ResponseEntity<>(new ResponseDto<>(1, \"\", null), HttpStatus.CREATED);", "}", ], "description": "Mapping" }, "PutMapping": { "prefix": "putm", "body": [ "@PutMapping(\"/$1\")", "public ResponseEntity<?> $2(){", " $3", " return new ResponseEntity<>(new ResponseDto<>(1, \"\", null), HttpStatus.OK);", "}", ], "description": "Mapping" }, "DeleteMapping": { "prefix": "delm", "body": [ "@DeleteMapping(\"/$1\")", "public ResponseEntity<?> $2(){", " $3", " return new ResponseEntity<>(new ResponseDto<>(1, \"\", null), HttpStatus.OK);", "}", ], "description": "Mapping" }, "Logger": { "prefix": "logf", "body": [ "private final Logger log = LoggerFactory.getLogger(getClass());" ], "description": "Logger Field" }, "MapToList": { "prefix": "mapToList", "body": [ "$1.stream().map((e)-> e).collect(Collectors.toList());" ], "description": "MapToList" }, "AssertThatEquals": { "prefix": "asse", "body": [ "assertThat($1).isEqualTo($2);" ], "description": "AssertThatEquals" }, } //셀언어
 
Share article

Uni