Merge pull request #15885 from Christoph Dreis
* gh-15885: Clean up SpringPropertyAction.getValue() Closes gh-15885
This commit is contained in:
commit
c12bb77cb5
|
@ -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…
Reference in New Issue