久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    1. <tfoot id='SGHzZ'></tfoot><legend id='SGHzZ'><style id='SGHzZ'><dir id='SGHzZ'><q id='SGHzZ'></q></dir></style></legend>

        <bdo id='SGHzZ'></bdo><ul id='SGHzZ'></ul>

      <small id='SGHzZ'></small><noframes id='SGHzZ'>

        <i id='SGHzZ'><tr id='SGHzZ'><dt id='SGHzZ'><q id='SGHzZ'><span id='SGHzZ'><b id='SGHzZ'><form id='SGHzZ'><ins id='SGHzZ'></ins><ul id='SGHzZ'></ul><sub id='SGHzZ'></sub></form><legend id='SGHzZ'></legend><bdo id='SGHzZ'><pre id='SGHzZ'><center id='SGHzZ'></center></pre></bdo></b><th id='SGHzZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SGHzZ'><tfoot id='SGHzZ'></tfoot><dl id='SGHzZ'><fieldset id='SGHzZ'></fieldset></dl></div>
      1. 如何使用@Value Spring Annotation 注入 Map?

        How to inject a Map using the @Value Spring Annotation?(如何使用@Value Spring Annotation 注入 Map?)

          <tfoot id='kBMG1'></tfoot>
        • <small id='kBMG1'></small><noframes id='kBMG1'>

            <bdo id='kBMG1'></bdo><ul id='kBMG1'></ul>
          • <i id='kBMG1'><tr id='kBMG1'><dt id='kBMG1'><q id='kBMG1'><span id='kBMG1'><b id='kBMG1'><form id='kBMG1'><ins id='kBMG1'></ins><ul id='kBMG1'></ul><sub id='kBMG1'></sub></form><legend id='kBMG1'></legend><bdo id='kBMG1'><pre id='kBMG1'><center id='kBMG1'></center></pre></bdo></b><th id='kBMG1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kBMG1'><tfoot id='kBMG1'></tfoot><dl id='kBMG1'><fieldset id='kBMG1'></fieldset></dl></div>

                  <tbody id='kBMG1'></tbody>
                1. <legend id='kBMG1'><style id='kBMG1'><dir id='kBMG1'><q id='kBMG1'></q></dir></style></legend>
                  本文介紹了如何使用@Value Spring Annotation 注入 Map?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  如何在 Spring 中使用 @Value 注釋從屬性文件中將值注入 Map?

                  How can I inject values into a Map from the properties file using the @Value annotation in Spring?

                  我的 Spring Java 類是,我嘗試使用 $,但收到以下錯誤消息:

                  My Spring Java class is and I tried using the $, but got the following error message:

                  無法自動裝配字段:私有 java.util.Map Test.standard;嵌套異常是 java.lang.IllegalArgumentException:無法解析字符串值${com.test.standard}"中的占位符com.test.standard";

                  Could not autowire field: private java.util.Map Test.standard; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'com.test.standard' in string value "${com.test.standard}"

                  @ConfigurationProperty("com.hello.foo")
                  public class Test {
                  
                     @Value("${com.test.standard}")
                     private Map<String,Pattern> standard = new LinkedHashMap<String,Pattern>
                  
                     private String enabled;
                  
                  }
                  

                  我在 .properties 文件中有以下屬性

                  I have the following properties in a .properties file

                  com.test.standard.name1=Pattern1
                  com.test.standard.name2=Pattern2
                  com.test.standard.name3=Pattern3
                  com.hello.foo.enabled=true
                  

                  推薦答案

                  我相信 Spring Boot 支持通過 @ConfigurationProperties 注釋.

                  I believe Spring Boot supports loading properties maps out of the box with @ConfigurationProperties annotation.

                  根據該文檔,您可以加載屬性:

                  According that docs you can load properties:

                  my.servers[0]=dev.bar.com
                  my.servers[1]=foo.bar.com
                  

                  像這樣變成豆子:

                  @ConfigurationProperties(prefix="my")
                  public class Config {
                  
                      private List<String> servers = new ArrayList<String>();
                  
                      public List<String> getServers() {
                          return this.servers;
                      }
                  }
                  

                  我之前使用過@ConfigurationProperties 功能,但沒有加載到地圖中.您需要使用 @EnableConfigurationProperties 注釋 以啟用此功能.

                  I used @ConfigurationProperties feature before, but without loading into map. You need to use @EnableConfigurationProperties annotation to enable this feature.

                  這個功能很酷的地方在于你可以驗證你的屬性.

                  Cool stuff about this feature is that you can validate your properties.

                  這篇關于如何使用@Value Spring Annotation 注入 Map?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯(lián)網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯誤)
                  Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語句 - 是“或/“和可能的?)
                  Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                  What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數的三元表達式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲出現的每個字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉換 char 原語?)
                    <tbody id='puHwo'></tbody>
                  • <i id='puHwo'><tr id='puHwo'><dt id='puHwo'><q id='puHwo'><span id='puHwo'><b id='puHwo'><form id='puHwo'><ins id='puHwo'></ins><ul id='puHwo'></ul><sub id='puHwo'></sub></form><legend id='puHwo'></legend><bdo id='puHwo'><pre id='puHwo'><center id='puHwo'></center></pre></bdo></b><th id='puHwo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='puHwo'><tfoot id='puHwo'></tfoot><dl id='puHwo'><fieldset id='puHwo'></fieldset></dl></div>

                    • <small id='puHwo'></small><noframes id='puHwo'>

                          <bdo id='puHwo'></bdo><ul id='puHwo'></ul>

                            <tfoot id='puHwo'></tfoot>
                          1. <legend id='puHwo'><style id='puHwo'><dir id='puHwo'><q id='puHwo'></q></dir></style></legend>

                            主站蜘蛛池模板: 在线看日韩av | 日本黄色免费视频 | 91麻豆精品国产91久久久久久 | 国产欧美在线视频 | 国产在线高清 | 日韩av一区二区在线观看 | 日韩精品av | 懂色av蜜桃av | 九九99精品 | 中文字幕免费视频 | 亚洲v日韩v综合v精品v | 久久精品久久久 | 国产99久久| 欧美国产亚洲一区二区 | 激情 婷婷 | 国产欧美精品区一区二区三区 | 高清人人天天夜夜曰狠狠狠狠 | 日韩中字幕 | 日韩精品不卡 | 91精品久久久久久久 | 国外激情av | 欧美日韩中文在线 | 黄色成人亚洲 | 日韩一区二区在线看 | 天堂网中文字幕在线观看 | 超碰在线影院 | 欧美精品一区二区三区在线 | 国产日韩精品在线 | 中文字幕在线观看视频网站 | 久久国产精品亚洲 | 欧美一区二区综合 | 国产一区二区自拍 | 亚洲精品福利在线 | 亚洲视频三 | 91亚洲精选| 婷婷精品 | 国际精品久久 | 在线观看视频一区二区三区 | 欧美成人免费在线视频 | 久久精品日产第一区二区三区 | 伊人久操|