본문 바로가기
728x90
반응형

spring69

[Spring] AOP와 @EnableAspectJAutoProxy Spring AOP (Aspect Oriented Programming) AOP는 Aspect Oriented Programming의 약자로 관점 지향 프로그래밍이라고 불립니다. 쉽게 말해 관점에 따라 각각 모듈화(어떤 공통된 로직이나 기능을 하나의 단위로 묶음)하겠다는 것입니다. 소스 코드에서 여러 코드에서 반복해서 사용하는 코드를 발견할 수 있는데 이것을 흩어진 관심사(Crosscutting Concerns)라고 합니다. 흩어진 관심사를 Aspect로 모듈화하고 핵심적인 비지니스 로직에서 분리하여 재사용하겠다는 것이 AOP의 취지입니다. AOP 주요 개념 Aspect : 흩어진 관심사를 모듈화 한 것 Target : Aspect를 적용하는 곳 (ElementType 등) Advice : 실질적인 부가.. 2022. 4. 27.
[Spring Security] DelegatingPasswordEncoder와 BCryptPasswordEncoder strength에 따른 수행시간 DelegatingPasswordEncoder에 대해 정리하기 전에, 스프링 시큐리티 래퍼런스 내용을 살펴보겠습니다. Srping Password Storage Spring Security’s PasswordEncoder interface is used to perform a one way transformation of a password to allow the password to be stored securely. Given PasswordEncoder is a one way transformation, it is not intended when the password transformation needs to be two way (i.e. storing credentials used to auth.. 2022. 3. 20.
[Spring Batch4] batch step에서 processor chaining하는 방법 다음과 같은 batch step이 존재할 때, processor를 추가하기 위해선 어떻게 해야 할까요?@Beanpublic Job ioSampleJob() { return this.jobBuilderFactory.get("ioSampleJob") .start(step1()) .build();}@Beanpublic Step step1() { return this.stepBuilderFactory.get("step1") .chunk(2) .reader(fooReader()) .processor(fooProcessor()) .writer(barWriter()) .build();}public class Foo {}public class Bar { public Bar(F.. 2022. 2. 4.
[Spring] java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags Maven install 시, java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags 에러 발생. lombok 버전 업으로 문제 해결. org.projectlombok lombok 1.18.6 2021. 11. 30.
[Spring Batch] org.springframework.dao.EmptyResultDataAccessException: Item 0 of 500 did not update any rows Spring Batch 실행 시 아래와 같은 오류가 발생했습니다.org.springframework.dao.EmptyResultDataAccessException: Item 0 of 500 did not update any rows: [...] at org.mybatis.spring.batch.MyBatisBatchItemWriter.write(MyBatisBatchItemWriter.java:161) at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:193) at org.springframework.batch.core.step.item.SimpleChunk.. 2021. 11. 18.
[Maven Build Error] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project : Fatal error compiling 메이븐 빌드 시 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project : Fatal error compiling 와 같은 오류가 발생했다면 jdk 버전을 확인해보면됩니다. 2021. 11. 17.
[Spring] dynamic Scheduler 다이나믹 스케줄링 @ImportResource({ "classpath:scheduler/context-scheduler.xml" }) 나 @Scheduled 어노테이션을 사용하지 않고 스케줄을 동적으로 등록하는 두가지 방법을 알아보겠습니다.  1. ThreadPoolTaskScheduler꼭 아래 예시와 같이 사용할 필욘 없지만, Map에 scheduler를 저장해놓고 destroy 할 수 있습니다.@Servicepublic class SchedulerServiceImpl implements SchedulerService { private final Map schedulerMap = new ConcurrentHashMap(); public SchedulerServiceImpl() { Set typeList = ...; .. 2021. 11. 9.
[Spring Batch] step 중지/통과 하기 Step 실행 중일 때 다음 단계로 넘어가지 않고 중지하는 방법은 throw 하면 됩니다. public class PoisonPillItemProcessor implements ItemProcessor { @Override public T process(T item) throws Exception { if (isPoisonPill(item)) { throw new PoisonPillException("Poison pill detected: " + item); } return item; } } 이번 단계는 지나치고 다음 단계로 넘어가는 방법은 null을 리턴하면됩니다. public class PoisonPillItemProcessor implements ItemProcessor { @Override pub.. 2021. 10. 21.
[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.
728x90
반응형