9. 스프링 시큐리티 로그인+ 커스터마이징(because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. 오류)
·
프로젝트/블로그 제작(중단)
pom.xml org.springframework.security spring-security-taglibs org.springframework.boot spring-boot-starter-security org.springframework.security spring-security-test test 추가!그리고 UserApiController의 전통적인 로그인 (이전 글 참고) 그리고 실행하면 스프링 시큐리티가 어떤 페이지를 들어가든 가로채서 로그인을 하게 한다아이디는 그냥 user고비번은 저 위에있는 해쉬넘버=> 기본적으로 스프링이 세션을 만들어서 저장해줌(principal에)그리고 스프링 시큐리트 태그라..
jpa의 영속성 컨텍스트와 update
·
데이터베이스/그 외
1. save함수로 update할때 jpa의 영속성 컨텍스트 안 1차 캐시에 있는 user객체가 있다. 여기서 이 user를 db에 업로드 함 그럼 그 객체는 => 영속화 된 객체 그리고 그 캐시에서 db로 값을 넣는 행위를 => flush(우리가 버퍼 비울때 쓴 그거) 이게 save함수로 값을 바꾸어서 update할때 일어나는 과정 2. @Transactional 로 update @Transactional이 종료되는 시점 = 그 함수가 종료되는 시점 종료시 commit이 되는거, 값이 변경된걸 감지해서 update한 결과를 수정해줌(=더티체킹) 영속성 컨텍스트는 깃의 스테이징 같은거고 transactional 이 종료된 뒤 db에 값 날아가는게 commit같은 느낌
3. jpa로 테이블 생성하기
·
프로젝트/블로그 제작(중단)
1.user entity package com.cos.blog.model; import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.CreationTimestamp; import javax.persistence.*; import java.sql.Timestamp; @Entity//user 클래스가 MySQL에 테이블 생성이 된다 public class User { @Id //primary key @GeneratedValue(strategy = GenerationType.IDENTITY) // 프로젝트에서 연결된 db의 넘버링 전략을 따라간다. private int id; // 시퀀스,auto_increment @Col..