zoukankan      html  css  js  c++  java
  • 【SpringMVC】运行流程

    SpringMVC 运行流程

    在 Spring 的环境下使用 SpringMVC

    Bean 被创建两次 ? • Spring 的 IOC 容器不应该扫描 SpringMVC 中的 bean, 对应的 SpringMVC 的 IOC 容器不应该扫描 Spring 中的 bean

    <context:component-scan base-package="com.nemo.springmvc">
      <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
      <context:exclude-filter type="annotation" expression="org.springframework.stereotype.ControllerAdvice"/>
    </context:component-scan>
    <context:component-scan base-package="com.nemo.springmvc" use-default-filters="false">
      <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
      <context:exclude-filter type="annotation" expression="org.springframework.stereotype.ControllerAdvice"/>
    </context:component-scan>

    在 Spring MVC 配置文件中引用业务层的 Bean

    • 多个 Spring IOC 容器之间可以设置为父子关系,以实现良好的解耦。
    • Spring MVC WEB 层容器可作为 “业务层” Spring 容器的子容器:即 WEB 层容器可以引用业务层容器的 Bean,而业务层容器却访问不到 WEB 层容器的 Bean

  • 相关阅读:
    oracle 分析函数3
    oracle 分析函数4
    oracle 分析函数2
    postgres
    博客系统
    Java 笔试面试 算法编程篇 一
    Java 笔试面试 基础篇 一
    Struts2
    mysql 数据类型
    ExceptionDemo
  • 原文地址:https://www.cnblogs.com/blknemo/p/13498279.html
Copyright © 2011-2022 走看看