본문 바로가기

반응형

Study/Java

(183)
Spring Cloud Config Server jdbc backend 사용해보기 개인적으로 spring cloud config server를 github repository와 연동해서 사용하고 있었다. 평상시 크게 불편함을 느끼지 못했는데 config server의 설정을 변경할 일이 있을 경우 손쉽게 값을 변경하기 어려워 테스트 하기 불편하여 jdbc로 변경하려고 한다. Spring Cloud Config Server backend 구성 spring cloud config server는 다양한 backend를 구성할 수 있도록 autoconfiguration을 지원하고 있다. EnvironmentRepositoryConfiguration에서 다양한 backend 구성 환경에 대한 설정을 제공하고 있는데 대략 다음과 같다. 이 중에 원하는 환경으로 구성하면 된다. Environmen..
@Validated annotation을 controller가 아닌 service, component layer에서 사용하기 @Controller가 아닌 @Service, @Component 등에서 @Validated 사용하기 일반적으로 @Controller에서 @Validated를 사용하여 validation을 사용한다. @PostMapping public BlogArticle create(@RequestBody @Validated(BlogArticle.Create.class) BlogArticle blogArticle) { return blogArticleService.create(blogArticle); } service나 component에서도 @Validated annotation을 사용할 수 있다. 다만 controller에서 사용하는 것과 그 외의 layer에서 사용하는 방법이 좀 차이가 있다. @Service @..
[troubleshooting] eclipse (STS) 에서 refactor rename이 동작하지 않는 현상 어느 순간 eclipse (STS)에서 rename을 동작하지 않았다. 단축키 alt + shift + r 도 사용이 되지 않는다. https://stackoverflow.com/questions/71763208/after-eclipse-update-refactor-rename-doesnt-work-anymore After Eclipse-Update, refactor-rename doesn't work anymore After Updating to 4.23.0 (2022-03), refactor-rename doesn't work anymore. When I open the refactoring menu, the option "rename" shows up but it doesn't rename the ..
Spring Boot project STS에서 열어보기 Spring Boot 소스 보기 Spring의 소스들은 현재 github에 공개되어 있다. 가끔 source jar로 보는 게 아닌 현재 사용하려는 최신 릴리즈(지금의 경우 Spring Boot 2.7.0)의 모든 소스를 보고 싶은 경우가 있다. git 주소를 가져와 STS git repository에 추가하면 main branch를 가져오는데 main branch의 경우 계속 개발이 추가되고 있고 현재 시점에서 2.7.0 다음 버전이 개발 중이다. 따라서 지금 spring boot main branch를 가져오면 개발 중인 3.0.0-SNAPSHOT을 보게 된다. Spring Boot의 경우 각 버전을 releaase 할 때마다 tag를 이용해 표시해둔다. Github Spring Project의 Sp..
Spring Boot 2.7 Release Notes 전체 Release Notes 목록은 이 곳에서 확인할 수 있습니다. https://luvstudy.tistory.com/tag/Release%20Notes https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.7-Release-Notes Upgrading from Spring Boot 2.6 @SpringBootTest Property Source Precendence properties attribute 또는 @TestPropertySource annotation을 사용하여 @SpringBootTest 가 추가한 test property source가 이제 command line property source 위에 추가되었습니다. (동일한..
maven project에서 junit 5, assertJ 사용하기 소개 시간이 지나면 더 좋은 테스트 코드 작성 방법이 나오겠지만 이 글을 작성하는 현재로선 개인적으로 junit 5와 assertJ를 같이 사용하는 게 좋아 보인다. junit 5 junit은 java에서 테스트 코드 작성을 위해 많이 쓰이는 라이브러리이다. Spock, TestNG, Serenity, Selenide, Gauge, Geb, HttpUnit 등 수많은 test framework이 있는데 그중 가장 인기 있는 라이브러리이다. https://junit.org/junit5/docs/current/user-guide/ assertJ assertJ는 junit이 제공하는 assert 보다 사용하기 편한 문법을 제공한다. 검증할 값의 class type별 문법을 찾아봐야 하는 junit의 asser..
LWJGL 공부 내용 기록 (Java로 게임 개발하기) 시작하기 전 대상 강의 유튜브에 "Code a 2D Game Engine using Java - Full Course for Beginners"라는 23시간 50분짜리 강의 영상이 있어 흥미롭게 보았다. https://www.youtube.com/watch?v=025QFeZfeyM Java에서 마리오 게임을 만드는 걸 알려주는 강의인데 총 55 챕터로 되어 있고 추가적으로 Part2로 3개의 챕터가 별도 유튜브로 있다. https://www.youtube.com/watch?v=roPRqEQZFu8 javaFX나 swing을 쓰는 데가 있는지 모르겠지만 오래된 기억에 예전에 둘러보았을 때도 선호하지 않았는데 시간이 지나니 대안 라이브러리가 나오고 그에 대한 유튜브 강의가 있었다. 이 글은 해당 강의를 학습..
Spring Framework 보안 업데이트 권고 (CVE-2022-22965, CVE-2022-22963) 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 ..

반응형