diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java index b7ea7fa0517..a27701e2590 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-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. @@ -36,6 +36,7 @@ import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping; * {@link Endpoint} to expose Spring MVC mappings. * * @author Dave Syer + * @author Andy Wilkinson */ @ConfigurationProperties(prefix = "endpoints.mappings", ignoreUnknownFields = false) public class RequestMappingEndpoint extends AbstractEndpoint> @@ -84,20 +85,19 @@ public class RequestMappingEndpoint extends AbstractEndpoint return result; } + @SuppressWarnings("rawtypes") protected void extractMethodMappings(ApplicationContext applicationContext, Map result) { if (applicationContext != null) { - for (String name : applicationContext - .getBeansOfType(AbstractHandlerMethodMapping.class).keySet()) { + for (Entry bean : applicationContext + .getBeansOfType(AbstractHandlerMethodMapping.class).entrySet()) { @SuppressWarnings("unchecked") - Map methods = applicationContext - .getBean(name, AbstractHandlerMethodMapping.class) - .getHandlerMethods(); + Map methods = bean.getValue().getHandlerMethods(); for (Entry method : methods.entrySet()) { Map map = new LinkedHashMap(); - map.put("bean", name); - map.put("method", method.getValue().toString()); - result.put( method.getKey().toString(), map); + map.put("bean", bean.getKey()); + map.put("method", method.getValue().toString()); + result.put(method.getKey().toString(), map); } } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java index a619f18c389..9c33682a541 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-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,11 +23,15 @@ import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; +import java.util.SortedSet; +import java.util.TreeSet; /** * A helper class generating a report from the meta-data of a particular service. * * @author Stephane Nicoll + * @author Andy Wilkinson * @since 1.2.0 */ class ServiceCapabilitiesReportGenerator { @@ -104,11 +108,20 @@ class ServiceCapabilitiesReportGenerator { StringBuilder report) { report.append("Available project types:" + NEW_LINE); report.append("------------------------" + NEW_LINE); - List typeIds = new ArrayList(metadata.getProjectTypes().keySet()); - Collections.sort(typeIds); - for (String typeId : typeIds) { - ProjectType type = metadata.getProjectTypes().get(typeId); - report.append(typeId + " - " + type.getName()); + SortedSet> entries = new TreeSet>( + new Comparator>() { + + @Override + public int compare(Entry o1, + Entry o2) { + return o1.getKey().compareTo(o2.getKey()); + } + + }); + entries.addAll(metadata.getProjectTypes().entrySet()); + for (Entry entry : entries) { + ProjectType type = entry.getValue(); + report.append(entry.getKey() + " - " + type.getName()); if (!type.getTags().isEmpty()) { reportTags(report, type); } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java index c8a12bea203..6215a1deff8 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-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. @@ -19,6 +19,7 @@ package org.springframework.boot.maven; import java.io.IOException; import java.io.InputStream; import java.util.List; +import java.util.Map.Entry; import java.util.Properties; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; @@ -32,6 +33,7 @@ import org.apache.maven.plugins.shade.resource.ResourceTransformer; * to be merged without losing any information. * * @author Dave Syer + * @author Andy Wilkinson */ public class PropertiesMergingResourceTransformer implements ResourceTransformer { @@ -62,9 +64,9 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer Properties properties = new Properties(); properties.load(is); is.close(); - for (Object key : properties.keySet()) { - String name = (String) key; - String value = properties.getProperty(name); + for (Entry entry : properties.entrySet()) { + String name = (String) entry.getKey(); + String value = (String) entry.getValue(); String existing = this.data.getProperty(name); this.data.setProperty(name, existing == null ? value : existing + "," + value);