Polishing
This commit is contained in:
parent
8a69159004
commit
64ce8a81c3
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -73,7 +73,8 @@ public class EnableMBeanExportConfigurationTests {
|
|||
ObjectName oname = ObjectNameManager.getInstance("bean:name=testBean4");
|
||||
assertNotNull(server.getObjectInstance(oname));
|
||||
assertEquals("TEST", server.getAttribute(oname, "Name"));
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
ctx.close();
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +143,8 @@ public class EnableMBeanExportConfigurationTests {
|
|||
assertNotNull(server.getObjectInstance(oname));
|
||||
String name = (String) server.getAttribute(oname, "Name");
|
||||
assertNull(name);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
ctx.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -23,8 +23,9 @@ import org.springframework.core.convert.converter.Converter;
|
|||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Calls {@link Enum#name()} to convert a source Enum to a String. This converter will
|
||||
* not match enums with interfaces that can be converterd.
|
||||
* Calls {@link Enum#name()} to convert a source Enum to a String.
|
||||
* This converter will not match enums with interfaces that can be converted.
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @author Phillip Webb
|
||||
* @since 3.0
|
||||
|
@ -33,14 +34,16 @@ final class EnumToStringConverter implements Converter<Enum<?>, String>, Conditi
|
|||
|
||||
private final ConversionService conversionService;
|
||||
|
||||
|
||||
public EnumToStringConverter(ConversionService conversionService) {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
for (Class<?> interfaceType : ClassUtils.getAllInterfacesForClass(sourceType.getType())) {
|
||||
if (conversionService.canConvert(TypeDescriptor.valueOf(interfaceType), targetType)) {
|
||||
if (this.conversionService.canConvert(TypeDescriptor.valueOf(interfaceType), targetType)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -80,8 +80,8 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver {
|
|||
if (debugEnabled) {
|
||||
logger.debug(String.format("Searching for key '%s' in [%s]", key, propertySource.getName()));
|
||||
}
|
||||
Object value;
|
||||
if ((value = propertySource.getProperty(key)) != null) {
|
||||
Object value = propertySource.getProperty(key);
|
||||
if (value != null) {
|
||||
Class<?> valueType = value.getClass();
|
||||
if (resolveNestedPlaceholders && value instanceof String) {
|
||||
value = resolveNestedPlaceholders((String) value);
|
||||
|
|
Loading…
Reference in New Issue