본문 바로가기

[Spring boot] Spring boot - nginx + tomcat 연동시 리얼 아이피 설정 방법 1.application.properties 또는 yml 에server.tomcat.protocol-header=x-forwarded-proto server.tomcat.protocol-header-https-value=https server.use-forward-headers=true server.tomcat.remote-ip-header=x-forwarded-for 를 추가하여준다. 2. nginx.conf 에 location / { proxy_pass http://argos-api; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Hos..
[Mysql] Mysql을 사용하면서 하지 말아야할 17가지 *MySQL 쓰면서 하지 말아야 할 것 17가지*권장사항이다. 이것을 이해하면 당신의 어플리케이션이 더 나은 성능을 발휘할 것이다.다만 이것이 사람의 실력을 판단하는 척도로 사용되서는 안 될 것이다. 작게 생각하기- 조만간 규모가 커질거라면 MySQL ecosystem을 봐야된다. - 그리고 캐싱 빡시게 안 하는 메이저 웹사이트는 없다. - develooper.com의 Hansen PT랑 Ilia 튜토리얼 볼 것 - 처음부터 확장 가능하게 아키텍처 잘 쪼개놔야된다. - 복제랑 파티셔닝 어떻게 할지 미리 계획 세워놔라. - 파일 기반 세션 좀 쓰지마 -_- - 그렇다고 너무 쓸데없이 크게 생각하지도 말 것 - 특히 성능하고 확장성 구분 못 하면 난감함 EXPLAIN 안 써보기- SELECT 앞에 EXPLA..
[Mysql] 아이피 주소 데이터 유형? 이때까지 IP 주소를 varchar형으로 저장 했었는데 IP는 4바이트 정수형을 선언하기를 권장하고 있다.IP를 정수형으로 변환하여 저장하게 되면 용량과 검색에 더 효과적이라고 한다. MYSQL 레퍼런스http://www.mysqlkorea.co.kr/sub.html?mcode=manual&scode=01&m_no=21839&cat1=12&cat2=359&cat3=375&lang=k 여기서 정수형 변환을 지원하는 함수가 있다. INET_ATON(expr)점 4개로 구분된 네트워크 주소를 스트링 형태로 입력하면, 네크워크 주소의 수치적 값을 표현하기 위한 정수값이 리턴 된다. 이러한 주소는 4 또는 8 바이트 주소가 됨.mysql> SELECT INET_ATON('112.115.203.45'); 결과값은 ..
[Thymeleaf]타임리프 if else if else 조건식, 3항 연산자 사용법 타임리프 if else if else 조건식, 3항 연산자 사용법 /h2> User is an administrator User is a manager User is some other thing Hello! Something else
[Spring security] @Secured @PreAuthorize @PostAuthorize 어노테이션 활용 먼저 시큐리티 SpringEL 설정을 활성화한다. security-context.xml 설정 파일을 확인하면 된다. 컨트롤러 스캔과 서비스 스캔을 따로하는 경우가 있다. 이럴때는 두 설정파일에 모두 pre-post-annotations 설정을 활성화해야 한다. -----------------스프링 부트의 경우 @EnableAuthorizationServer @EnableResourceServer @EnableGlobalMethodSecurity(prePostEnabled = true)를 추가해주어야함. @Secured는 표현식 사용할 수 없고@PreAuthroize는 표현식 사용 가능 예)@Secured({"ROLE_USER","ROLE_ADMIN"}) => OR 조건, AND 조건 불가능 @PreAut..
[Spring] Spring Web Application Architecture https://www.petrikainulainen.net/software-development/design/understanding-spring-web-application-architecture-the-classic-way/
[Spring Boot] 외장 톰캣 사용 (WAR 배포) https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
[Spring Framework] Spring MVC 출처 : http://www.mungchung.com/xe/spring/102692Spring MVC 기본 흐름을 나맘대로 정리해봤다. HandlerAdapterDispatcherServlet에서 Controller를 찾을 때 어떻게 찾아야 하는지 정의 1. Servlet과 SimpleServletHandlerAdapter 2. HttpRequestHandler와 HttpRequestHandlerAdapter 3. Controller와 SimpleControllerHandlerAdapter (기본) 4. AnnotationMethodHandlerAdapter (기본) - DefaultAnnotationHandlerMapping과 같이 사용됨 HandlerMappingURL (혹은 요청)과 맵핑된 Cont..