[링크] .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 쿼리를 밀고 다시 짰더니 됐다. -_-… 뭐지..뭐였지…

Spring 4 JUnit 테스트 샘플 코드 (Spring 4.3.16 기준, Spring boot 예제 아님)

By | 6월 14, 2021

pom.xml <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.3.16</version> </dependency> TestJUnit.java package twopro; // 테스트코드에서도 log4j를 사용하고 싶다면 패키지는 꼭 필요한 듯. import cmm.jwt.TokenProvider; import lombok.extern.slf4j.Slf4j; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; /** * JUnit 테스트 * * @author 이프로 * @version 2021.06… Read More »

크롬에서 특정 리소스(e.g. image, js …) 들만 http 403 에러가 나던 희한한 케이스

By | 6월 12, 2021

잘 쓰던 우리 크롬이 어느 날.. 쿠팡 상품상세 페이지 로딩도 실패하고, 네이버 블로그 이미지도 안보이고, 네이버 로그인 하니 계속 영수증 내용 입력하라고 나오고… 알 수 없는 행동들을 했다. 웨일이나 오페라 같은 것들은 다 정상적으로 보이는데 유독 크롬만! 한참을 이유를 알 수 없어 헤메다가, 일부 정적 자원들에 대한 요청이 http 403으로 실패하는 것을 발견했고, fiddler로 request… Read More »

java 정규식(regex)을 사용하여 2회 이상 반복되는 정규식 패턴의 문자열을 각각 치환(replace)하는 예제

By | 5월 11, 2021

하려고 하는 작업 특정 문자열에서 메타문자 {WRAP}{/WRAP}로 감싸진 숫자를 찾아서 마스킹 처리를 하고 {WRAP}{/WRAP} 메타문자는 삭제하고 싶다. String dtl = "블라블라 {WRAP}123456{/WRAP} 어쩌구 저쩌구 {WRAP}987654{/WRAP} 마무으리 등등등…"; Matcher matcher = Pattern.compile("\\{WRAP\\}(\\d*)\\{/WRAP\\}"); // grouping을 하나 한 것에 주목 StringBuffer sb = new StringBuffer(); while(matcher.find()){ // 계속해서 결과를 찾아간다. //문자열 맨 앞에서부터 sb에 붙여나가면서 치환 처리까지 수행한다.… Read More »

javascript의 백그라운드 실행(멀티스레드)을 가능하게 해 주는 web worker 샘플 코드

By | 5월 6, 2021

메인 페이지의 js /** * Web Worker 인스턴스 생성 및 호출 */ if (!! window.Worker) { var worker = new Worker('../resources/js/workerSample.js'); // 현재 페이지의 브라우저 URL에 대한 '상대경로'로 작성해야만 한다. // console.log('## worker:['+ JSON.stringify(worker) +']'); // worker가 준 메시지에 대한 이벤트 핸들러 worker.onmessage = function(e) { onWorkerResponse(e.data); worker.terminate(); // 최초 1회만 실행 후 제거 }… Read More »

java.lang.reflect.GenericSignatureFormatError: Signature Parse error: Expected Field Type Signature 에러 사례

By | 5월 6, 2021

왜인지 모르겠으나…(협업 환경에서 잘못된 오버라이드?) IDE의 JDK 언어 레벨이 5로 되어 있어서, 람다식 등의 시그니처를 인식하지 못한 것으로 추측된다. 다시 IDE의 JDK 버전을 8로 맞추어 줬더니 정상동작 했다. 아오.. 갈 길이 바쁜데 이런 거 발목 좀 안 잡았으면 좋겠네. -_-/