How to realize SpringBoot2 dynamic @ Value
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!