반응형

Framework 73

[Error] The propertyClass in JsonTypeDescriptor is null, hence it doesn't know to what Java Object type to map the JSON column value that was read from the database!

org.hibernate.HibernateException: The propertyClass in JsonTypeDescriptor is null, hence it doesn't know to what Java Object type to map the JSON column value that was read from the database! spring.jpa.hibernate.ddl-auto=create로 설정해서 실행하면 테이블이 생성된다. JSON 필드가 있는 테이블이 잘 생성되길래 문제가 없을 줄 알았는데.. DB에서 읽어올 때 문제가 생김~ 해결 과정 1. 버전 변경 Hibernate 5.1.2 버전을 사용중이었다. implementation 'io.hypersistence:hypersisten..

엔티티의 필드 타입으로 JSON 사용하기

implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'io.hypersistence:hypersistence-utils-hibernate-5:3.1.1' 의존성 추가 실행할 때 hibernate 버전 보고, https://github.com/vladmihalcea/hypersistence-utils 여기에서 맞는 hypersistence-utils를 찾았다. @Type(type="json") @Column(columnDefinition = "json") private Profile profile; json을 필드에 적용했다. @TypeDef(name = "json", typeClass = JsonType..

[Error] "The specified key byte array is 128 bits which is not secure enough for any JWT HMAC-SHA algorithm.

{ "response": "error", "message": "로그인에 실패했습니다.", "data": "The specified key byte array is 128 bits which is not secure enough for any JWT HMAC-SHA algorithm. The JWT JWA Specification (RFC 7518, Section 3.2) states that keys used with HMAC-SHA algorithms MUST have a size >= 256 bits (the key size must be greater than or equal to the hash output size). Consider using the io.jsonwebtoken.security..

[Error] Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource

의존성에 mysql-connector-j를 빼먹으면 다음과 같은 로그가 나온다. 초기에 dependencies를 구성할 때 실수로라도 빼먹지말자!!!! org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'data..

트랜잭션

⭐ 트랜잭션 DB 상태를 변환시키는 한 번에 수행되어야 할 일련의 연산 수행 단위 작업을 수행하던 도중 문제가 발생하면 이전에 진행되었던 작업도 취소됨 Rollback 트랜잭션이 비정상적으로 종료되면 모든 연산을 취소해서 DB에 반영하지 않음 커밋 트랜잭션의 작업이 정상적으로 끝나면 DB에 반영 성질 Atomicity 하나의 트랜잭션은 최소의 단위 Consistency 트랜잭션의 일부가 DB에 commit되었을 때 트랜잭션의 범위에 있는 다른 연산들도 commit 되는 것을 보장 Isolation 다른 트랜잭션의 연산작업이 기존 작업에 영향을 주지 못한다. Durability 트랜잭션을 처리한 후 DB에 반영된 내용은 영원히 지속됨 상태 Active 진행 중 Partially Committed 연산을 모..

OAuth2User

public interface OAuth2User extends OAuth2AuthenticatedPrincipal OAuth 2.0 provider에 등록된 user principal을 표시 OAuth 2.0 사용자는 하나 이상의 속성들로(예를 들어, first name, middle name, last name, 이메일, 연락처, 주소 등) 구성된다. 각 사용자 속성은 name, value를 가지고 있고 OAuth2AuthenticatedPrincipal.getAttributes()의 name에 의해 키 입력된다. 속성 이름은 providers 간에 표준화되지 않으므로 다르다. 이 인터페이스의 구현 인스턴스는 인증 객체와 연결되어 Authentication.getPrincipal()을 통해 액세스할 ..

[Error] ModelMapper 매핑이 안될 때

.setFieldMatchingEnabled(true) ModelMapper 빈을 등록할 때 설정해주자. Field matching은 필드를 매칭시킬 수 있는지를 나타낸다. 기본값은 disabled로 설정되어있다. 참고 👇 http://modelmapper.org/user-manual/configuration/ ModelMapper - Configuration Configuration ModelMapper uses a set of conventions and configuration to determine which source and destination properties match each other. Available configuration, along with default values, is..

ModelMapper Matching Strategy 정리

Matching Strategy Standard 기본값 MatchingStrategies.STANDARD Token들은 임의의 순서로 매칭될 수 있다. 모든 destination 속성 이름 토큰이 무조건 매칭되어야 한다. 모든 source 속성명에 매칭될 토큰이 하나 이상 있어야 한다. 정확하지 않은 반면에 대부분의 상황에서 이상적이다. Loose MatchingStrategies.LOOSE Token들은 임의의 순서로 매칭될 수 있다. 마지막 destination 속성 이름은 모든 토큰이 매칭되어야 한다. 마지막 source 속성 이름에는 매칭될 토큰이 하나 이상 있어야 한다. 매우 다른 속성 계층을 가진 source와 destination 개체 모델에 사용하는 것이 이상적이다. 더 높은 수준의 모호한..

반응형