파란하늘의 지식창고
vaadin 사용해 보기
Study/Java 2023. 9. 19. 05:06

Vaadin 소개 https://vaadin.com/ vaadin은 ui component 구성을 제공해 주는 java기반 웹프레임워크이다. Swing이나 AWT를 작성하는 것처럼 java 코드를 작성하면 요청에 대해 대응되는 web ui를 제공해 준다. ui관련 html, javascript, css 작업을 따로 하지 않아도 되고 Java 대신 TypeScript를 사용할 수도 있다. 기본 기능은 open-source로 제공되며 생산성 향상을 위한 vaadin UI 관련 테스트 도구나 Advanced UI component는 유료로 제공된다. Vue, Svelte 같은 Front-end Framework를 흥미를 가지고 공부해 보았지만 너무나 변화하는 속도가 빠르다 보니 다른 방법이 없을까 싶어 찾아보..

[troubleshooting] Spring Boot 테스트 코드 실행 시 java.lang.NoClassDefFoundError: io/micrometer/context/ThreadLocalAccessor 에러
Study/Java 2023. 8. 18. 05:35

Spring Boot 3.1.1에서 테스트 코드 실행 시 다음과 같은 에러가 발생했다. Caused by: java.lang.IllegalStateException: MicrometerObservationRegistryTestExecutionListener requires micrometer-observation 1.10.8 or higher at org.springframework.test.context.observation.MicrometerObservationRegistryTestExecutionListener.(MicrometerObservationRegistryTestExecutionListener.java:80) ... 59 common frames omitted Caused by: java...

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 Boot Condition Evaluation Report 확인하기
Study/Java 2023. 7. 16. 16:15

Condition Evaluation Report 소개 spring-boot-autoconfigure 를 사용하면 여러 조건에 따라 제공되는 AutoConfiguration 설정들이 활성화 또는 비활성화된다. 예를 들어 DataSource를 사용할 때 DataSource 관련 properties나 bean 설정을 하고 DataSource 관련 jar를 참조하는 경우 DataSourceAutoConfiguration에서 활성화 조건들에 대해 체크한 후 활성화되어 사용자가 일일이 설정하지 않아도 기본적인 설정들을 제공해 준다. Spring Boot는 어떤 AutoConfiguration이 활성화되고 어떤 AutoConfiguration이 비활성화되었는지 확인할 수 있도록 Condition Evaluation..

article thumbnail
STS Newer patch version of Spring Boot available warning disable 처리하기
Study/Java 2023. 7. 10. 19:29

최근 STS를 사용하면 새 Spring 버전이 release 된 내용을 warning으로 알려준다. 4.17.0에 추가된 기능인 듯하다. https://github.com/spring-projects/sts4/issues/885 바로바로 버전을 변경할 수 있는 환경이면 이런 기능이 좋지만 계속 이전 버전을 사용해야 하고 여러 project를 import 해서 사용하고 있는 환경이면 이 warning이 50개 이상 뜨면서 실제로 보고 싶은 다른 유효한 warning을 보는 걸 방해하게 된다. 이런 경우 새 버전 알림 warning을 disable 처리하면 된다. Preferences -> Spring -> Validation -> Versions and Support Ranges를 선택하고 비활성화를 선택..

Jackson ObjectMapper 특정 요청에 대해서만 jsonIgnore 처리하여 응답하기
Study/Java 2023. 7. 5. 19:58

objectMapper를 사용하면 보통 다음처럼 @JsonIgnore 처리를 하여 response 값에서 제외 처리를 하게 된다. public class SomeDomain { private int someFieldA; @JsonIgnore private int someFieldB; @JsonIgnore private String someFieldC; } 전체 공통으로 @JsonIgnore를 사용하지 않고 새로 추가하는 요청에 대해 특정 필드를 숨기고 싶은 경우가 있다. simpleModule로 deserializer를 등록하는 건 전체 공통 적용인 것 같고 @JsonView를 @ResponseBody에 사용하려면 기존에 사용하던 전 구간에 @JsonView를 지정해야 하는 문제가 있다. (exclude..

article thumbnail
Spring Cloud DataFlow 사용해 보기
Study/Java 2023. 7. 3. 17:57

Spring Cloud DataFlow 소개 https://dataflow.spring.io/ Spring Cloud DataFlow 는 data-processing use case에 중점을 두고 application 개발과 배포를 간소화한다. 이를 위해 여러 Spring의 여러 라이브러리가 조합되어 기능을 제공한다. 간략하게 소개하면 Spring Cloud DataFlow 는 Spring Integration 과 Spring Batch 로 작성된 Spring Application을 등록하고 Cloud Platform 배포를 관리하는 도구이다. Spring Cloud Dataflow는 두 가지 방식의 data-processing을 처리한다. Streams - CDC (Change Data Capture)..

[troubleshooting] Spring Boot 3.1.0에서 hibernate cannot be cast 오류 발생
Study/Java 2023. 6. 21. 01:53

Spring Boot 3.1.0으로 적용한 이후 특정 프로젝트가 startup 되지 않는 현상이 발견되었다. 발생한 오류는 다음과 같다. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'someEntityManagerFactory' defined in class path resource [somepackage/config/SomeDataJpaConfig.class]: class org.hibernate.mapping.BasicValue cannot be cast to class org.hibernate.mapping.ToOne (org.hibernate.mapping.BasicValue and o..