728x90 반응형 spring71 [Spring] cannot deserialize from Object value (no delegate- or property-based Creator) 아래와 같은 로직 실행에서 cannot deserialize from Object value (no delegate- or property-based Creator) 가 발생하였습니다. @Getter @AllArgsConstructor public class UserDTO { private String name; private int age; } @RestController public class UserController { @PostMapping(value = "/user", consumes = MediaType.APPLICATION_JSON_VALUE) public String user(@RequestBody UserDTO param) { return param.getName(); } } jacks.. 2021. 8. 18. [Spring Security5] 권한 계층구조(roleHierarchy) 설정 1. roleHierarchy 설정인가 관련해서는 AccessDecisionManager를 사용합니다. SecurityContextHolder에 저장되어있는 Authentication이 접근하는 리소스에 적절한 ROLE을 가지고 있는지 확인합니다. 확인하는 방법은 세 가지(AffirmativeBased, ConsensusBased, UnanimousBased)가 있는데 그중 AffrimativeBased(여러 Voter 중 하나라도 허용하면 허용)를 기본전략으로 사용합니다.<pre id="code_1628819619550" class="java" data-ke-language="java" dat.. 2021. 8. 13. [SpringBoot] Test환경에 H2 적용하기 다음과 같이 db구성이 되어있을때 Test환경에 H2 적용하는 방법입니다. https://moonsiri.tistory.com/53 [Spring] java config로 hikari datasource, transaction aop 설정 pom.xml org.springframework.boot spring-boot-starter-jdbc org.mybatis.spring.boot mybatis-spring-boot-starter 2.1.3 org.apache.commons commons-dbcp2 mysql mysql-connector-java runtime application.ym.. moonsiri.tistory.com 우선 pom.xml에 dependency를 추가합니다. com.h2datab.. 2021. 8. 4. [Spring Security] redis 세션에서 SecurityContext 수정 FindByIndexNameSessionRepository의 save 메소드를 사용하여 SecurityContext 수정할 수 있습니다. @Resource(name = "sessionRepository") private FindByIndexNameSessionRepository findByIndexNameSessionRepository; public void refreshSecurityContext(String targetUsername) { // targetUsername의 session 모두 조회 Map sessionMap = findByIndexNameSessionRepository.findByIndexNameAndIndexValue(FindByIndexNameSessionRepository.PRI.. 2021. 7. 12. [SpringBoot] JPA Projection Projection은 Entity의 속성이 많을 때 일부 데이터만 조회하는 방법입니다. 아래 UserEntity를 참고하여 설명하겠습니다. @Entity @Table(name = "user") @NoArgsConstructor(access = AccessLevel.PROTECTED) public class UserEntity { @Id @Column(name = "user_id", nullable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Long userId; @Column(length = 50, nullable = false) private String name; @Column(length = 50, nullable = .. 2021. 6. 23. [Spring] JPA 연관 관계 매핑 및 제거 user와 dept 테이블을 맵핑하는 user_dept 테이블이 존재할 때, Entity의 객체 연관관계를 맵핑하여 영속 상태의 entity를 만들어 보겠습니다. @Entity@Table(name = "user")@NoArgsConstructor(access = AccessLevel.PROTECTED)public class UserEntity { @Id @Column(name = "user_id", nullable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Long userId; @Column(length = 50, nullable = false) private String name; @.. 2021. 6. 18. [SpringBoot] Mybatis + JPA + QueryDsl 설정 https://moonsiri.tistory.com/53 기존에 설정해둔 DB Configuration에 설정을 추가하겠습니다.Spring Boot에서 MyBatis, JPA, 그리고 QueryDSL을 함께 사용하는 설정 방법을 소개합니다. 1. JPA 설정 pom.xml org.springframework.boot spring-boot-starter-data-jpa DatabaseConfig.java@Configuration@EnableJpaRepositories( basePackages = "com.moonsiri.**.repository", entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef.. 2021. 6. 10. [SpringBoot] Reactive RESTful Web Service 구축 실습 spring.io 가이드를 참조하여 WebFlux 실습을 해보겠습니다. 개념은 이전 포스팅에서 대충 끄적인 걸로 대체하겠습니다. 목표 Spring Webflux 및 해당 서비스의 WebClient consumer로 RESTful 웹 서비스를 구축 환경 Spring Boot 2.4.2 (spring 5 이상) Maven IntelliJ openjdk 11 프로젝트 생성 우선 WebFlux 프로젝트를 생성합니다. 최초 생성 시의 pom.xml 내용입니다. 4.0.0 org.springframework.boot spring-boot-starter-parent 2.4.2 com.moonsiri reactive 0.0.1-SNAPSHOT reactive Reactive RESTful Web Service 11 o.. 2021. 2. 18. [Spring] Reactive Programming (1) - Reactor 3, WebFlux Spring WebFlux The original web framework included in the Spring Framework, Spring Web MVC, was purpose-built for the Servlet API and Servlet containers. The reactive-stack web framework, Spring WebFlux, was added later in version 5.0. It is fully non-blocking, supports Reactive Streams back pressure, and runs on such servers as Netty, Undertow, and Servlet 3.1+ containers. 5.0 버전에 추가된 스프링 웹 플럭스.. 2021. 2. 18. [SpringBoot] Maven Multi-Module Project 생성 multi-module 가이드를 참조하여 Spring Boot로 멀티 모듈 프로젝트를 생성하는 스터디를 해보겠습니다. 멀티 모듈 프로젝트? 멀티 모듈 프로젝트는 기존의 단일 프로젝트를 프로젝트 안의 모듈로서 가질 수 있는 구조를 제공합니다. 장단점 장점 재사용, 공유 할 수 있다 빌드를 쉽게 할 수 있다 변경으로 인한 영향 최소화가 가능하다 의존성을 최소화한다. 목표 재사용 가능한 라이브러리를 생성하여 해당 라이브러리를 사용하여 "Hello, World" 메시지를 리턴하는 api 애플리케이션 빌드 환경 Spring Boot 2.4.2 Maven IntelliJ openjdk 11 프로젝트 생성 우선 스프링 부트 프로젝트 생성해봅니다. 모듈 생성 그다음 모듈을 생성하겠습니다. 위와 같은 방법으로 "api".. 2021. 2. 18. 이전 1 2 3 4 5 6 7 8 다음 728x90 반응형