VsCode 플러그인 세팅

윤주헌's avatar
Oct 01, 2024
 VsCode 플러그인 세팅
vs코드에 자바 버전 확인!
java —version
notion image

1. 설치

notion image
 
notion image
이거 깔아야 하는데 난 깔려있드라 뭐징(단축키 설정때문에 설치 하는 것)
notion image
아이콘이 이뻐짐
notion image
 
notion image
format on
notion image
 
notion image
notion image
설정 방법인데 workspace에서 하면 지금 파일에서만 설정 가능하고 다른 파일가면 또 설정해줘야함
User에서 설정하면 전부 설정됨
Jetbrains fleet theme 들어가서 스크롤 내리면 빨간 상자 안에 있는게 보일 거임 그래서 복 붙
notion image
 
그냥 Workspace settings에 넣어주기
"editor.fontFamily": "JetBrains Mono, Consolas, 'Courier New', monospace",
"editor.fontSize": 14,
"editor.lineHeight": 1.6,
이렇게
폰트 이뻐짐
notion image

workspace에 넣으면 파일 바꾸면 설정 저장 안됨 그래서 디폴트나 유저에 넣어줘야 한다!!

스프링 파일 만들기!

 
notion image
notion image
notion image
notion image
notion image
notion image
notion image
web이 @ 만들어 주는애
빨간 박스의 애들 다 클릭하거나 앤터 쳐서 추가해주자
notion image
시작 하려면
notion image
파일 따로 만들어서 하기( 마음대로 )
 
notion image
notion image
notion image
 
여기에 settingsJson이 들어간다
notion image
 
 

아이콘 이쁘게 하기

설치
notion image
결과
notion image
help.md → 파일 수정하려면 f2
이름 README로 바꾸기, HELP.md 안쪽 내용 다 지우기
notion image

서버 실행 되는지 확인

notion image
서버 켜보자
파일 들어가서 우클릭 런 자바 클릭 Or shift f9
notion image
notion image
 
404뜨면 된다 서버 돌아가고 있다는 것임
서버 끄기
notion image

콘솔이 터미널로 떠서 변경 (디버그 콘솔로)

서버를 시작하면 아래 콘솔이 터미널로 뜬다
디버그 콘솔로 바꿀꺼임
notion image
유저로 선택
notion image
콘솔 치고 스크롤 내려서 자바 디버그 세팅으로 이동
notion image

디버그 콘솔 이쁘게 변경

application.preperiance파일을
yml로 변경
notion image
넣기
spring: output: ansi: enabled: always
이렇게
notion image
이뻐짐
notion image

폰트 바꾸기

유저 세팅파일로 간다
notion image
 
붙여넣기
"editor.fontFamily": "JetBrains Mono, Consolas, 'Courier New', monospace", "editor.fontSize": 16, "editor.lineHeight": 1.6,
notion image

아이콘 변경(파일 옆에 있는 아이콘)

notion image
 
테마 선택 가능
notion image
notion image
 
 

단축키

테마 색 바꾸기

ctrl + `(백틱(키보드 왼쪽 위에 있는 물결표 쪽)

디버그 콘솔 서버 키고 끄기

shift + f9 누르면 서버 실행
shift + f5 서버 끄기

필요 없이 import된 것 지우기

누르면 필요없는 import된것 지워짐
💡
alt shift o

롬북 설치

notion image

컨트롤러 만들기

java\com\example\demo여기서 오른쪽 클릭하고 new File
notion image
 
notion image
탭 하면 리턴타입으로 가서 계속 탭 해주면 된다!

그래이들 추가

라이브러리 추가하기
notion image
 
마븐 레파지토리 들어가기
notion image
0.4 클릭
notion image
그래이들 클릭
notion image
notion image
그래이들 리로드 오른쪽 클릭하기
(나름 최신버전이라 오른쪽에 있는듯 옛 버전은 그래이들 창 위에 리로드창 있음)
notion image

그래이들 안될 시@

💻
그레이들 추가했는데 오류시 (1)

라이브러리 됐는지 확인 방법, 솔트 설명

BC쳤을 때 BCrypt 나오는지 확인
package com.example.demo; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class IndexController { @GetMapping("/") public ResponseEntity<?> home() { return new ResponseEntity<>("ok", HttpStatus.OK); } @GetMapping("/user") public ResponseEntity<?> user() { String rawPassword = "1234"; String encPassword = BC return new ResponseEntity<>("user", HttpStatus.OK); } }
notion image
 
해시에 소금 뿌리기
notion image
 
솔트넣는법
897의 원본이 a_metacoding 이여서
 
위험한게 salt 털리면 큰일남!
salt도 현재 시간 등 나만 알고 있는 알고리즘 넣어서 다르게 한다!!
매번 다르게 salt다르게 만들어서 알고리즘만 알 수 있게
notion image
 
 
다시 검증 해야 하잖아
@GetMapping("/verify") public ResponseEntity<?> verify() { String rawPassword = "1234"; String dbPassword = "$2a$10$JPL/lnIokpo4Wd5nSgFfs.ug.hPRuMC2MKJOdtWP.8hhzNx3euZlW"; boolean isSame = BCrypt.checkpw(rawPassword, dbPassword); return new ResponseEntity<>(isSame, HttpStatus.OK); }
notion image
 
 
솔트코드
package com.example.demo; import org.mindrot.jbcrypt.BCrypt; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class IndexController { @GetMapping("/") public ResponseEntity<?> home() { return new ResponseEntity<>("ok", HttpStatus.OK); } @GetMapping("/user") public ResponseEntity<?> user() { String rawPassword = "1234"; String salt = BCrypt.gensalt(); String encPassword = BCrypt.hashpw(rawPassword, salt); System.out.println("salt : " + salt); System.out.println(encPassword); return new ResponseEntity<>(encPassword, HttpStatus.OK); } @GetMapping("/verify") public ResponseEntity<?> verify() { String rawPassword = "1234"; String dbPassword = "$2a$10$JPL/lnIokpo4Wd5nSgFfs.ug.hPRuMC2MKJOdtWP.8hhzNx3euZlW"; boolean isSame = BCrypt.checkpw(rawPassword, dbPassword); return new ResponseEntity<>(isSame, HttpStatus.OK); } }
자세한 솔트 설명은 여기
너무 좋아

테스크 코드 단축키 같은 것!!

notion image
처음하면 java 클릭하면 됨
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" }, }
ncs tt err getm postm
단축키다!!
 
$1이 커서가 그쪽으로 감
 
이런게 쉘 문법이다!!
 
이런거 배우려면
강사님 유튜브 aws 강의 보면 됨!!
배우고 나면
git bash로 가능!!
Share article

code-sudal