Clean up SpringPropertyAction.getValue()

See gh-15885
pull/17858/head
dreis2211 6 years ago committed by Andy Wilkinson
parent 648cbaaceb
commit 3fb87a4506

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -65,17 +65,7 @@ class SpringPropertyAction extends Action {
addWarn("No Spring Environment available to resolve " + source); addWarn("No Spring Environment available to resolve " + source);
return defaultValue; return defaultValue;
} }
String value = this.environment.getProperty(source); return this.environment.getProperty(source, defaultValue);
if (value != null) {
return value;
}
int lastDot = source.lastIndexOf('.');
if (lastDot > 0) {
String prefix = source.substring(0, lastDot + 1);
return this.environment.getProperty(prefix + source.substring(lastDot + 1),
defaultValue);
}
return defaultValue;
} }
@Override @Override

Loading…
Cancel
Save