当前位置: 首页 > news >正文

济宁哪家网站建设公司正规专门做壁纸的网站

济宁哪家网站建设公司正规,专门做壁纸的网站,北京未来科技城开发建设有限公司 网站,网站可以备案先提交类别后来改么Spring和Spring MVC使用父子容器的设计模式#xff0c;主要是为了实现更好的模块化和隔离#xff0c;提高系统的灵活性和可维护性。具体来说#xff0c;Spring应用通常包含两个层次的容器#xff1a;根容器#xff08;Root WebApplicationContext#xff09;和子容器主要是为了实现更好的模块化和隔离提高系统的灵活性和可维护性。具体来说Spring应用通常包含两个层次的容器根容器Root WebApplicationContext和子容器Child WebApplicationContext。下面是详细解释 1. 根容器Root WebApplicationContext 作用根容器是整个Web应用的基础容器通常用于管理应用的通用Bean如数据源DataSource、事务管理器Transaction Manager、业务服务Service Layer等。配置根容器的配置通常在 web.xml 文件中通过 ContextLoaderListener 加载配置文件通常是 applicationContext.xml。生命周期根容器在整个Web应用的生命周期内一直存在直到应用停止。 2. 子容器Child WebApplicationContext 作用子容器是每个Servlet如 DispatcherServlet的专用容器用于管理与特定Servlet相关的Bean如Controller、视图解析器ViewResolver、拦截器Interceptor等。配置子容器的配置通常在 DispatcherServlet 的配置文件中加载配置文件通常是 servlet-context.xml 或者通过 Configuration 类配置。生命周期子容器的生命周期与对应的Servlet相同当Servlet初始化时创建当Servlet销毁时销毁。 3. 父子容器的关系 继承关系子容器继承了根容器的所有Bean定义但可以覆盖或添加新的Bean定义。隔离性子容器中的Bean不会影响根容器中的Bean从而实现了模块化和隔离。资源共享子容器可以访问根容器中的Bean但根容器不能访问子容器中的Bean。 4. 具体好处 模块化根容器管理通用的、全局的Bean子容器管理特定于Servlet的Bean这种分层设计使得应用结构更加清晰易于维护和扩展。隔离性子容器中的Bean不会影响根容器中的Bean避免了不同模块之间的相互干扰提高了系统的稳定性。资源共享通过继承关系子容器可以共享根容器中的Bean减少了重复配置提高了资源利用率。灵活性可以轻松地添加新的Servlet和对应的子容器而不会影响现有的应用结构。 5. 配置示例 web.xml 配置 web-app xmlnshttp://xmlns.jcp.org/xml/ns/javaee xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsdversion3.1!-- 根容器 --context-paramparam-namecontextConfigLocation/param-nameparam-value/WEB-INF/spring/root-context.xml/param-value/context-paramlistenerlistener-classorg.springframework.web.context.ContextLoaderListener/listener-class/listener!-- 子容器 --servletservlet-namedispatcher/servlet-nameservlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-classinit-paramparam-namecontextConfigLocation/param-nameparam-value/WEB-INF/spring/appServlet/servlet-context.xml/param-value/init-paramload-on-startup1/load-on-startup/servletservlet-mappingservlet-namedispatcher/servlet-nameurl-pattern//url-pattern/servlet-mapping /web-app 根容器配置文件root-context.xml beans xmlnshttp://www.springframework.org/schema/beansxmlns:contexthttp://www.springframework.org/schema/contextxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd!-- 数据源 --bean iddataSource classorg.springframework.jdbc.datasource.DriverManagerDataSourceproperty namedriverClassName valuecom.mysql.cj.jdbc.Driver/property nameurl valuejdbc:mysql://localhost:3306/mydb/property nameusername valueroot/property namepassword valuepassword//bean!-- 事务管理器 --bean idtransactionManager classorg.springframework.jdbc.datasource.DataSourceTransactionManagerproperty namedataSource refdataSource//bean!-- 扫描业务服务层组件 --context:component-scan base-packagecom.example.service/ /beans 子容器配置文件servlet-context.xml beans xmlnshttp://www.springframework.org/schema/beansxmlns:contexthttp://www.springframework.org/schema/contextxmlns:mvchttp://www.springframework.org/schema/mvcxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsd!-- 启用Spring MVC注解驱动 --mvc:annotation-driven/!-- 扫描Controller组件 --context:component-scan base-packagecom.example.controller/!-- 配置视图解析器 --bean classorg.springframework.web.servlet.view.InternalResourceViewResolverproperty nameprefix value/WEB-INF/views//property namesuffix value.jsp//bean /beans .总结 根容器管理通用的、全局的Bean如数据源、事务管理器等。子容器管理特定于Servlet的Bean如Controller、视图解析器等。父子容器的关系子容器继承根容器的Bean定义但可以覆盖或添加新的Bean定义实现了模块化和隔离。
http://www.hkea.cn/news/14414079/

相关文章:

  • 抚顺网站设计php网站cms
  • 网站建设冒用身份信息做蛋糕网站的 实训报告图
  • 保定网站排名公司网站建设的费用如何入账
  • 山东专业的制作网站我国外贸企业网站建设
  • 网站多国语言设计推荐做pc端网站
  • 台州网站建设网站推广没有地址可以注册公司吗?
  • 整合资源加强全市网站建设做公司网站有什么需要注意的
  • 机械加工网站有哪些wordpress id乱码
  • app营销型网站的特点中山论坛建站模板
  • 怎么用vs2017做asp网站枣阳网站建设公司
  • 安丘网站建设学会网站建设
  • 焦作做网站哪家好个体户可以做开发网站业务嘛
  • 怎么把自己做的网站弄到域名上网站举报有奖平台
  • 网站报价单电子商务网站开发目的和意义
  • 都匀网站开发公司青岛正规网站设计公司
  • 网站后台数据北京分类信息网
  • 长沙网站seo技巧扁平化中文网站模板下载
  • 做网站都有哪些费用公司网站关键词优化
  • 黑客钓鱼网站的制作雄安做网站的公司
  • 网站开发硬件需求如何评价网站是否做的好坏
  • seo网站seo30个适合大学生创业的项目
  • 做公众好号的网站吗校园招聘
  • 新开的网站怎么做seo优化微信官方小程序商城
  • 用家用光纤宽带做网站企业黄页电话
  • 棋牌网站代理东莞今天发生的重大新闻
  • 建站之星官网WordPress的mx主题
  • 网站开发工程师前景怎么样seo优化网站
  • 广东网站建设微信商城开发zara网站建设需求分析
  • 2012年网站设计方法网页设计基础代码网站
  • 建设信息港查询福州搜索优化技术