카테고리 없음

공부 목록

Ch's Lee 2025. 9. 28. 21:38

개발자를 위한 순서
순수 자바 (SOLID)
데이터베이스 (오라클, MySQL)
ERD (데이터베이스 설계도)
HTML, CSS, JAVASCRIT
JSP, 자바 (Servlet)
UML (StarUML)
Spring, JSP
Spring Boot, JSP
JPA
Spring Data JPA
QueryDSL
API

프론트엔드 개발자를 위한 내용
Axios 사용법 및 인터셉터
React
Vue

개발시 부가적으로 필요한 지식
Git, GitHub
SOLID 개발원칙
로그처리
AOP
API 예외처리, WEB 예외처리


요청 매핑
@Controller
@RestController
@RequestMapping(“/hello”)
@GetMapping(“/mapping/{userId}”)
@PathVariable String userId 
@PathVariable(“userId”) String data 
@PostMapping
@PatchMapping
@DeleteMapping
@ResponseBody : 문자로 전송

HTTP 요청 - 기보, 헤더 조회
HttpServletRequest request
HttpServletResponse response
HttpMethod httpMethod
Locale locale
@RequesrHeader MultiValueMal<String, String> headers
@RequestHeader(“host”) String host
@CookieValue(value = “myCookie”, required = false) String cookie

HTTP 요청 파라미터 - 쿼리 파라미터, HTML Form
GTE - 쿼리 파라미터
request.getParameter()
POST -HTML Form
request.getParameter()
HTTP message body

HTTP 요청 파라미터 - @RequestParam
@RequestParam(required = true, defaultValue = “guest”) String username
@RequestParam(“username”) String memberName
@RequestParam String username
String username
@RequestParam(required = false, defaultValue = “-1”) int age
@RequestParam(“age”) int memberAge
@RequestParam int age
int age
@RequestParam Map<String, Object> paramMap
paramMap.get(“username”)
paramMap.get(“age”)
MultiValueMap 도 사용 가능
HTTP 요청 파라미터 - @ModelAttribute
@ModelAttribute HelloData helloData
helloData.getUsername()
helloDataGetAge()
@ModelAttritue 생략가능

HTTP 요청 메시지 - 단순 텍스 (POST 만)
단순 텍스트
ServletInputStream inputStream = request.getInputStream();
String messageBody = StreamUtils.copyToString(inputStream, StandardCharsets.UTF_*);
log.info(“messageBody={}”, messageBody);
HttpEntity<String> httpEntity
String messageBody = httpEntity.getBody();
@RequestBody String messageBody

HTTP 요청 메시지 - JSON (POST)
private ObjectMapper objectMapper = new ObjectMapper();
HttpServletRequest request
ServletInputStream inputStream = request.getInputStream();
String messageBody = StreamUtils.copyToString(inputStream, StandardCharsets.UTF_8);
HelloData helloData = objectMapper.readValue(messageBody, HelloData.class);
helloData.getUsername()
helloData.getAge()
@RequestBody String messageBody
HelloData helloData = objectMapper.readValue(messageBody, HelloData.class);
helloData.getUsername()
helloData.getAge()
@RequestBody HelloData helioData
helloData.getUsername()
helloData.getAge()
@RequestBody 생략불가, 생략하면 @ModelAttribute 가 붙는다.
HttpEntity<HelloData> httpEntity
HelloData helloData = httpEntity.getBody();

HTTP 응답 - 정적 리소스
/static, /public, /resources, /MEMTA-INF/resources
src/main/resources 는 리소스를 보관하는 곳이고, 클래스 시작 경로
src/main/resources/static/basic/hello-form.html
http://localhost:8080/basic/hello-form.html
뷰 템플릿
src/main/resources/templates
src/main/resources/templates/response/hello.html
콘트롤러 에서 호출하는 위치

HTTP 응답 - HTTP API, 메시지 바디에 직접 입력
@RestController
response.getWriter().write(“ok”);
return new ResponseEntity<>(“ok”, HttpSttus.OK);
return new ResponseEntity<>(helloData, HttpStatus.OK);
public ResponseEntity<HelloData>
HTTP 메시지 컨버터
@ResponseBody
HTTP의 BODY에 문자 내용을 직접 반환
org.springframework.http.converter.HttpMessageConverter


로그출력
Slf4j 인터페이스
Logback 구현체
private final Logger log = LoggerFactory.getLogger(getClass());
lombok 사용시 @Slf4j 사용
log.trace()
log.debug()
log.info(“data={}” , name)
log.info(“data=” + name); 로그 레벨에 따라 연산을 수행후출력은 하지 않음. 비추
log.warn()
log.error()
기본은 info
application.properties 설정
로컬 개발시 : debug
운영 서버시 : info
logging.level.hello.springmvc = trace; 현재 프로젝트 수준
logging.level.root = debug; 전체 로그 수준
MVC 상품등록
PRG Post / Redirect / Get
중복 등록을 방지하기 위해, 상세보기로 Redirect 한다.
RedirectAttribute 으로 html 에 상태값을 전달하여 “저장 되었습니다.” 출력
쿼리스트링으로 전달 ?status=true
타임리프에서 th:if”${param.status}” 로 판단하여 출력

MVC 프로젝트
타임리프 기본 사용법 익히기
메시지 국제화
검증 Validate, BindingResult
로그인 인터셉터
예외처리, 오류페이지
API 예외처리
타입 컨버터
파일업로드






JPA API
JPA 활용
순수 Entity 노출 금지
연관관계 데이터 모두 가져오기 (Hibernate5Module.Feature.FORCE_LAZY_LOADING, true) 설정
jpsql 문법 : join fetch 로 성능 향상