@ -1,5 +1,5 @@
@@ -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 .
@ -21,6 +21,7 @@ import java.util.Collections;
@@ -21,6 +21,7 @@ import java.util.Collections;
import java.util.LinkedHashMap ;
import java.util.List ;
import java.util.Map ;
import java.util.Map.Entry ;
import org.springframework.aop.support.AopUtils ;
import org.springframework.beans.BeansException ;
@ -35,6 +36,7 @@ import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping;
@@ -35,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 < Map < String , Object > >
@ -83,20 +85,19 @@ public class RequestMappingEndpoint extends AbstractEndpoint<Map<String, Object>
@@ -83,20 +85,19 @@ public class RequestMappingEndpoint extends AbstractEndpoint<Map<String, Object>
return result ;
}
@SuppressWarnings ( "rawtypes" )
protected void extractMethodMappings ( ApplicationContext applicationContext ,
Map < String , Object > result ) {
if ( applicationContext ! = null ) {
for ( String name : applicationContext
. getBeansOfType ( AbstractHandlerMethodMapping . class ) . k eySet( ) ) {
for ( Entry < String , AbstractHandlerMethodMapping > bean : applicationContext
. getBeansOfType ( AbstractHandlerMethodMapping . class ) . entr ySet ( ) ) {
@SuppressWarnings ( "unchecked" )
Map < ? , HandlerMethod > methods = applicationContext
. getBean ( name , AbstractHandlerMethodMapping . class )
. getHandlerMethods ( ) ;
for ( Object key : methods . keySet ( ) ) {
Map < ? , HandlerMethod > methods = bean . getValue ( ) . getHandlerMethods ( ) ;
for ( Entry < ? , HandlerMethod > method : methods . entrySet ( ) ) {
Map < String , String > map = new LinkedHashMap < String , String > ( ) ;
map . put ( "bean" , name ) ;
map . put ( "method" , methods . get ( key ) . toString ( ) ) ;
result . put ( key . toString ( ) , map ) ;
map . put ( "bean" , bean . getKey ( ) ) ;
map . put ( "method" , method . getValue ( ) . toString ( ) ) ;
result . put ( method . getKey ( ) . toString ( ) , map ) ;
}
}
}
@ -107,11 +108,11 @@ public class RequestMappingEndpoint extends AbstractEndpoint<Map<String, Object>
@@ -107,11 +108,11 @@ public class RequestMappingEndpoint extends AbstractEndpoint<Map<String, Object>
if ( applicationContext ! = null ) {
Map < String , AbstractUrlHandlerMapping > mappings = applicationContext
. getBeansOfType ( AbstractUrlHandlerMapping . class ) ;
for ( String name : mappings . k eySet( ) ) {
AbstractUrlHandlerMapping mapping = mappings . get ( name ) ;
Map < String , Object > handlers = getHandlerMap ( mapping ) ;
for ( String key : handlers . keySet ( ) ) {
result . put ( key , Collections . singletonMap ( "bean" , name ) ) ;
for ( Entry < String , AbstractUrlHandlerMapping > mapping : mappings . entr ySet ( ) ) {
Map < String , Object > handlers = getHandlerMap ( mapping . getValue ( ) ) ;
for ( Entry < String , Object > handler : handlers . entrySet ( ) ) {
result . put ( handler . getKey ( ) ,
Collections . singletonMap ( "bean" , mapping . getKey ( ) ) ) ;
}
}
}