일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 새글
- 자바
- new아이콘
- 접속권한
- 권한부여
- springboot
- 톰캣
- Timeout
- CentOS
- 최대최소
- vi
- Log4j
- 정해진기간동안
- java
- Spring
- ip체크
- tomcat
- indexof
- Iterator
- String
- lombok
- login
- SAMBA
- new
- Interceptor
- Linux
- session
- swagger
- 배열
- Today
- Total
목록Back End (10)
Cheat Sheet

spring fox(x), spring doc(o) [ build.gradle 추가 ] implementation 'org.springdoc:springdoc-openapi-ui:1.6.6' [ application.properties 추가 ] springdoc.packages-to-scan=org.zerock.corp_1.controller springdoc.paths-to-exclude=/notes/* springdoc.default-consumes-media-type= media-type: application/json;charset=UTF-8 springdoc.default-produces-media-type= application/json;charset=UTF-8 springdoc.swagger..

[ build.gradle ] dependencies { ... compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' ... } [ log4jdbc.log4j2.properties ] log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator log4jdbc.dump.sql.maxlinelength=0 [ lombok 다운로드 ] https://projectlombok.org/download 1. lombok.jar 실행 2. 2-1. IDE 경로 설정 2-2. install [ 사용 ] import java.util.Date;..
[ gradle ] //Log4j2 프레임워크의 종속성을 추가 dependencies { ... implementation 'org.springframework.boot:spring-boot-starter-log4j2' ... } //기존 자바 로깅 프레임워크인 logback의 종속성을 제거 configurations { compileOnly { extendsFrom annotationProcessor } //추가 all { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' } } [ application.properties ] //추가 logging.level.jdbc.sqlonly=off logging.le..

Interceptor : controller에 요청이 도달하기전 수행하거나, 도달한 뒤에 수행하는 것 주로, 로그인체크를 할 때 쓰인다. 페이지에 접속할때 로그인유무를 파악하고 로그인이 되있지 않으면 로그인화면으로 넘기는 식으로 많이 사용하는 것 같다. Interceptor은 HandlerInterceptor 인터페이스를 상속받은 HandlerInterceptorAdapter클래스를 상속받아 사용하는데 3가지 메소드가 존재한다. * public boolean preHandle() : 요청이 들어오고 controller로 요청이 가기전 수행할 코드 작성 * public void postHandle() : 요청이 controller의 로직을 수행하고 나서 dispatcherservlet에 도달하기전 수행할 ..

자바 String클래스의 indexOf()함수는 package array; public class indexOf_test { public static void main(String[] args) { String test = "abc"; System.out.println(test.indexOf("a")); System.out.println("-----------------------"); System.out.println(test.indexOf("d")); } } 위의 예제코드에서 abc라는 문자열에서 a라는 글자가 몇번째에 나오는지 알려주는 메소드이다. 여기서 결과는 index는 0부터 시작되므로 a는 0번째, d는 "abc"라는 문자열에 존재하지 않으므로 -1이 출력된다.

Iterator는 자바의 컬렉션 프레임워크에서 컬렉션에 저장되어 있는 요소들을 읽어오는 방법을 표준화한 것이다. 컬렉션 프레임워크는 3가지 인터페이스로 구성된다. Set : 순서유지x 데이터중복허용x List : 순서유지o 데이터 중복허용o Map : 키(key) + 값(Value)으로 이루어짐. 순서유지x 키는 중복허용x *출처 : https://shxrecord.tistory.com/74 어찌됬건 이렇게 컬렉션 프레임워크마다 데이터를 가져오는 메소드들도 다르고, 방법도 달라서 Iterator인터페이스를 이용해 데이터를 가져오게 된다. // * Iterator(인터페이스)는 컬렉션에 저장되어 있는 요소들을 읽어오는 방법을 표준화 한 것이다. public interface Iterator { boolea..
HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest(); String ip = req.getHeader("X-FORWARDED-FOR"); if (ip == null || ip.length() == 0) { ip = req.getHeader("Proxy-Client-IP"); } if (ip == null || ip.length() == 0) { ip = req.getHeader("WL-Proxy-Client-IP"); } if (ip == null || ip.length() == 0) { ip = req.getRemoteAddr() ; } 변수 ip에는 현..