In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
< strVal.length() - 1) { String remainingPart = normalizeToPlaceholder(strVal.substring(endIndex + PLACEHOLDER_SUFFIX.length())); if (!Strings.isNullOrEmpty(remainingPart)) { stack.push(remainingPart); } } } return placeholderKeys; } private boolean isNormalizedPlaceholder(String propertyString) { return propertyString.startsWith(PLACEHOLDER_PREFIX) && propertyString.endsWith(PLACEHOLDER_SUFFIX); } private boolean isExpressionWithPlaceholder(String propertyString) { return propertyString.startsWith(EXPRESSION_PREFIX) && propertyString.endsWith(EXPRESSION_SUFFIX) && propertyString.contains(PLACEHOLDER_PREFIX); } private String normalizeToPlaceholder(String strVal) { int startIndex = strVal.indexOf(PLACEHOLDER_PREFIX); if (startIndex == -1) { return null; } int endIndex = strVal.lastIndexOf(PLACEHOLDER_SUFFIX); if (endIndex == -1) { return null; } return strVal.substring(startIndex, endIndex + PLACEHOLDER_SUFFIX.length()); } private int findPlaceholderEndIndex(CharSequence buf, int startIndex) { int index = startIndex + PLACEHOLDER_PREFIX.length(); int withinNestedPlaceholder = 0; while (index < buf.length()) { if (StringUtils.substringMatch(buf, index, PLACEHOLDER_SUFFIX)) { if (withinNestedPlaceholder >0) {withinNestedPlaceholder--; index = index+ PLACEHOLDER_SUFFIX.length ();} else {return index;}} else if (StringUtils.substringMatch (buf, index, SIMPLE_PLACEHOLDER_PREFIX)) {withinNestedPlaceholder++; index = index+ SIMPLE_PLACEHOLDER_PREFIX.length ();} else {index++;}} return-1 }} package com.allen.apollo;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.factory.annotation.Value;import org.springframework.util.StringUtils;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RestController;import java.lang.reflect.InvocationTargetException;@RestController@Slf4jpublic class SpringValueController {@ Value ("${test:123}") public String zax; @ Value ("${test:123}") public String test @ Value (("${zed:zed}")) public String zed; @ GetMapping ("/ test") public String test (String a, String b) {if (! StringUtils.isEmpty (a)) {try {for (SpringValue springValue: SpringValueCacheMap.map.get ("test")) {springValue.update (a) } for (SpringValue springValue: SpringValueCacheMap.map.get ("zed")) {springValue.update (b);}} catch (IllegalAccessException | InvocationTargetException e) {e.printStackTrace () }} return String.format ("test:% s, zax:% s, zed:% s", test, zax, zed);}} "how to implement SpringBoot2 dynamic @ Value" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.