반응형 개발96 [Spring Boot] spring security - CSRF 적용 , +) ajax csrf 적용 1. gradle 혹은 maven에 'spring-boot-starter-security' 추가 implementation 'org.springframework.boot:spring-boot-starter-security' org.springframework.boot spring-boot-starter-security 2.5.5 Spring Security는 스프링 기반의 어플리케이션 보안을 담당하는 프레임워크로 Spring Security를 사용하면 보안처리를 간단하면서 강력하게 구현가능하다! 2. XXXXApplication.java에 @EnableWebSecurity 선언 @EnableWebSecurity :Spring Security를 활성화 @EnableWebSecurity @SpringBoot.. 2021. 12. 7. [softhsm] windows에 softhsm2 설치 및 세팅 1. softhsm 다운로드 및 설치 https://sourceforge.net/projects/softhsm4windows SoftHSM for Windows Download SoftHSM for Windows for free. SoftHSM installer for MS Windows. Binary builds and MSI installers of SoftHSM for MS Windows platform. Please visit project website - https://github.com/disig/SoftHSM2-for-Windows - for more information. sourceforge.net 2. 환경변수 세팅 설치 경로/README.txt 파일 참조 시스템 변수에 SOFTHSM.. 2021. 12. 6. [Spring Boot] mybatis 적용하기 1.gradle 혹은 maven에 'mybatis-spring-boot-starter' 추가 compile("org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.4") org.mybatis.spring.boot mybatis-spring-boot-starter 2.1.4 2. application.yml에 mybatis 설정 파일(mybatis-config.xml) 및 xml 파일 세팅 mybatis: config-location: classpath:mybatis-config.xml mapper-locations: classpath:mapper/postgresql/*.xml 3. mybatis-config.xml 4. postgresql/*.xml SELE.. 2021. 12. 6. [JD-GUI] java 9 이상에서 실행 오류 : module java.base does not "opens jdk.internal.loader" to unnamed module 소스를 디컴파일할 때 JD-GUI를 사용하는데 갑자기 아래와 같은 에러가 발생하면서 실행이 되지 않았다. WARNING: All illegal access operations will be denied in a future release Exception in thread "main" java.lang.reflect.InaccessibleObjectException: Unable to make jdk.internal.loader.ClassLoaders$AppClassLoader(jdk.internal.loader.ClassLoaders$PlatformClassLoader,jdk.internal.loader.URLClassPath) accessible: module java.base does not "op.. 2021. 12. 3. [JPA] 데이터를 insert 하기 전에 select하는 이유 JPA를 이용하여 DB에 데이터를 insert하게 되면 id를 조건으로 select를 먼저 하고, insert를 하는 것을 확인할 수 있다. (JPA는 조회 후 데이터가 존재한다면 update를 실행하고 존재하지 않으면 insert를 실행한다.) 대량 데이터를 처리하려다 보니 savaAll을 사용하게 되었는데, xxxRepository.saveAll(entity); 1000건의 데이터를 한번에 등록하려면 select를 1000번 실행하는..... JPA가 편리하긴 한데.. 이런 부분은.. 참 그렇다 그래서 save() 메소드가 어떻게 처리되고 있는지 살펴봤다. @Transactional public S save(S entity) { if (entityInformation.isNew(entity)) { e.. 2021. 12. 2. [JSP/HTML] ERR_CACHE_MISS 에러 발생 웹페이지(jsp, html)에서 뒤로가기를 했을 때 'ERR_CACHE_MISS' 에러가 발생한 적이 있다 이럴 경우 아래와 같이 해결하면 된다! jsp나 html과 같은 웹페이지 상단에 header 추가 response.setHeader("Cache-Control","no-cache); response.setHeader("Pragma","no-cache"); spring 설정에서 공통으로 처리 본인은 csrf 처리 때문에 WebSecurityConfigurerAdapter를 상속받은 classs가 있었고, configure 메소드를 오버라이드하여 csrf 방어코드를 세팅하였다. 그래서 이 부분에 캐시 방지 코드를 추가하여 작성함! @Override protected void configure(HttpS.. 2021. 12. 1. [MyBatis] 변수 사용시 #{value}, ${value}의 차이 지난번에 회사에서 얘기를 나누다보니 모르는 사람도 있길래 정리해본다! 1. #{} 사용 SELECT * FROM USER WHERE USER_ID = #{user_id} user_id의 값이 test라면 아래와 같은 쿼리가 실행된다. SELECT * FROM USER WHERE USER_ID = 'test'; 2. ${} 사용 SELECT * FROM USER WHERE USER_ID = ${user_id} user_id의 값이 test라면 아래와 같은 쿼리가 실행된다. SELECT * FROM USER WHERE USER_ID = test ${}를 사용할 경우 작은따옴표가 안붙기때문에 예약어나 칼럼명 등을 사용할 때 적용하면 된다 예를 들어 아래와 같이 쿼리를 작성했을 경우 SUM( CASE WHEN .. 2021. 11. 30. [Ajax] 파일 file 다운로드 받기 결론부터 말하자면 xhr.responseType = "blob" 로 설정해야 한다! 기존에 사용하던 제이쿼리 버전이 1.11.1이였는데 이 버전은 blob이 적용안되더라.. 버전 문제인줄 모르고 한참을 씨름 했는데 3.6.0으로 올리니까 해결됐다. (어떤 버전부터 되는 건지는 모르겠음) 아래 예시 참조!! let options = { url: "[[@{/}]]download" , beforeSubmit : loadingAjaxImage , contentType: "application/x-www-form-urlencoded;charset=UTF-8" , xhr: function () { let xhr = new XMLHttpRequest(); xhr.onreadystatechange = function .. 2021. 11. 30. 이전 1 ··· 8 9 10 11 12 다음 728x90 반응형