IntelliJ 에서 다수의 프로젝트에서 공통 프로젝트 하나를 각각 모듈로 추가하여 참조할 때 발생했던 이상 상황.

By | 7월 14, 2021

project A, project B 가 있고, commmon module용 project C가 있다고 할 때, A에서 C를 import module 하고(as maven project) 빌드까지 성공한 후, B에서 C를 import module 하면, 아까 A에서 C가 빠져버리는 현상이 있었다. 다시 A에서 C를 import module 하면, 또 B에 잘 셋팅되어 있던 C가 빠져버리는 무한 반복에 빠지게 되었는데… 삽질하다가 시도해 본 것이,… Read More »

[링크] MyBatis 1:N select 결과 매핑하는 예제 (e.g. 게시물 목록조회시 게시물당 첨부파일목록을 함께 조회하여 그룹핑, group, collection, one to many)

By | 7월 8, 2021

[Mybatis] 1:N 관계 데이터 처리 data concatenation 주의사항 resultMap > collection 을 사용할 경우 collection 의 요소가 두 개 이상일 경우(거의 그렇겠지만) 평범한 페이징으로는 오류가 날 수 밖에 없다. offset, limit 등은 그룹핑 후에 걸어야 하는데, collection의 경우 쿼리가 다 끝나고 그룹핑 되므로 그래서 나는 그냥 resultMap-collection 패턴을 포기하고 주 레코드만 select 후, select된 목록의… Read More »

[Mybatis] 동적쿼리 관련 (if, foreach, test …)

By | 7월 7, 2021

if, foreach 등 샘플코드 <if test='cateIdList != null and cateIdList.size > 0'> cate_id in (<foreach collection="cateIdList" item="cateId" separator=", ">#{cateId}</foreach>) </if> 외따옴표, 쌍따옴표에 숨겨진 의미 https://developyo.tistory.com/242

[java] 문자열 리스트(List) 중복(dup, duplicate) 체크(check)

By | 7월 5, 2021

/** * 매개변수로 받은 문자열 list에 중복이 존재할 경우 true, 아니면 false 리턴 * * @param list * @return */ public static boolean hasDuplicated(List<String> list) { if(list == null){ return false; } Set<String> set = new HashSet<>(list); if(set.size() < list.size()){ return true; } return false; } 참고 https://stackoverflow.com/questions/562894/java-detect-duplicates-in-arraylist

log4j2 에서 특정 문자열이 존재하는 로그의 행(row)을 정규식(regex)로 출력에서 제거하기

By | 6월 30, 2021

<Appenders> <Console name="console" target="SYSTEM_OUT"> … <RegexFilter regex=".*==>\s*(Preparing|Parameters).*" onMatch="DENY" onMismatch="ACCEPT"/> …. </Console> </Appenders> 위 샘플은 org.apache.ibatis.plugin.Intercepts 를 사용하여 parameter bound query log 를 출력시, 기존에 출력해 주던 쿼리 로그가 필요 없어져서 (preparing statement, parameter 등) 해당 부분을 출력에서 제외하는 예제임. <RegexFilter /> 를 하나 더 선언해 봤는데, 처음에 선언한 것만 작동하는 느낌이었음.

json 출력 혹은 swagger 문서에서 VO객체의 일부 필드(멤버) 숨기기 (Spring 4, jackson2, springfox 2.9 환경)

By | 6월 30, 2021

@ApiModelProperty(notes = "책 썸네일 atchFileId", hidden = true) @JsonIgnore private String bookThumbnailFileId; swagger의 모델 정의에서 필드 숨기기 @ApiModelProperty를 아예 필드에 붙이지 않는다. 모종의 이유로 붙였을 경우에는 @ApiModelProperty(hidden = true)를 사용한다. json response 에서 필드 숨기기 @JsonIgnore 를 사용한다. @JsonIgnore는 꼭 com.fasterxml.jackson.annotation.JsonIgnore 을 사용해야 한다. (java 패키지 확인)

[링크] .gitignore 규칙/문법 정리

By | 6월 30, 2021

https://donggov.tistory.com/30 https://ktko.tistory.com/entry/gitignore%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC-%EA%B9%94%EB%81%94%ED%95%98%EA%B2%8C-git-Commit-%ED%95%B4%EB%B3%B4%EA%B8%B0 https://www.atlassian.com/git/tutorials/saving-changes/gitignore

[펌글] Spring Security 에서의 CORS 설정

By | 6월 29, 2021

spring security config 클래스 @EnableWebSecurity public class CustomSecurityConfig extends WebSecurityConfigurerAdapter { … @Override protected void configure(HttpSecurity http) throws Exception { http … .and() .authorizeRequests() .requestMatchers(CorsUtils::isPreFlightRequest).permitAll() // cors setting 1 … .and().cors(); // cors setting 2 } // cors setting 3 @Bean public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); // configuration.addAllowedOrigin("*"); configuration.addAllowedOrigin("http://localhost:3000"); configuration.addAllowedMethod("*"); configuration.addAllowedHeader("*");… Read More »

[nginx] 웹 어플리케이션에 context path가 존재할 경우, webpack 등으로 패킹된 html의 js,css include 구문에서 context path를 생략한 채 자원을 요청하여 404가 발생하는 케이스에 대한 해결

By | 6월 28, 2021

포인트 웹 자원을 include 하는 구문 (href="/xxx", src="/xxx") 의 시작을 절대경로가 아닌 상대경로로 replace 해 주어서 해결함. 수정 전 (nginx > default.conf) … location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-NginX-Proxy true; proxy_pass http://tomcat; proxy_connect_timeout 5; } … 수정 후 (nginx > default.conf) … location /… Read More »

Mybatis 오류 어리둥절 케이스 (Error setting non null for parameter #12 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Could not set parameter at position 12 (values was ‘1’))

By | 6월 23, 2021

이 오류의 해결을 위해서 한참을 헤멨는데, mybatis mapper config 의 jdbcTypeForNull 을 NULL로 해 주라느니 등등 이것저것 해 봤지만 아무리 해도 듣지 않았다. 변수 바인딩 표현식 #{}도 오타/누락 등의 문제 없었고, 파라미터 갯수도 문제 없고. 그러다가 그냥 기존 xml 쿼리를 밀고 다시 짰더니 됐다. -_-… 뭐지..뭐였지…