본문 바로가기
Spring Boot/인강

Springboot-나만의 블로그 만들기

by hyhs 2022. 3. 10.
728x90
반응형
SMALL

https://www.inflearn.com/questions/16184 xml,json,yaml 차이점

 

정적파일 html, png

동적파일 jsp 컴파일이 일어나야 함

 

jsp파일-java이므로

톰캣이 웹서버 apach에게 컴파일해서 html 파일로 던져줌

 

https://www.youtube.com/watch?v=u-E9TH4ZaEA&list=PL93mKxaRDidECgjOBjPgI3Dyo8ka6Ilqm&index=23 

 

https://getinthere.tistory.com/17

 

빈 등록 - 스프링 IoC에서 객체를 가지고 있음

 

더미 데이터 insert

@DynamicInsert insert할때 null 인 필드 제외

 

JSONView 설치

 

 

https://www.youtube.com/watch?v=dPfjqBB-T4U 27강까지

 

03/12 27강~

public Page<User> pageList(@PageableDefault(size=2, sort="id",direction = Sort.Direction.DESC)Pageable pageable) {
    Page<User> users =  userRepository.findAll(pageable);
    return users;

2건씩 들고오고, sort는 id로, id를 최신순으로 

 

 

springboot pageable

http://localhost:9090/blog/dummy/user?page=0

http://localhost:9090/blog/dummy/user?page=1

 

반환을 List로 할 경우 .getContent()

 

 

 

id가 1인 user의 password와 email을 변경

@RequestBody

데이터를 JSON으로 받을 경우

 

-save는 INSERT할 때 씀, update를 할 때 잘 안씀(null값 생김)

 

영속성 컨텍스트와 더티체킹

더티체킹: 변경감지

종료시 commit

 

-예외

try {
    userRepository.deleteById(id);
} catch (Exception e) { //EmptyResultDataAccessException
    return "삭제에 실패하였습니다. 해당 id는 DB에 없습니다.";
}

 

 

 

https://jojoldu.tistory.com/415

 

https://github.com/codingspecialist/Springboot-JPA-Blog/tree/master/src

728x90
반응형
LIST

댓글