본문 바로가기

분류 전체보기110

Spring에서 XML 형식 응답 처리 방법 Spring에서 API의 응답을 일반적인 JSON 형식이 아니라 XML 형식으로 응답하는 방법에 대해 정리합니다. 1. build.gradle에 jackson-dataformat-xml 라이브러리를 추가합니다. https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml 를 참고하여 현재 프로젝트의 의존성에 맞는 버전으로 추가합니다. implementation (group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.13.3') 2. JacksonConfig 클래스를 추가합니다. @Configuration.. 2023. 12. 6.
JUnit5를 이용하여 Java 테스트 코드 작성하기 (JUnit5 기준 작성) 자주 사용하는 assert 관련 method assertTure assertFalse assertEquals assertNotEquals assertThrowsExactly assertInstanceOf assertThrowsExactly example assertThrows(ExpectedException.class, () -> Method to test); 다른 bean과 의존 관계 있는 경우 Mock 사용 class ServiceTest { private AutoCloseable openMocks; private Service service; @Mock private OtherService otherService; @BeforeEach void setUp() { openM.. 2022. 12. 22.
사설 IP와 공인 IP 대역 업무를 하면서 이 IP가 사설 IP인지, 공인 IP 인지 구분해야 하는 경우가 자주 있어서 메모해두기 ❕ 사설 IP A 클래스 10.0.0.0 ~ 10.255.255.255 B 클래스 172.16.0.0 ~ 172.31.255.255 C 클래스 192.168.0.0 ~ 192.168.255.255 공인 IP A 클래스 0.0.0.0 ~ 9.255.255.255 11.0.0.0 ~ 126.255.255.255 B 클래스 128.0.0.0 ~ 172.15.255.255 172.32.0.0 ~ 191.255.255.255 C 클래스 192.0.0.0 ~ 192.167.255.255 192.169.0.0 ~ 223.255.255 2022. 12. 22.
[Build 에러] Cannot find JAR required by module 'gradle-dependency-management' IntelliJ에서 갑자기 아래와 같은 에러가 뜨면서 build가 안되는 현상이 발생함 -> gradlew 버전을 all > bin 으로 수정하여 해결 Error:Cannot find JAR 'http-client:4.5.10.jar' required by module 'gradle-dependency-management' using classpath or distribution directory '*\.gradle\wrapper\dists\gradle-6.5.1-all\*\gradle-6.5.1' https://stackoverflow.com/questions/34701738/how-to-fix-errorcannot-find-jar-ivy-2-2-0-jar-required-by-module-gradle.. 2022. 11. 2.