[bs-93] Add /info endpoint with git properties etc.

* If git.properties is on the classpath (e.g. from the Maven plugin)
/info will list the commit id, branch and dates.
* If application.yml has an info object at the top level that will
be diplayed as well (so e.g. you can use Maven resource filtering
top add the project name, version etc.)
* RelaxedDataBinder can now be used to bind to a Map (as opposed to
a nested Map inside teh target bean)

[Fixes #49130073]
This commit is contained in:
Dave Syer
2013-05-03 12:42:50 +01:00
parent 7e6651c0a2
commit 7e548b5bd4
8 changed files with 293 additions and 19 deletions

View File

@@ -17,6 +17,7 @@ import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -181,6 +182,26 @@ public class RelaxedDataBinderTests {
assertEquals(123, target.getValue());
}
@Test
public void testBindMap() throws Exception {
Map<String, Object> target = new LinkedHashMap<String, Object>();
BindingResult result = bind(target, "spam: bar\n" + "vanilla.value: 123",
"vanilla");
assertEquals(0, result.getErrorCount());
assertEquals("123", target.get("value"));
}
@Test
public void testBindMapNestedInMap() throws Exception {
Map<String, Object> target = new LinkedHashMap<String, Object>();
BindingResult result = bind(target, "spam: bar\n" + "vanilla.foo.value: 123",
"vanilla");
assertEquals(0, result.getErrorCount());
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) target.get("foo");
assertEquals("123", map.get("value"));
}
private BindingResult bind(Object target, String values) throws Exception {
return bind(target, values, null);
}