유저에 @Embedded
로 OAuthInfo, OAuthInfo @Embeddable
넣고 실행하면 에러 뱉어냄
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController' defined in file [/Users/sallyoh/Documents/workspace/airbnb/BE/spring-data-jpa-practice/build/classes/java/main/com/example/springdatajpapractice/controller/UserController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository' defined in com.example.springdatajpapractice.repository.UserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract java.util.Optional com.example.springdatajpapractice.repository.UserRepository.findByOAddressStreet(java.lang.String)! Reason: Failed to create query for method public abstract java.util.Optional com.example.springdatajpapractice.repository.UserRepository.findByOAddressStreet(java.lang.String)! Unable to locate Attribute with the the given name [OAddress] on this ManagedType [com.example.springdatajpapractice.Domain.User]; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.Optional com.example.springdatajpapractice.repository.UserRepository.findByOAddressStreet(java.lang.String)! Unable to locate Attribute with the the given name [OAddress] on this ManagedType [com.example.springdatajpapractice.Domain.User]
JPA가 테이블 이름을 o_auth_info로 생성해서 그런 것 같다ㅠㅠ authInfo로 바꿔주니 잘 됐다..
@AttributionOverrides
를 이용해서 이름을 지정해줄 수 있다는 것 같은데 그건 컬럼명이 될 @Embeddable
의 필드들의 이름을 지정해주는 거라 여전히 에러가 났다.
jwt에 쓰는 secret key는 256비트 이상의 문자열이어야 한다.
ENUM.type.name() → 문자열 얻을 수 있다.
ObjectMapper Java Object → Json: Serialize, Json → Java Object: Deserialize