1. 程式人生 > >在Spring Boot YML配置檔案中使用MAVEN變數@[email protected]

在Spring Boot YML配置檔案中使用MAVEN變數@[email protected]

在application.properties字尾的配置檔案中我們如下使用MAVEN變數:

[email protected]@

@執行時符號會自替換成MAVEN變數配置好的值,但是換成YML配置檔案不行了,會報錯,如下配置即可解決:

eureka:
  client:
      service-url:
        defaultZone: '@[email protected]'

補充更新maven配置:

<profiles>
    <profile>
        <id>測試配置</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>${java.version}</jdk>
        </activation>
        <properties>
            <!-- mysql database url -->
            <driverClassName>com.mysql.jdbc.Driver </driverClassName>
            <url>jdbc:mysql://localhost:3306/db</url>
            <username>root</username>
            <password></password>
            
            <defaultZone>http://localhost:8500/eureka/</defaultZone>
            countURL>
        </properties>
    </profile>

    <profile>
        <id>模擬配置</id>
        <properties>
            <!-- mysql database url -->
            <driverClassName>com.mysql.jdbc.Driver </driverClassName>
            <url>jdbc:mysql://localhost:3306/db</url>
            <username>root</username>
            <password></password>
            
            <defaultZone>http://localhost:8500/eureka/</defaultZone>
            ccountURL>
        </properties>
    </profile>

    <profile>
        <id>生產配置</id>
        <properties>
            <!-- mysql database url -->
            <driverClassName>com.mysql.jdbc.Driver</driverClassName>
            <url>jdbc:mysql://localhost:3306/db</url>
            <username>root</username>
            <password></password>
            
            <defaultZone>http://localhost:8500/eureka/</defaultZone>
            
        </properties>
    </profile>
</profiles>

相關推薦

Spring Boot YML配置檔案使用MAVEN變數@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0472657644">[email&#160;protected]a>

在application.properties字尾的配置檔案中我們如下使用MAVEN變數: [email protected]@ @執行時符號會自替換成MAVEN變數配置好的值,但是換成YML配置檔案不行了,會報錯,如下配置即可解決: eureka:   cl

spring <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="62000d0d16222103010a0703000e07">[email&#160;protected]a>value的理解

先看原始碼 /** * Names of the caches in which method invocation results are stored. * <p>Names may be used to determine the target cache (or cac

SQL Server資料庫mdf檔案了勒索病毒<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fc9f8e858c889998a39d8f9d9293bc9f939f97">[email&#160;p

SQL,資料庫,勒索病毒,mdf檔案中毒,[email protected]_email *SQL Server資料庫mdf檔案中了勒索病毒[email protected]_email。副檔名變為[email protected]_email SQL Serv

Spring Boot入門篇<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cde08d9fa8bcb8a8beb99dacbfaca0">[email&#160;protected]a>/@Req

請求引數註解問題 當前臺介面使用GET或POST方式提交資料時,資料編碼格式由請求頭的ContentType指定。 分為以下幾種情況: application/x-www-form-urlencoded 這種情況的資料@RequestParam、@Mode

spring宣告式事務管理方式( 基於tx和aop名字空間的xml配置<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0922495d7b68677a686a7d6066676865">[email&#

轉自:https://www.cnblogs.com/niceyoo/p/8732891.html 1. 宣告式事務管理分類 宣告式事務管理也有兩種常用的方式, 一種是基於tx和aop名字空間的xml配置檔案,另一種就是基於@Transactional註解。 顯然基於註解的方式更簡單

Spring@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c1a2aeafb5b3aeadada481b2a4b3b7a8a2a4">[email&#160;protected]a>@<a h

我是一名Spring 小白 跟單位的小牛牛學習spring框架,總結以下 @controller 控制器(注入服務) 用於標註控制層,相當於struts中的action層 @service 服務(注入dao) 用於標註服務層,主要用來進行業務的邏輯處理 @re

Spring boot使用總結(三)校驗<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="311c1c717f5e45735d505f5a">[email&#160;protected]a> 使用

spring boot 1.4預設使用 hibernate validator 5.2.4 Final實現校驗功能。hibernate validator 5.2.4 Final是JSR 349 Bean Validation 1.1的具體實現。 一 初步使用

Spring 註解 @<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="622c0d162c170e0e222c0d16270f12161b">[email&#160;protected]a>,@N

首先要清楚的是下邊1,2,3; 且空格是有長度的: 1  @NotNull:不能為null,但可以為empty,沒有Size的約束 2  @NotEmpty :不能為null,且Size>0 3  @NotBlank:只用於String,不能為null且trim()之

SpringBean的生命週期之<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="476a6a6a6a6a0705222629">[email&#160;protected]a>方法進行物件的初始化

方法:通過@Bean指定init-method和destroy-method; 注:單例項和原型模式物件的建立時間和初始化銷燬的時間順序不同。 一、單例項模式 1、建立Car例項物件,並建立初始化和銷燬方法 package com.atguigu.bean; imp

spring給容器註冊元件的幾種方式,1.包掃描+元件標註註解<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0634284664636768">[email&#160;protected]a>(

              給容器中註冊元件;        1)、包掃描+元件標註註解(@Controller/@Service/@Repository/@Component)[

spring boot(2)<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5a771a092a2833343d1835352e1b2a2a3633393b2e333534">[email&#160;p

啟動類 package hello; import org.springframework.boot.*; import org.springframework.boot.autoconfigu

淺談linuxshell變數$#,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="674327">[email&#160;protected]a>,$0,$1,$2,$?的含義解釋

淺談linux中shell變數$#,[email protected],$0,$1,$2,$?的含義解釋 下面小編就為大家帶來一篇淺談linux中shell變數$#,[email protected],$0,$1,$2的含義解釋。小編覺得挺不錯的,現在就分享給大家,

Spring boot 梳理 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1538554665677c7b72577a7a61546565797c7674617c7a7b">[email&#160;

@EnableWebMvc=繼承DelegatingWebMvcConfiguration=繼承WebMvcConfigurationSupport 直接看原始碼,@EnableWebMvc實際上引入一個DelegatingWebMvcConfiguration  

unixshell 非一般變數$0 $n $* <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a581e5">[email&#160;protected]a> $! $?的詳解

$0:獲取當前執行指令碼的檔名,包括路徑。 [[email protected] script]# cat 0.sh #!/bin/bash echo $0 [[email protected] script]# sh 0.sh 0.sh [[email protected

spring boot 原始碼解析<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="37060e1a77745859535e435e5859565b">[email&#160;protected]a>

前言 之前在分析spring boot 原始碼時匯出可見@ConditionalOnBean 之類的註解,那麼它到底是如何使用的以及其工作流程如何,我們這裡就圍繞以下幾點來分析: @Conditional系列與Condition的關係 @Condition

MyEclipse破解遇到的問題Ⅱ(run.bat檔案一閃而過,或者報錯)<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8fbdbcbacfbcb9ba">[email&#160;protected

MyEclipse破解中遇到的問題Ⅱ(run.bat檔案一閃而過,或者報錯) 系統: 破解檔案出現問題(這個沒有提示錯誤,而在10.0裡面那個破解檔案,出現的提示是: .Exception in thread “main” java.lang.ClassNo

shell腳本的$# $0 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f8dcb8">[email&#160;protected]a> $* $$ $! $?的意義

腳本 $* width 上一個 pre shell int .cn height 轉載自:http://www.cnblogs.com/davygeek/p/5670212.html 今天學寫腳本遇到一些變量不認識,在此做下記錄。 變量 含義 $0 當前腳本的文件

shell$*與<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b296f2">[email&#160;protected]a>的區別

劃分 位置 一個 這也 差異 獨立 [email protected] 情況 雙引號 $*所有的位置參數,被作為一個單詞 註意:"$*"必須被""引用 [email protected] 與$*同義,但是每個參數都是一個獨立的""引用字串,這就意味著參數

Spring高級話題<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b29ff2f7dcd3d0ded7">[email&#160;protected]a>***註解的工作原理

sso metadata bool logs tcl task ota -c ann 出自:http://blog.csdn.net/qq_26525215 @EnableAspectJAutoProxy @EnableAspectJAutoProxy註解 激活Aspe

linux bash Shell特殊變數:Shell $0, $#, $*, <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8aaeca">[email&#160;protected]a>, $?

在linux下配置shell引數說明 前面已經講到,變數名只能包含數字、字母和下劃線,因為某些包含其他字元的變數有特殊含義,這樣的變數被稱為特殊變數。  例如,$ 表示當前Shell程序的ID,即pid,看下面的程式碼: [[email protected] /]$ ec