4차산업혁명의 일꾼/웹개발

스프링툴에 톰캣앤진 구동시 일어나는 일

르무엘 2020. 12. 27. 19:01

1. 스프링 작동순서(listenter - 서블릿만들고 제거 , filter - 동작전에 거를것, servlet - db통신,http통신(get,post...)

[관점지향 spring:aop  pointcut  - aspect ]

 

2. 스프링 구동순서

[서버킴] -> CATALINA:APR(톰캣라이브러리로드- OpenSSL) -> 프로토콜 핸들러 ["http-nio-8082"]을(를) 초기화 및 시작

 

[ 초기 컨테이너 설정세팅 ] web.xml -> contextConfigLocation 

WebApplicationContext ~ 설정 시작

ContextLoader - XmlWebApplicationContext - XmlBeanDefinitionReader -> [ web.xml 에 명시한위치]

AutowiredAnnotationBeanPostProcessor - > RequestMappingHandlerAdapter - > ContextLoader

설정값 설정 끝

 

[서블릿 설정 세팅] web.xml -> appServlet,order  ->contextConfigLocation

FrameworkServlet ~ 설정 시작

DispatcherServlet - XmlWebApplicationContext - XmlBeanDefinitionReader -> web.xml에 명시한 서블릿위치

AutowiredAnnotationBeanPostProcessor - > RequestMappingHandlerMapping - > SimpleUrlHandlerMapping

설정값 설정 끝

 

[서블릿 설정 세팅] web.xml -> customer, product ->contextConfigLocation

FrameworkServlet ~ 설정 시작

DispatcherServlet - XmlWebApplicationContext -> XmlBeanDefinitionReader ->web.xml에 명시한 서블릿위치 DefaultListableBeanFactory  -> ConfigurationClassBeanDefinitionReader -> AutowiredAnnotationBeanPostProcessor

->RequestMappingHandlerMapping -> SimpleUrlHandlerMapping

 

[서버 끔] -> 프로토콜 핸들러 ["http-nio-8082"] 정지 -> 서비스 [Catalina]을(를) 중지-> 서블릿 소멸(위의 경우 4개)

=> 서블릿은 http(request,response)와 web.xml(배포)관련된 것이 거의 전부

 

*  애노테이션

- @SuppressWarnings("serial") serialVersionUID 를 생성하고자 하는 (Serializable을 implements 한) 클래스에 마우스 오른쪽 버튼을 누르면 Add SerialVersionUID 가 있다.

  @initBinder 란 Spring Validator를 사용 시 @Valid annotation으로 검증이 필요한 객체를 가져오기 전에 수행할 method를 지정해주는 annotation이다.

 -@Deprecated : 이후 버전에서는 사용되지 않을 수 있는 변수, 메서드에 사용됨

- @SuppressWarnings : 특정 경고가 나타나지 않도록 함

 



LIST