FunctionHandlerMapping needs to be defensive with debug flag

Spring Boot apps often run with --debug (no boolean value), so
we need to be defensive and not barf if it's empty (and therefore
not convertible to a boolean)
This commit is contained in:
Dave Syer
2017-06-28 15:07:07 +01:00
parent 78ca4df128
commit d1ccef62b5

View File

@@ -52,7 +52,7 @@ public class FunctionHandlerMapping extends RequestMappingHandlerMapping
private String prefix = "";
@Value("${debug:${DEBUG:false}}")
private boolean debug = false;
private String debug = "false";
@Autowired
public FunctionHandlerMapping(FunctionCatalog catalog, FunctionInspector inspector) {
@@ -65,7 +65,7 @@ public class FunctionHandlerMapping extends RequestMappingHandlerMapping
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
this.controller.setDebug(debug);
this.controller.setDebug(!"false".equals(debug));
detectHandlerMethods(controller);
while (prefix.endsWith("/")) {
prefix = prefix.substring(0, prefix.length() - 1);