applicationContext.xml 와 spring-servlet.xml 의 관계

1294 단어 SpringMVC
applicationContext.xml 는 spring 응용의 핵심 프로필 로 ContextLoaderListener 에서 분석 을 불 러 옵 니 다.spring-servlet.xml 는 SpringMVC 응용 프로그램의 주요 설정 파일 로 Dispatcher Servlet 과 그 부모 클래스 에서 분석 합 니 다.
applicationContext.xml 는 응용 설정 으로 단독으로 사용 할 수 있 지만 spring-servlet.xml 는 applicationContext.xml 의 하위 용기 로 applicationContext.xml 정의 에서 초기 화 된 bean 을 참조 할 수 있 습 니 다.
application-context.xml 는 전역 적 이 며,여러 server let 에 적용 되 며,listener 와 함께 사용 합 니 다.웹.xml 에 서 는 다음 과 같이 설정 되 어 있 습 니 다.

    org.springframework.web.context.ContextLoaderListener


    contextConfigLocation
    classpath*:applicationContext.xml


spring-mvc.xml 는 SpringMVC 응용 설정 입 니 다.웹.xml 에 서 는 다음 과 같이 설정 되 어 있 습 니 다.

  springMVC
  org.springframework.web.servlet.DispatcherServlet
  
    contextConfigLocation
    classpath:config/spring-mvc.xml
  
  1
  true


블 로그 참조:https://www.cnblogs.com/binlin1987/p/7053016.html

좋은 웹페이지 즐겨찾기