format code

pull/423/head
weihu 3 years ago
parent c342ca2ce5
commit bc4b67457f

@ -12,7 +12,7 @@ import org.springframework.core.PriorityOrdered;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
/** /**
* Get spring bean properties and methods * Get spring bean properties and methods.
* *
* @author weihubeats 2022-7-10 * @author weihubeats 2022-7-10
*/ */
@ -37,12 +37,18 @@ public abstract class PolarisProcessor implements BeanPostProcessor, PriorityOrd
} }
/** /**
* subclass should implement this method to process field * subclass should implement this method to process field.
* @param bean bean
* @param beanName beanName
* @param field field
*/ */
protected abstract void processField(Object bean, String beanName, Field field); protected abstract void processField(Object bean, String beanName, Field field);
/** /**
* subclass should implement this method to process method * subclass should implement this method to process method.
* @param bean bean
* @param beanName beanName
* @param method method
*/ */
protected abstract void processMethod(Object bean, String beanName, Method method); protected abstract void processMethod(Object bean, String beanName, Method method);

@ -47,9 +47,10 @@ public class PlaceholderHelper {
/** /**
* Resolve placeholder property values, e.g. * Resolve placeholder property values, e.g.
* <br /> * @param beanFactory beanFactory
* <br /> * @param beanName beanName
* "${somePropertyValue}" -> "the actual property value" * @param placeholder placeholder
* @return "${somePropertyValue}" -> "the actual property value"
*/ */
public Object resolvePropertyValue(ConfigurableBeanFactory beanFactory, String beanName, String placeholder) { public Object resolvePropertyValue(ConfigurableBeanFactory beanFactory, String beanName, String placeholder) {
// resolve string value // resolve string value
@ -74,15 +75,16 @@ public class PlaceholderHelper {
} }
/** /**
*
* @param propertyString propertyString
* @return
* Extract keys from placeholder, e.g. * Extract keys from placeholder, e.g.
* <ul>
* <li>${some.key} => "some.key"</li> * <li>${some.key} => "some.key"</li>
* <li>${some.key:${some.other.key:100}} => "some.key", "some.other.key"</li> * <li>${some.key:${some.other.key:100}} => "some.key", "some.other.key"</li>
* <li>${${some.key}} => "some.key"</li> * <li>${${some.key}} => "some.key"</li>
* <li>${${some.key:other.key}} => "some.key"</li> * <li>${${some.key:other.key}} => "some.key"</li>
* <li>${${some.key}:${another.key}} => "some.key", "another.key"</li> * <li>${${some.key}:${another.key}} => "some.key", "another.key"</li>
* <li>#{new java.text.SimpleDateFormat('${some.key}').parse('${another.key}')} => "some.key", "another.key"</li> * <li>#{new java.text.SimpleDateFormat('${some.key}').parse('${another.key}')} => "some.key", "another.key"</li>
* </ul>
*/ */
public Set<String> extractPlaceholderKeys(String propertyString) { public Set<String> extractPlaceholderKeys(String propertyString) {
Set<String> placeholderKeys = Sets.newHashSet(); Set<String> placeholderKeys = Sets.newHashSet();

@ -45,7 +45,6 @@ import org.springframework.context.ConfigurableApplicationContext;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
/** /**
@ -73,7 +72,7 @@ public class PolarisPropertiesSourceAutoRefresherTest {
private PlaceholderHelper placeholderHelper; private PlaceholderHelper placeholderHelper;
@Test @Test
public void testConfigFileChanged() throws Exception{ public void testConfigFileChanged() throws Exception {
PolarisPropertySourceAutoRefresher refresher = new PolarisPropertySourceAutoRefresher(polarisConfigProperties, PolarisPropertySourceAutoRefresher refresher = new PolarisPropertySourceAutoRefresher(polarisConfigProperties,
polarisPropertySourceManager, springValueRegistry, placeholderHelper); polarisPropertySourceManager, springValueRegistry, placeholderHelper);

Loading…
Cancel
Save