最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

淺談xml配置spring profiles的幾個(gè)注意點(diǎn)

 更新時(shí)間:2019年07月24日 10:29:56   作者:bluehtt  
這篇文章主要介紹了淺談xml配置spring profiles的幾個(gè)注意點(diǎn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

先貼正確配置

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:task="http://www.springframework.org/schema/task"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
      http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

  <aop:aspectj-autoproxy></aop:aspectj-autoproxy>
  <task:annotation-driven/>

  <import resource="spring-datasource.xml"/>
  <import resource="spring-hessian-server.xml"/>
  <import resource="spring-remoting-dis.xml"/>
  <import resource="spring-remoting-worldeye.xml"/>
  <import resource="spring-activemq.xml"/>
  <import resource="spring-cxf-client.xml"/>

  <!-- 開(kāi)發(fā)配置 -->
  <beans profile="dev">
    <context:property-placeholder location="classpath:config/application.properties, classpath:config/application-dev.properties"/>
    <import resource="spring-hadoop-dev.xml"/>
  </beans>

  <!-- 測(cè)試配置 -->
  <beans profile="test">
    <context:property-placeholder location="classpath:config/application.properties, classpath:config/application-prd.properties, classpath:config/application-test.properties"/>
    <import resource="spring-hadoop-test.xml"/>
  </beans>

  <!-- 線上配置 -->
  <beans profile="prd">
    <context:property-placeholder location="classpath:config/application.properties, classpath:config/application-prd.properties"/>
    <import resource="spring-hadoop.xml"/>
  </beans>
</beans>

一. xml標(biāo)簽的xsd版本

spring-beans.xsd 文件不要指定版本,也可以使用高版本(起碼是3.1),原因是 spring profile 是3.1版本開(kāi)始的。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"

    ......
    
    xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
      http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

二. dispatcherServlet文件配置

web.xml中配置了 DispatcherServlet 的 contextConfigLocation,需要在 spring-dispatch.xml 添加 spring profile 的配置,配置項(xiàng)同上。

  <!-- profile配置 -->
  <context-param>
    <param-name>spring.profiles.active</param-name>
    <param-value>prd</param-value>
  </context-param>

  <!-- Spring配置 -->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
      classpath:config/spring/spring-context.xml
      classpath:config/spring/spring-security.xml
    </param-value>
  </context-param>

  ......

  <!-- Spring Dispatcher配置 -->
  <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>
        classpath:config/spring/spring-hessian-server.xml
        classpath:config/spring/spring-dispatch.xml
        classpath:config/spring/spring-security.xml
      </param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Idea插件安裝和管理方式

    Idea插件安裝和管理方式

    這篇文章主要介紹了Idea插件安裝和管理方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • 同時(shí)使用@LoadBalanced?@RefreshScope注解負(fù)載均衡失效分析

    同時(shí)使用@LoadBalanced?@RefreshScope注解負(fù)載均衡失效分析

    這篇文章主要為大家介紹了同時(shí)使用@LoadBalanced?@RefreshScope負(fù)載均衡失效問(wèn)題分析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-02-02
  • 淺析如何使用Swagger生成帶權(quán)限控制的API文檔

    淺析如何使用Swagger生成帶權(quán)限控制的API文檔

    當(dāng)涉及到權(quán)限控制時(shí),如何生成既安全又詳細(xì)的?API?文檔就成了一個(gè)關(guān)鍵問(wèn)題,所以這篇文章小編就來(lái)和大家好好聊聊如何用?Swagger?來(lái)生成帶有權(quán)限控制的?API?文檔吧
    2025-02-02
  • springboot使用dubbo和zookeeper代碼實(shí)例

    springboot使用dubbo和zookeeper代碼實(shí)例

    這篇文章主要介紹了springboot使用dubbo和zookeeper代碼實(shí)例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-11-11
  • 詳解如何為SpringBoot Web應(yīng)用的日志方便追蹤

    詳解如何為SpringBoot Web應(yīng)用的日志方便追蹤

    在Web應(yīng)用程序領(lǐng)域,有效的請(qǐng)求監(jiān)控和可追溯性對(duì)于維護(hù)系統(tǒng)完整性和診斷問(wèn)題至關(guān)重要,SpringBoot是一種用于構(gòu)建Java應(yīng)用程序的流行框架,在本文中,我們探討了在SpringBoot中向日志添加唯一ID的重要性,需要的朋友可以參考下
    2023-11-11
  • java.lang.ArrayIndexOutOfBoundsException數(shù)組越界異常問(wèn)題解決

    java.lang.ArrayIndexOutOfBoundsException數(shù)組越界異常問(wèn)題解決

    這篇文章主要給大家介紹了關(guān)于java.lang.ArrayIndexOutOfBoundsException數(shù)組越界異常問(wèn)題解決的相關(guān)資料,數(shù)組越界訪問(wèn)是一個(gè)非常嚴(yán)重的問(wèn)題,文中通過(guò)圖文將解決的辦法介紹的非常詳細(xì),需要的朋友可以參考下
    2024-01-01
  • Java多線程--讓主線程等待所有子線程執(zhí)行完畢在執(zhí)行

    Java多線程--讓主線程等待所有子線程執(zhí)行完畢在執(zhí)行

    Java主線程等待所有子線程執(zhí)行完畢在執(zhí)行,其實(shí)在我們的工作中經(jīng)常的用到,本篇文章就介紹了Java多線程--讓主線程等待所有子線程執(zhí)行完畢在執(zhí)行,有需要的可以了解一下。
    2016-11-11
  • 用Eclipse生成JPA元模型的方法

    用Eclipse生成JPA元模型的方法

    下面小編就為大家?guī)?lái)一篇用Eclipse生成JPA元模型的方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-08-08
  • Java中的構(gòu)造方法和方法重載完整代碼

    Java中的構(gòu)造方法和方法重載完整代碼

    在Java編程中,構(gòu)造方法用于初始化對(duì)象,而方法重載允許同一個(gè)類中存在多個(gè)同名方法但參數(shù)不同,文中通過(guò)代碼及圖文介紹的非常詳細(xì),需要的朋友可以參考下
    2024-10-10
  • mybatis?plus配置自動(dòng)create_time和update_time方式

    mybatis?plus配置自動(dòng)create_time和update_time方式

    在處理數(shù)據(jù)時(shí),注意時(shí)間類型的轉(zhuǎn)換非常重要,不同編程環(huán)境和數(shù)據(jù)庫(kù)對(duì)時(shí)間數(shù)據(jù)的處理方式各異,因此在數(shù)據(jù)遷移或日常處理中需謹(jǐn)慎處理時(shí)間格式,個(gè)人經(jīng)驗(yàn)表明,了解常用的時(shí)間轉(zhuǎn)換函數(shù)和方法能有效避免錯(cuò)誤,提高工作效率,希望這些經(jīng)驗(yàn)?zāi)転榇蠹規(guī)?lái)幫助
    2024-09-09

最新評(píng)論

富川| 黑河市| 千阳县| 庆阳市| 上思县| 观塘区| 梓潼县| 济源市| 咸丰县| 鹿邑县| 罗山县| 溧阳市| 虹口区| 华安县| 白河县| 瑞昌市| 镇安县| 屏边| 茶陵县| 图们市| 开阳县| 新和县| 五莲县| 云安县| 南木林县| 凤庆县| 普兰县| 宝山区| 黔南| 廊坊市| 邳州市| 界首市| 崇州市| 进贤县| 新巴尔虎左旗| 仪陇县| 顺平县| 上蔡县| 玉门市| 明光市| 宁津县|