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
d117a6b2
Commit
d117a6b2
authored
Mar 27, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
71c2c69c
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
66 additions
and
22 deletions
+66
-22
BasicErrorController.java
...pringframework/boot/actuate/web/BasicErrorController.java
+8
-5
ManagementPortSampleActuatorApplicationTests.java
...ctuator/ManagementPortSampleActuatorApplicationTests.java
+5
-14
pom.xml
spring-boot-starters/spring-boot-starter-actuator/pom.xml
+2
-1
Banner.java
...g-boot/src/main/java/org/springframework/boot/Banner.java
+1
-0
BeanDefinitionLoader.java
...n/java/org/springframework/boot/BeanDefinitionLoader.java
+3
-0
AnsiElement.java
.../main/java/org/springframework/boot/ansi/AnsiElement.java
+13
-0
RelaxedNames.java
...main/java/org/springframework/boot/bind/RelaxedNames.java
+3
-0
YamlJavaBeanPropertyConstructor.java
...gframework/boot/bind/YamlJavaBeanPropertyConstructor.java
+2
-1
ParentContextApplicationContextInitializer.java
...t/builder/ParentContextApplicationContextInitializer.java
+1
-0
FileEncodingApplicationListener.java
...amework/boot/context/FileEncodingApplicationListener.java
+1
-0
EmbeddedServletContainer.java
...ework/boot/context/embedded/EmbeddedServletContainer.java
+1
-0
EnumerableCompositePropertySource.java
...framework/boot/env/EnumerableCompositePropertySource.java
+1
-0
PropertiesPropertySourceLoader.java
...ingframework/boot/env/PropertiesPropertySourceLoader.java
+1
-0
Base64.java
...t/src/main/java/org/springframework/boot/test/Base64.java
+2
-1
RelaxedDataBinderTests.java
...org/springframework/boot/bind/RelaxedDataBinderTests.java
+22
-0
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/BasicErrorController.java
View file @
d117a6b2
...
...
@@ -76,14 +76,17 @@ public class BasicErrorController implements ErrorController {
String
trace
=
request
.
getParameter
(
"trace"
);
Map
<
String
,
Object
>
extracted
=
extract
(
attributes
,
trace
!=
null
&&
!
"false"
.
equals
(
trace
.
toLowerCase
()),
true
);
HttpStatus
statusCode
;
HttpStatus
statusCode
=
getStatus
((
Integer
)
extracted
.
get
(
"status"
));
return
new
ResponseEntity
<
Map
<
String
,
Object
>>(
extracted
,
statusCode
);
}
private
HttpStatus
getStatus
(
Integer
value
)
{
try
{
statusCode
=
HttpStatus
.
valueOf
((
Integer
)
extracted
.
get
(
"status"
)
);
return
HttpStatus
.
valueOf
(
value
);
}
catch
(
Exception
e
)
{
statusCode
=
HttpStatus
.
INTERNAL_SERVER_ERROR
;
catch
(
Exception
e
x
)
{
return
HttpStatus
.
INTERNAL_SERVER_ERROR
;
}
return
new
ResponseEntity
<
Map
<
String
,
Object
>>(
extracted
,
statusCode
);
}
@Override
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java
View file @
d117a6b2
...
...
@@ -32,7 +32,6 @@ import org.springframework.test.annotation.DirtiesContext;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
...
...
@@ -61,8 +60,8 @@ public class ManagementPortSampleActuatorApplicationTests {
@Test
public
void
testHome
()
throws
Exception
{
@SuppressWarnings
(
"rawtypes"
)
ResponseEntity
<
Map
>
entity
=
getRestTemplate
(
"user"
,
getPassword
()).
getForEntity
(
"http://localhost:"
+
this
.
port
,
Map
.
class
);
ResponseEntity
<
Map
>
entity
=
RestTemplates
.
get
(
"user"
,
getPassword
())
.
getForEntity
(
"http://localhost:"
+
this
.
port
,
Map
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
body
=
entity
.
getBody
();
...
...
@@ -73,14 +72,14 @@ public class ManagementPortSampleActuatorApplicationTests {
public
void
testMetrics
()
throws
Exception
{
testHome
();
// makes sure some requests have been made
@SuppressWarnings
(
"rawtypes"
)
ResponseEntity
<
Map
>
entity
=
getRestTemplate
().
getForEntity
(
ResponseEntity
<
Map
>
entity
=
RestTemplates
.
get
().
getForEntity
(
"http://localhost:"
+
this
.
managementPort
+
"/metrics"
,
Map
.
class
);
assertEquals
(
HttpStatus
.
UNAUTHORIZED
,
entity
.
getStatusCode
());
}
@Test
public
void
testHealth
()
throws
Exception
{
ResponseEntity
<
String
>
entity
=
getRestTemplate
().
getForEntity
(
ResponseEntity
<
String
>
entity
=
RestTemplates
.
get
().
getForEntity
(
"http://localhost:"
+
this
.
managementPort
+
"/health"
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
assertEquals
(
"ok"
,
entity
.
getBody
());
...
...
@@ -89,7 +88,7 @@ public class ManagementPortSampleActuatorApplicationTests {
@Test
public
void
testErrorPage
()
throws
Exception
{
@SuppressWarnings
(
"rawtypes"
)
ResponseEntity
<
Map
>
entity
=
getRestTemplate
().
getForEntity
(
ResponseEntity
<
Map
>
entity
=
RestTemplates
.
get
().
getForEntity
(
"http://localhost:"
+
this
.
managementPort
+
"/error"
,
Map
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -101,12 +100,4 @@ public class ManagementPortSampleActuatorApplicationTests {
return
this
.
security
.
getUser
().
getPassword
();
}
private
RestTemplate
getRestTemplate
()
{
return
RestTemplates
.
get
();
}
private
RestTemplate
getRestTemplate
(
final
String
username
,
final
String
password
)
{
return
RestTemplates
.
get
(
username
,
password
);
}
}
spring-boot-starters/spring-boot-starter-actuator/pom.xml
View file @
d117a6b2
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
...
...
spring-boot/src/main/java/org/springframework/boot/Banner.java
View file @
d117a6b2
...
...
@@ -63,4 +63,5 @@ abstract class Banner {
FAINT
,
version
));
printStream
.
println
();
}
}
spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java
View file @
d117a6b2
...
...
@@ -301,10 +301,13 @@ class BeanDefinitionLoader {
protected
boolean
matchClassName
(
String
className
)
{
return
this
.
classNames
.
contains
(
className
);
}
}
protected
interface
GroovyBeanDefinitionSource
{
Closure
<?>
getBeans
();
}
}
spring-boot/src/main/java/org/springframework/boot/ansi/AnsiElement.java
View file @
d117a6b2
...
...
@@ -24,19 +24,31 @@ package org.springframework.boot.ansi;
public
interface
AnsiElement
{
public
static
final
AnsiElement
NORMAL
=
new
DefaultAnsiElement
(
"0"
);
public
static
final
AnsiElement
BOLD
=
new
DefaultAnsiElement
(
"1"
);
public
static
final
AnsiElement
FAINT
=
new
DefaultAnsiElement
(
"2"
);
public
static
final
AnsiElement
ITALIC
=
new
DefaultAnsiElement
(
"3"
);
public
static
final
AnsiElement
UNDERLINE
=
new
DefaultAnsiElement
(
"4"
);
public
static
final
AnsiElement
BLACK
=
new
DefaultAnsiElement
(
"30"
);
public
static
final
AnsiElement
RED
=
new
DefaultAnsiElement
(
"31"
);
public
static
final
AnsiElement
GREEN
=
new
DefaultAnsiElement
(
"32"
);
public
static
final
AnsiElement
YELLOW
=
new
DefaultAnsiElement
(
"33"
);
public
static
final
AnsiElement
BLUE
=
new
DefaultAnsiElement
(
"34"
);
public
static
final
AnsiElement
MAGENTA
=
new
DefaultAnsiElement
(
"35"
);
public
static
final
AnsiElement
CYAN
=
new
DefaultAnsiElement
(
"36"
);
public
static
final
AnsiElement
WHITE
=
new
DefaultAnsiElement
(
"37"
);
public
static
final
AnsiElement
DEFAULT
=
new
DefaultAnsiElement
(
"39"
);
/**
...
...
@@ -60,6 +72,7 @@ public interface AnsiElement {
public
String
toString
()
{
return
this
.
code
;
}
}
}
spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java
View file @
d117a6b2
...
...
@@ -90,6 +90,7 @@ public final class RelaxedNames implements Iterable<String> {
};
public
abstract
String
apply
(
String
value
);
}
static
enum
Manipulation
{
...
...
@@ -157,5 +158,7 @@ public final class RelaxedNames implements Iterable<String> {
};
public
abstract
String
apply
(
String
value
);
}
}
spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java
View file @
d117a6b2
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -89,5 +89,6 @@ public class YamlJavaBeanPropertyConstructor extends Constructor {
Property
property
=
(
forType
==
null
?
null
:
forType
.
get
(
name
));
return
(
property
==
null
?
super
.
getProperty
(
type
,
name
)
:
property
);
}
}
}
spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java
View file @
d117a6b2
...
...
@@ -75,6 +75,7 @@ public class ParentContextApplicationContextInitializer implements
(
ConfigurableApplicationContext
)
context
));
}
}
}
public
static
class
ParentContextAvailableEvent
extends
ApplicationEvent
{
...
...
spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java
View file @
d117a6b2
...
...
@@ -75,4 +75,5 @@ public class FileEncodingApplicationListener implements
}
}
}
};
spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java
View file @
d117a6b2
...
...
@@ -48,6 +48,7 @@ public interface EmbeddedServletContainer {
public
int
getPort
()
{
return
0
;
}
};
/**
...
...
spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java
View file @
d117a6b2
...
...
@@ -75,4 +75,5 @@ public class EnumerableCompositePropertySource extends
getSource
().
add
(
source
);
this
.
names
=
null
;
}
}
spring-boot/src/main/java/org/springframework/boot/env/PropertiesPropertySourceLoader.java
View file @
d117a6b2
...
...
@@ -48,4 +48,5 @@ public class PropertiesPropertySourceLoader implements PropertySourceLoader {
}
return
null
;
}
}
spring-boot/src/main/java/org/springframework/boot/test/Base64.java
View file @
d117a6b2
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -640,4 +640,5 @@ class InvalidBase64CharacterException extends IllegalArgumentException {
InvalidBase64CharacterException
(
String
message
)
{
super
(
message
);
}
}
spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java
View file @
d117a6b2
...
...
@@ -487,9 +487,11 @@ public class RelaxedDataBinderTests {
public
void
setInfo
(
Map
<
String
,
Object
>
nested
)
{
this
.
info
=
nested
;
}
}
public
static
class
TargetWithNestedMap
{
private
Map
<
String
,
Object
>
nested
;
public
Map
<
String
,
Object
>
getNested
()
{
...
...
@@ -499,9 +501,11 @@ public class RelaxedDataBinderTests {
public
void
setNested
(
Map
<
String
,
Object
>
nested
)
{
this
.
nested
=
nested
;
}
}
public
static
class
TargetWithNestedMapOfString
{
private
Map
<
String
,
String
>
nested
;
public
Map
<
String
,
String
>
getNested
()
{
...
...
@@ -511,9 +515,11 @@ public class RelaxedDataBinderTests {
public
void
setNested
(
Map
<
String
,
String
>
nested
)
{
this
.
nested
=
nested
;
}
}
public
static
class
TargetWithNestedMapOfListOfString
{
private
Map
<
String
,
List
<
String
>>
nested
;
public
Map
<
String
,
List
<
String
>>
getNested
()
{
...
...
@@ -523,9 +529,11 @@ public class RelaxedDataBinderTests {
public
void
setNested
(
Map
<
String
,
List
<
String
>>
nested
)
{
this
.
nested
=
nested
;
}
}
public
static
class
TargetWithNestedMapOfListOfBean
{
private
Map
<
String
,
List
<
VanillaTarget
>>
nested
;
public
Map
<
String
,
List
<
VanillaTarget
>>
getNested
()
{
...
...
@@ -535,9 +543,11 @@ public class RelaxedDataBinderTests {
public
void
setNested
(
Map
<
String
,
List
<
VanillaTarget
>>
nested
)
{
this
.
nested
=
nested
;
}
}
public
static
class
TargetWithNestedMapOfBean
{
private
Map
<
String
,
VanillaTarget
>
nested
;
public
Map
<
String
,
VanillaTarget
>
getNested
()
{
...
...
@@ -547,9 +557,11 @@ public class RelaxedDataBinderTests {
public
void
setNested
(
Map
<
String
,
VanillaTarget
>
nested
)
{
this
.
nested
=
nested
;
}
}
public
static
class
TargetWithNestedList
{
private
List
<
String
>
nested
;
public
List
<
String
>
getNested
()
{
...
...
@@ -559,33 +571,41 @@ public class RelaxedDataBinderTests {
public
void
setNested
(
List
<
String
>
nested
)
{
this
.
nested
=
nested
;
}
}
public
static
class
TargetWithReadOnlyNestedList
{
private
final
List
<
String
>
nested
=
new
ArrayList
<
String
>();
public
List
<
String
>
getNested
()
{
return
this
.
nested
;
}
}
public
static
class
TargetWithReadOnlyDoubleNestedList
{
TargetWithReadOnlyNestedList
bean
=
new
TargetWithReadOnlyNestedList
();
public
TargetWithReadOnlyNestedList
getBean
()
{
return
this
.
bean
;
}
}
public
static
class
TargetWithReadOnlyNestedCollection
{
private
final
Collection
<
String
>
nested
=
new
ArrayList
<
String
>();
public
Collection
<
String
>
getNested
()
{
return
this
.
nested
;
}
}
public
static
class
TargetWithNestedSet
{
private
Set
<
String
>
nested
=
new
LinkedHashSet
<
String
>();
public
Set
<
String
>
getNested
()
{
...
...
@@ -595,6 +615,7 @@ public class RelaxedDataBinderTests {
public
void
setNested
(
Set
<
String
>
nested
)
{
this
.
nested
=
nested
;
}
}
public
static
class
TargetWithNestedObject
{
...
...
@@ -650,6 +671,7 @@ public class RelaxedDataBinderTests {
public
void
setFooBaz
(
String
fooBaz
)
{
this
.
fooBaz
=
fooBaz
;
}
}
public
static
class
ValidatedTarget
{
...
...
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