Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
b02cdc72
Commit
b02cdc72
authored
Jan 15, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gh-4813'
parents
48d22f93
93ef7951
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
32 deletions
+51
-32
RequestMappingEndpoint.java
...amework/boot/actuate/endpoint/RequestMappingEndpoint.java
+16
-15
EndpointMBeanExporter.java
...work/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java
+4
-3
WebMvcAutoConfiguration.java
...ework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
+6
-4
ServiceCapabilitiesReportGenerator.java
.../cli/command/init/ServiceCapabilitiesReportGenerator.java
+19
-6
PropertiesMergingResourceTransformer.java
...work/boot/maven/PropertiesMergingResourceTransformer.java
+6
-4
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java
View file @
b02cdc72
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
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.
...
@@ -21,6 +21,7 @@ import java.util.Collections;
...
@@ -21,6 +21,7 @@ import java.util.Collections;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
org.springframework.aop.support.AopUtils
;
import
org.springframework.aop.support.AopUtils
;
import
org.springframework.beans.BeansException
;
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.
* {@link Endpoint} to expose Spring MVC mappings.
*
*
* @author Dave Syer
* @author Dave Syer
* @author Andy Wilkinson
*/
*/
@ConfigurationProperties
(
prefix
=
"endpoints.mappings"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.mappings"
,
ignoreUnknownFields
=
false
)
public
class
RequestMappingEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
Object
>>
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
;
return
result
;
}
}
@SuppressWarnings
(
"rawtypes"
)
protected
void
extractMethodMappings
(
ApplicationContext
applicationContext
,
protected
void
extractMethodMappings
(
ApplicationContext
applicationContext
,
Map
<
String
,
Object
>
result
)
{
Map
<
String
,
Object
>
result
)
{
if
(
applicationContext
!=
null
)
{
if
(
applicationContext
!=
null
)
{
for
(
String
name
:
applicationContext
for
(
Entry
<
String
,
AbstractHandlerMethodMapping
>
bean
:
applicationContext
.
getBeansOfType
(
AbstractHandlerMethodMapping
.
class
).
ke
ySet
())
{
.
getBeansOfType
(
AbstractHandlerMethodMapping
.
class
).
entr
ySet
())
{
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
Map
<?,
HandlerMethod
>
methods
=
applicationContext
Map
<?,
HandlerMethod
>
methods
=
bean
.
getValue
().
getHandlerMethods
();
.
getBean
(
name
,
AbstractHandlerMethodMapping
.
class
)
for
(
Entry
<?,
HandlerMethod
>
method
:
methods
.
entrySet
())
{
.
getHandlerMethods
();
for
(
Object
key
:
methods
.
keySet
())
{
Map
<
String
,
String
>
map
=
new
LinkedHashMap
<
String
,
String
>();
Map
<
String
,
String
>
map
=
new
LinkedHashMap
<
String
,
String
>();
map
.
put
(
"bean"
,
name
);
map
.
put
(
"bean"
,
bean
.
getKey
()
);
map
.
put
(
"method"
,
method
s
.
get
(
key
).
toString
());
map
.
put
(
"method"
,
method
.
getValue
(
).
toString
());
result
.
put
(
key
.
toString
(),
map
);
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
)
{
if
(
applicationContext
!=
null
)
{
Map
<
String
,
AbstractUrlHandlerMapping
>
mappings
=
applicationContext
Map
<
String
,
AbstractUrlHandlerMapping
>
mappings
=
applicationContext
.
getBeansOfType
(
AbstractUrlHandlerMapping
.
class
);
.
getBeansOfType
(
AbstractUrlHandlerMapping
.
class
);
for
(
String
name
:
mappings
.
ke
ySet
())
{
for
(
Entry
<
String
,
AbstractUrlHandlerMapping
>
mapping
:
mappings
.
entr
ySet
())
{
AbstractUrlHandlerMapping
mapping
=
mappings
.
get
(
name
);
Map
<
String
,
Object
>
handlers
=
getHandlerMap
(
mapping
.
getValue
()
);
Map
<
String
,
Object
>
handlers
=
getHandlerMap
(
mapping
);
for
(
Entry
<
String
,
Object
>
handler
:
handlers
.
entrySet
())
{
for
(
String
key
:
handlers
.
keySet
())
{
result
.
put
(
handler
.
getKey
(),
result
.
put
(
key
,
Collections
.
singletonMap
(
"bean"
,
name
));
Collections
.
singletonMap
(
"bean"
,
mapping
.
getKey
()
));
}
}
}
}
}
}
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java
View file @
b02cdc72
/*
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
@@ -18,6 +18,7 @@ package org.springframework.boot.actuate.endpoint.jmx;
...
@@ -18,6 +18,7 @@ package org.springframework.boot.actuate.endpoint.jmx;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.locks.ReentrantLock
;
import
java.util.concurrent.locks.ReentrantLock
;
...
@@ -241,8 +242,8 @@ public class EndpointMBeanExporter extends MBeanExporter
...
@@ -241,8 +242,8 @@ public class EndpointMBeanExporter extends MBeanExporter
}
}
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
for
(
Object
key
:
this
.
objectNameStaticProperties
.
ke
ySet
())
{
for
(
Entry
<
Object
,
Object
>
name
:
this
.
objectNameStaticProperties
.
entr
ySet
())
{
builder
.
append
(
","
+
key
+
"="
+
this
.
objectNameStaticProperties
.
get
(
key
));
builder
.
append
(
","
+
name
.
getKey
()
+
"="
+
name
.
getValue
(
));
}
}
return
builder
.
toString
();
return
builder
.
toString
();
}
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
View file @
b02cdc72
/*
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
@@ -21,6 +21,7 @@ import java.util.Collections;
...
@@ -21,6 +21,7 @@ import java.util.Collections;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
javax.servlet.Servlet
;
import
javax.servlet.Servlet
;
...
@@ -132,7 +133,8 @@ public class WebMvcAutoConfiguration {
...
@@ -132,7 +133,8 @@ public class WebMvcAutoConfiguration {
@EnableConfigurationProperties
({
WebMvcProperties
.
class
,
ResourceProperties
.
class
})
@EnableConfigurationProperties
({
WebMvcProperties
.
class
,
ResourceProperties
.
class
})
public
static
class
WebMvcAutoConfigurationAdapter
extends
WebMvcConfigurerAdapter
{
public
static
class
WebMvcAutoConfigurationAdapter
extends
WebMvcConfigurerAdapter
{
private
static
final
Log
logger
=
LogFactory
.
getLog
(
WebMvcConfigurerAdapter
.
class
);
private
static
final
Log
logger
=
LogFactory
.
getLog
(
WebMvcConfigurerAdapter
.
class
);
@Autowired
@Autowired
private
ResourceProperties
resourceProperties
=
new
ResourceProperties
();
private
ResourceProperties
resourceProperties
=
new
ResourceProperties
();
...
@@ -162,8 +164,8 @@ public class WebMvcAutoConfiguration {
...
@@ -162,8 +164,8 @@ public class WebMvcAutoConfiguration {
@Override
@Override
public
void
configureContentNegotiation
(
ContentNegotiationConfigurer
configurer
)
{
public
void
configureContentNegotiation
(
ContentNegotiationConfigurer
configurer
)
{
Map
<
String
,
MediaType
>
mediaTypes
=
this
.
mvcProperties
.
getMediaTypes
();
Map
<
String
,
MediaType
>
mediaTypes
=
this
.
mvcProperties
.
getMediaTypes
();
for
(
String
extension
:
mediaTypes
.
ke
ySet
())
{
for
(
Entry
<
String
,
MediaType
>
mediaType
:
mediaTypes
.
entr
ySet
())
{
configurer
.
mediaType
(
extension
,
mediaTypes
.
get
(
extension
));
configurer
.
mediaType
(
mediaType
.
getKey
(),
mediaType
.
getValue
(
));
}
}
}
}
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java
View file @
b02cdc72
/*
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
@@ -23,11 +23,15 @@ import java.util.Comparator;
...
@@ -23,11 +23,15 @@ import java.util.Comparator;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
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.
* A helper class generating a report from the meta-data of a particular service.
*
*
* @author Stephane Nicoll
* @author Stephane Nicoll
* @author Andy Wilkinson
* @since 1.2.0
* @since 1.2.0
*/
*/
class
ServiceCapabilitiesReportGenerator
{
class
ServiceCapabilitiesReportGenerator
{
...
@@ -104,11 +108,20 @@ class ServiceCapabilitiesReportGenerator {
...
@@ -104,11 +108,20 @@ class ServiceCapabilitiesReportGenerator {
StringBuilder
report
)
{
StringBuilder
report
)
{
report
.
append
(
"Available project types:"
+
NEW_LINE
);
report
.
append
(
"Available project types:"
+
NEW_LINE
);
report
.
append
(
"------------------------"
+
NEW_LINE
);
report
.
append
(
"------------------------"
+
NEW_LINE
);
List
<
String
>
typeIds
=
new
ArrayList
<
String
>(
metadata
.
getProjectTypes
().
keySet
());
SortedSet
<
Entry
<
String
,
ProjectType
>>
entries
=
new
TreeSet
<
Entry
<
String
,
ProjectType
>>(
Collections
.
sort
(
typeIds
);
new
Comparator
<
Entry
<
String
,
ProjectType
>>()
{
for
(
String
typeId
:
typeIds
)
{
ProjectType
type
=
metadata
.
getProjectTypes
().
get
(
typeId
);
@Override
report
.
append
(
typeId
+
" - "
+
type
.
getName
());
public
int
compare
(
Entry
<
String
,
ProjectType
>
o1
,
Entry
<
String
,
ProjectType
>
o2
)
{
return
o1
.
getKey
().
compareTo
(
o2
.
getKey
());
}
});
entries
.
addAll
(
metadata
.
getProjectTypes
().
entrySet
());
for
(
Entry
<
String
,
ProjectType
>
entry
:
entries
)
{
ProjectType
type
=
entry
.
getValue
();
report
.
append
(
entry
.
getKey
()
+
" - "
+
type
.
getName
());
if
(!
type
.
getTags
().
isEmpty
())
{
if
(!
type
.
getTags
().
isEmpty
())
{
reportTags
(
report
,
type
);
reportTags
(
report
,
type
);
}
}
...
...
spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java
View file @
b02cdc72
/*
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
6
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.
...
@@ -19,6 +19,7 @@ package org.springframework.boot.maven;
...
@@ -19,6 +19,7 @@ package org.springframework.boot.maven;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map.Entry
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarOutputStream
;
import
java.util.jar.JarOutputStream
;
...
@@ -32,6 +33,7 @@ import org.apache.maven.plugins.shade.resource.ResourceTransformer;
...
@@ -32,6 +33,7 @@ import org.apache.maven.plugins.shade.resource.ResourceTransformer;
* to be merged without losing any information.
* to be merged without losing any information.
*
*
* @author Dave Syer
* @author Dave Syer
* @author Andy Wilkinson
*/
*/
public
class
PropertiesMergingResourceTransformer
implements
ResourceTransformer
{
public
class
PropertiesMergingResourceTransformer
implements
ResourceTransformer
{
...
@@ -62,9 +64,9 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer
...
@@ -62,9 +64,9 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
properties
.
load
(
is
);
properties
.
load
(
is
);
is
.
close
();
is
.
close
();
for
(
Object
key
:
properties
.
ke
ySet
())
{
for
(
Entry
<
Object
,
Object
>
entry
:
properties
.
entr
ySet
())
{
String
name
=
(
String
)
key
;
String
name
=
(
String
)
entry
.
getKey
()
;
String
value
=
properties
.
getProperty
(
name
);
String
value
=
(
String
)
entry
.
getValue
(
);
String
existing
=
this
.
data
.
getProperty
(
name
);
String
existing
=
this
.
data
.
getProperty
(
name
);
this
.
data
.
setProperty
(
name
,
this
.
data
.
setProperty
(
name
,
existing
==
null
?
value
:
existing
+
","
+
value
);
existing
==
null
?
value
:
existing
+
","
+
value
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment