파란하늘의 지식창고
Spring의 SpEL 을 custom하게 사용해 보기
Study/Java 2024. 2. 5. 00:20

Spring은 SpEL (Spring Expression Language)를 제공하고 있다. Spring Expression Language (SpEL) RequestMapping이나 value binding 등 Spring을 사용하는 수많은 부분에 SpEL을 사용할 수 있고 다양한 기능을 지원한다. Literal expressions Boolean and relational operators Regular expressions Class expressions Accessing properties, arrays, lists, and maps Method invocation Assignment Calling constructors Bean references Array construction Inline ..

Spring에서 URL의 PathVariable을 Filter 단계에서 호출하여 사용하기
Study/Java 2024. 2. 3. 22:14

@PathVariable 변수의 사용 Spring의 RequestMapping은 다음과 같이 고정 값이 아닌 path variable을 지정하여 사용할 수 있다. @GetMapping("/{projectId}/setting/{mainMenuId}/{subMenuId}") public String page(@PathVariable String projectId, @PathVariable mainMenuId, @PathVariable String subMenuId) { // ... 생략 } 이렇게 설정되는 PathVariable 은 HandlerMethodArgumentResolver 중 PathVariableMethodArgumentResolver 를 통해 requestAttribute에 해당 값 들이 추..

article thumbnail
annotation 을 가진 class 검색에 reflection util 대신 Spring TypeFilter 사용으로 대체하기
Study/Java 2023. 7. 31. 01:04

Reflection 소개 reflection 은 java의 classpath metadata를 scan 하고 캐싱하는 라이브러리이다. https://github.com/ronmamo/reflections 다음과 같은 것들을 scan 할 수 있다. type의 subtype annotation으로 주석이 달린 type annotatoin, parameters, return type이 있는 method classpath 경로에서 찾을 수 있는 resource ... 사용 방법은 간단하다. dependency를 추가하고 # Maven org.reflections reflections 0.10.2 # Gradle implementation 'org.reflections:reflections:0.10.2' 다음과 ..

Spring Framework 6.0.x 이후 Web 에러 처리 - ProblemDetail 사용하기
Study/Java 2023. 1. 18. 20:32

Spring Framework web의 기존 에러 처리 기존 Spring Framework를 사용하여 웹을 구현하면 기본적으로 제공되는 에러 처리를 사용한 에러 응답 결과는 다음과 같은 형태였다. { "timestamp":1417379464584, "status":400, "error":"Bad Request", "exception":"org.springframework.web.bind.MethodArgumentNotValidException", "message":"Validation failed for argument at index 0 in method: public org.springframework.http.ResponseEntity test.UserController.testUser(test.U..

Upgrading to Spring Framework 6.x
Study/Java 2022. 12. 1. 17:24

https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x 이 페이지에서는 Spring Framework 6.0으로 upgrade 하는 방법에 대한 지침을 제공합니다. Upgrading to Version 6.1 69 revisions 기준으로 작성됨 Baseline upgrades Spring Framework 6.1은 다음 library를 통해 최소 요구 사항을 높였다: SnakeYAML 2.0 Jackson 2.14 Kotlin Coroutines 1.7 Kotlin Serialization 1.5 Removed APIs 더 이상 사용되지 않는 여러 class, constructor 및 metho..

What's New in Spring Framework 6.x
Study/Java 2022. 11. 30. 01:28

https://github.com/spring-projects/spring-framework/wiki/What%27s-New-in-Spring-Framework-6.x 106 revision 기준으로 작성됨 What's New in Version 6.1 Core Container virtual threads 및 JDK 21와 전반적으로 호환됨. virtual thread에 대한 Configuration option: 전용 VirtualThreadTaskExecutor 와 SimpleAsyncTaskExecutor의 virtual threads mode, 그리고 new-thread-per-task strategy 와 virtual threads mode가 있는 유사한 SimpleAsyncTaskSchedu..

Spring Framework 보안 업데이트 권고 (CVE-2022-22965, CVE-2022-22963)
Study/Java 2022. 4. 4. 08:19

Spring Framework 취약점 관련 보안 업데이트 권고 관련 보안 공지가 3월 31일 올라왔다. https://krcert.or.kr/data/secNoticeView.do?bulletin_writing_sequence=66592 취약점은 2가지인데 CVE-2022-22965, CVE-2022-22963이다. CVE-2022-22965 (Spring4Shell) CVE-2022-22965는 Spring Core에서 발생하는 원격코드 실행 취약점이다. https://tanzu.vmware.com/security/cve-2022-22965 해당 경우가 발생하는 전제 조건은 다음과 같다. JDK 9 or higher Apache Tomcat as the Servlet container Packaged ..

article thumbnail
JDK LTS release 2년 주기 전환 및 Spring의 release 정책
Study/Java 2022. 1. 12. 16:01

JDK version Java SE 5 이전 자바는 JDK 1.0, JDK 1.1, J2SE 1.2, J2SE 1.3, J2SE 1.4처럼 1.x로 버전을 관리하였다. 이후 6, 7, 8과 같은 숫자로 변경이 되었는데 이때 이후 각 버전 별 업데이트가 계속 올라가게 된다. (관련 히스토리는 너무 길어 링크로 대체함) https://namu.wiki/w/Java/%EB%B2%84%EC%A0%84%20%EC%A0%95%EB%B3%B4 각 버전 별 업데이트 관리를 해야 하는 부담이 커지자 오라클은 상용과 오픈소스를 나누기로 하고 openjdk와 oraclejdk를 분리하고 6개월 주기로 major 버전을 변경하고 3년 주기로 LTS (Long Term Support) 버전을 관리하기로 하였다. 이에 대해서는 ..