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
d17b7c81
Commit
d17b7c81
authored
Oct 28, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
466ed469
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
131 additions
and
116 deletions
+131
-116
HealthIndicatorAutoConfigurationProperties.java
...configure/HealthIndicatorAutoConfigurationProperties.java
+2
-0
ManagementSecurityAutoConfiguration.java
...te/autoconfigure/ManagementSecurityAutoConfiguration.java
+5
-6
HealthEndpoint.java
...springframework/boot/actuate/endpoint/HealthEndpoint.java
+5
-6
EndpointHandlerMapping.java
...ork/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java
+13
-6
HealthMvcEndpoint.java
...ramework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java
+8
-11
ConfigurationPropertiesReportEndpointTests.java
.../endpoint/ConfigurationPropertiesReportEndpointTests.java
+1
-1
HealthMvcEndpointTests.java
...ork/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java
+13
-12
MailProperties.java
...ringframework/boot/autoconfigure/mail/MailProperties.java
+7
-6
MailSenderAutoConfiguration.java
.../boot/autoconfigure/mail/MailSenderAutoConfiguration.java
+10
-11
DefaultErrorAttributes.java
...mework/boot/autoconfigure/web/DefaultErrorAttributes.java
+2
-2
MailSenderAutoConfigurationTests.java
.../autoconfigure/mail/MailSenderAutoConfigurationTests.java
+18
-11
DefaultErrorAttributesTests.java
...k/boot/autoconfigure/web/DefaultErrorAttributesTests.java
+2
-1
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+1
-0
howto.adoc
spring-boot-docs/src/main/asciidoc/howto.adoc
+17
-16
spring-boot-cli.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-cli.adoc
+12
-8
SampleActuatorApplicationTests.java
.../java/sample/actuator/SampleActuatorApplicationTests.java
+2
-2
VcapApplicationListener.java
...gframework/boot/cloudfoundry/VcapApplicationListener.java
+1
-5
SpringApplicationBuilderTests.java
...framework/boot/builder/SpringApplicationBuilderTests.java
+9
-9
VcapApplicationListenerTests.java
...ework/boot/cloudfoundry/VcapApplicationListenerTests.java
+3
-3
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationProperties.java
View file @
d17b7c81
...
@@ -22,7 +22,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
...
@@ -22,7 +22,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
/**
/**
* Configuration properties for some health properties
* Configuration properties for some health properties
*
* @author Christian Dupuis
* @author Christian Dupuis
* @since 1.2.0
*/
*/
@ConfigurationProperties
(
"health.status"
)
@ConfigurationProperties
(
"health.status"
)
public
class
HealthIndicatorAutoConfigurationProperties
{
public
class
HealthIndicatorAutoConfigurationProperties
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfiguration.java
View file @
d17b7c81
...
@@ -142,8 +142,8 @@ public class ManagementSecurityAutoConfiguration {
...
@@ -142,8 +142,8 @@ public class ManagementSecurityAutoConfiguration {
List
<
String
>
ignored
=
SpringBootWebSecurityConfiguration
List
<
String
>
ignored
=
SpringBootWebSecurityConfiguration
.
getIgnored
(
this
.
security
);
.
getIgnored
(
this
.
security
);
if
(!
this
.
management
.
getSecurity
().
isEnabled
())
{
if
(!
this
.
management
.
getSecurity
().
isEnabled
())
{
ignored
.
addAll
(
Arrays
.
asList
(
getEndpointPaths
(
ignored
.
addAll
(
Arrays
this
.
endpointHandlerMapping
)));
.
asList
(
getEndpointPaths
(
this
.
endpointHandlerMapping
)));
}
}
if
(
ignored
.
contains
(
"none"
))
{
if
(
ignored
.
contains
(
"none"
))
{
ignored
.
remove
(
"none"
);
ignored
.
remove
(
"none"
);
...
@@ -227,11 +227,10 @@ public class ManagementSecurityAutoConfiguration {
...
@@ -227,11 +227,10 @@ public class ManagementSecurityAutoConfiguration {
http
.
exceptionHandling
().
authenticationEntryPoint
(
entryPoint
());
http
.
exceptionHandling
().
authenticationEntryPoint
(
entryPoint
());
paths
=
this
.
server
.
getPathsArray
(
paths
);
paths
=
this
.
server
.
getPathsArray
(
paths
);
http
.
requestMatchers
().
antMatchers
(
paths
);
http
.
requestMatchers
().
antMatchers
(
paths
);
// @formatter:off
String
[]
endpointPaths
=
this
.
server
.
getPathsArray
(
getEndpointPaths
(
http
.
authorizeRequests
()
this
.
endpointHandlerMapping
,
false
));
.
antMatchers
(
this
.
server
.
getPathsArray
(
getEndpointPaths
(
this
.
endpointHandlerMapping
,
false
))
).
access
(
"permitAll()"
)
http
.
authorizeRequests
().
antMatchers
(
endpointPaths
).
access
(
"permitAll()"
)
.
anyRequest
().
hasRole
(
this
.
management
.
getSecurity
().
getRole
());
.
anyRequest
().
hasRole
(
this
.
management
.
getSecurity
().
getRole
());
// @formatter:on
http
.
httpBasic
();
http
.
httpBasic
();
// No cookies for management endpoints by default
// No cookies for management endpoints by default
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java
View file @
d17b7c81
...
@@ -36,20 +36,19 @@ public class HealthEndpoint extends AbstractEndpoint<Health> {
...
@@ -36,20 +36,19 @@ public class HealthEndpoint extends AbstractEndpoint<Health> {
private
final
HealthIndicator
healthIndicator
;
private
final
HealthIndicator
healthIndicator
;
private
long
t
tl
=
1000
;
private
long
t
imeToLive
=
1000
;
/**
/**
* Time to live for cached result. If accessed anonymously, we might need to cache the
* Time to live for cached result. If accessed anonymously, we might need to cache the
* result of this endpoint to prevent a DOS attack.
* result of this endpoint to prevent a DOS attack.
*
* @return time to live in milliseconds (default 1000)
* @return time to live in milliseconds (default 1000)
*/
*/
public
long
getT
tl
()
{
public
long
getT
imeToLive
()
{
return
t
tl
;
return
t
his
.
timeToLive
;
}
}
public
void
setT
tl
(
long
ttl
)
{
public
void
setT
imeToLive
(
long
ttl
)
{
this
.
t
tl
=
ttl
;
this
.
t
imeToLive
=
ttl
;
}
}
/**
/**
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java
View file @
d17b7c81
...
@@ -18,8 +18,9 @@ package org.springframework.boot.actuate.endpoint.mvc;
...
@@ -18,8 +18,9 @@ package org.springframework.boot.actuate.endpoint.mvc;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.
HashMap
;
import
java.util.
Collections
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -52,7 +53,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
...
@@ -52,7 +53,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
public
class
EndpointHandlerMapping
extends
RequestMappingHandlerMapping
implements
public
class
EndpointHandlerMapping
extends
RequestMappingHandlerMapping
implements
ApplicationContextAware
{
ApplicationContextAware
{
private
final
Map
<
String
,
MvcEndpoint
>
endpoints
=
new
HashMap
<
String
,
MvcEndpoint
>()
;
private
final
Map
<
String
,
MvcEndpoint
>
endpoints
;
private
String
prefix
=
""
;
private
String
prefix
=
""
;
...
@@ -64,15 +65,21 @@ public class EndpointHandlerMapping extends RequestMappingHandlerMapping impleme
...
@@ -64,15 +65,21 @@ public class EndpointHandlerMapping extends RequestMappingHandlerMapping impleme
* @param endpoints
* @param endpoints
*/
*/
public
EndpointHandlerMapping
(
Collection
<?
extends
MvcEndpoint
>
endpoints
)
{
public
EndpointHandlerMapping
(
Collection
<?
extends
MvcEndpoint
>
endpoints
)
{
HashMap
<
String
,
MvcEndpoint
>
map
=
(
HashMap
<
String
,
MvcEndpoint
>)
this
.
endpoints
;
this
.
endpoints
=
buildEndpointsMap
(
endpoints
);
for
(
MvcEndpoint
endpoint
:
endpoints
)
{
map
.
put
(
endpoint
.
getPath
(),
endpoint
);
}
// By default the static resource handler mapping is LOWEST_PRECEDENCE - 1
// By default the static resource handler mapping is LOWEST_PRECEDENCE - 1
// and the RequestMappingHandlerMapping is 0 (we ideally want to be before both)
// and the RequestMappingHandlerMapping is 0 (we ideally want to be before both)
setOrder
(-
100
);
setOrder
(-
100
);
}
}
private
Map
<
String
,
MvcEndpoint
>
buildEndpointsMap
(
Collection
<?
extends
MvcEndpoint
>
endpoints
)
{
Map
<
String
,
MvcEndpoint
>
map
=
new
LinkedHashMap
<
String
,
MvcEndpoint
>();
for
(
MvcEndpoint
endpoint
:
endpoints
)
{
map
.
put
(
endpoint
.
getPath
(),
endpoint
);
}
return
Collections
.
unmodifiableMap
(
map
);
}
@Override
@Override
public
void
afterPropertiesSet
()
{
public
void
afterPropertiesSet
()
{
super
.
afterPropertiesSet
();
super
.
afterPropertiesSet
();
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java
View file @
d17b7c81
...
@@ -101,29 +101,26 @@ public class HealthMvcEndpoint implements MvcEndpoint {
...
@@ -101,29 +101,26 @@ public class HealthMvcEndpoint implements MvcEndpoint {
@RequestMapping
@RequestMapping
@ResponseBody
@ResponseBody
public
Object
invoke
(
Principal
principal
)
{
public
Object
invoke
(
Principal
principal
)
{
if
(!
this
.
delegate
.
isEnabled
())
{
if
(!
delegate
.
isEnabled
())
{
// Shouldn't happen because the request mapping should not be registered
// Shouldn't happen because the request mapping should not be registered
return
new
ResponseEntity
<
Map
<
String
,
String
>>(
Collections
.
singletonMap
(
return
new
ResponseEntity
<
Map
<
String
,
String
>>(
Collections
.
singletonMap
(
"message"
,
"This endpoint is disabled"
),
HttpStatus
.
NOT_FOUND
);
"message"
,
"This endpoint is disabled"
),
HttpStatus
.
NOT_FOUND
);
}
}
Health
health
=
getHealth
(
principal
);
Health
health
=
getHealth
(
principal
);
Status
status
=
health
.
getStatus
();
Status
status
=
health
.
getStatus
();
if
(
this
.
statusMapping
.
containsKey
(
status
.
getCode
()))
{
if
(
this
.
statusMapping
.
containsKey
(
status
.
getCode
()))
{
return
new
ResponseEntity
<
Health
>(
health
,
this
.
statusMapping
.
get
(
status
return
new
ResponseEntity
<
Health
>(
health
,
this
.
statusMapping
.
get
(
status
.
getCode
()));
.
getCode
()));
}
}
return
health
;
return
health
;
}
}
private
Health
getHealth
(
Principal
principal
)
{
private
Health
getHealth
(
Principal
principal
)
{
Health
health
=
useCachedValue
(
principal
)
?
cached
:
(
Health
)
delegate
.
invoke
();
Health
health
=
(
useCachedValue
(
principal
)
?
this
.
cached
:
(
Health
)
this
.
delegate
.
invoke
());
// Not too worried about concurrent access here, the worst that can happen is the
// Not too worried about concurrent access here, the worst that can happen is the
// odd extra call to delegate.invoke()
// odd extra call to delegate.invoke()
cached
=
health
;
this
.
cached
=
health
;
if
(!
secure
(
principal
))
{
if
(!
secure
(
principal
))
{
// If not secure we only expose the status
// If not secure we only expose the status
health
=
Health
.
status
(
health
.
getStatus
()).
build
();
health
=
Health
.
status
(
health
.
getStatus
()).
build
();
...
@@ -137,12 +134,12 @@ public class HealthMvcEndpoint implements MvcEndpoint {
...
@@ -137,12 +134,12 @@ public class HealthMvcEndpoint implements MvcEndpoint {
private
boolean
useCachedValue
(
Principal
principal
)
{
private
boolean
useCachedValue
(
Principal
principal
)
{
long
currentAccess
=
System
.
currentTimeMillis
();
long
currentAccess
=
System
.
currentTimeMillis
();
if
(
cached
==
null
||
secure
(
principal
)
if
(
this
.
cached
==
null
||
secure
(
principal
)
||
currentAccess
-
lastAccess
>
delegate
.
getTtl
())
{
||
(
currentAccess
-
this
.
lastAccess
)
>
this
.
delegate
.
getTimeToLive
())
{
lastAccess
=
currentAccess
;
this
.
lastAccess
=
currentAccess
;
return
false
;
return
false
;
}
}
return
cached
!=
null
;
return
this
.
cached
!=
null
;
}
}
@Override
@Override
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java
View file @
d17b7c81
...
@@ -72,7 +72,7 @@ public class ConfigurationPropertiesReportEndpointTests extends
...
@@ -72,7 +72,7 @@ public class ConfigurationPropertiesReportEndpointTests extends
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
void
testKeySanitization
()
throws
Exception
{
public
void
testKeySanitization
()
throws
Exception
{
ConfigurationPropertiesReportEndpoint
report
=
getEndpointBean
();
ConfigurationPropertiesReportEndpoint
report
=
getEndpointBean
();
report
.
setKeysToSanitize
(
new
String
[]
{
"property"
}
);
report
.
setKeysToSanitize
(
"property"
);
Map
<
String
,
Object
>
properties
=
report
.
invoke
();
Map
<
String
,
Object
>
properties
=
report
.
invoke
();
Map
<
String
,
Object
>
nestedProperties
=
(
Map
<
String
,
Object
>)
((
Map
<
String
,
Object
>)
properties
Map
<
String
,
Object
>
nestedProperties
=
(
Map
<
String
,
Object
>)
((
Map
<
String
,
Object
>)
properties
.
get
(
"testProperties"
)).
get
(
"properties"
);
.
get
(
"testProperties"
)).
get
(
"properties"
);
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java
View file @
d17b7c81
...
@@ -16,11 +16,6 @@
...
@@ -16,11 +16,6 @@
package
org
.
springframework
.
boot
.
actuate
.
endpoint
.
mvc
;
package
org
.
springframework
.
boot
.
actuate
.
endpoint
.
mvc
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
java.util.Collections
;
import
java.util.Collections
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -33,10 +28,16 @@ import org.springframework.http.ResponseEntity;
...
@@ -33,10 +28,16 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.authority.AuthorityUtils
;
import
org.springframework.security.core.authority.AuthorityUtils
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
/**
* Tests for {@link HealthMvcEndpoint}.
* Tests for {@link HealthMvcEndpoint}.
*
*
* @author Christian Dupuis
* @author Christian Dupuis
* @author Dave Syer
*/
*/
public
class
HealthMvcEndpointTests
{
public
class
HealthMvcEndpointTests
{
...
@@ -92,7 +93,7 @@ public class HealthMvcEndpointTests {
...
@@ -92,7 +93,7 @@ public class HealthMvcEndpointTests {
public
void
secure
()
{
public
void
secure
()
{
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
new
Health
.
Builder
().
up
().
withDetail
(
"foo"
,
"bar"
).
build
());
new
Health
.
Builder
().
up
().
withDetail
(
"foo"
,
"bar"
).
build
());
Object
result
=
this
.
mvc
.
invoke
(
user
);
Object
result
=
this
.
mvc
.
invoke
(
this
.
user
);
assertTrue
(
result
instanceof
Health
);
assertTrue
(
result
instanceof
Health
);
assertTrue
(((
Health
)
result
).
getStatus
()
==
Status
.
UP
);
assertTrue
(((
Health
)
result
).
getStatus
()
==
Status
.
UP
);
assertEquals
(
"bar"
,
((
Health
)
result
).
getDetails
().
get
(
"foo"
));
assertEquals
(
"bar"
,
((
Health
)
result
).
getDetails
().
get
(
"foo"
));
...
@@ -100,25 +101,25 @@ public class HealthMvcEndpointTests {
...
@@ -100,25 +101,25 @@ public class HealthMvcEndpointTests {
@Test
@Test
public
void
secureNotCached
()
{
public
void
secureNotCached
()
{
given
(
this
.
endpoint
.
getT
tl
()).
willReturn
(
10000L
);
given
(
this
.
endpoint
.
getT
imeToLive
()).
willReturn
(
10000L
);
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
new
Health
.
Builder
().
up
().
withDetail
(
"foo"
,
"bar"
).
build
());
new
Health
.
Builder
().
up
().
withDetail
(
"foo"
,
"bar"
).
build
());
Object
result
=
this
.
mvc
.
invoke
(
user
);
Object
result
=
this
.
mvc
.
invoke
(
this
.
user
);
assertTrue
(
result
instanceof
Health
);
assertTrue
(
result
instanceof
Health
);
assertTrue
(((
Health
)
result
).
getStatus
()
==
Status
.
UP
);
assertTrue
(((
Health
)
result
).
getStatus
()
==
Status
.
UP
);
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
new
Health
.
Builder
().
down
().
build
());
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
new
Health
.
Builder
().
down
().
build
());
result
=
this
.
mvc
.
invoke
(
user
);
result
=
this
.
mvc
.
invoke
(
this
.
user
);
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
Health
health
=
(
Health
)
(
(
ResponseEntity
<
Health
>)
result
).
getBody
();
Health
health
=
((
ResponseEntity
<
Health
>)
result
).
getBody
();
assertTrue
(
health
.
getStatus
()
==
Status
.
DOWN
);
assertTrue
(
health
.
getStatus
()
==
Status
.
DOWN
);
}
}
@Test
@Test
public
void
unsecureCached
()
{
public
void
unsecureCached
()
{
given
(
this
.
endpoint
.
getT
tl
()).
willReturn
(
10000L
);
given
(
this
.
endpoint
.
getT
imeToLive
()).
willReturn
(
10000L
);
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
new
Health
.
Builder
().
up
().
withDetail
(
"foo"
,
"bar"
).
build
());
new
Health
.
Builder
().
up
().
withDetail
(
"foo"
,
"bar"
).
build
());
Object
result
=
this
.
mvc
.
invoke
(
user
);
Object
result
=
this
.
mvc
.
invoke
(
this
.
user
);
assertTrue
(
result
instanceof
Health
);
assertTrue
(
result
instanceof
Health
);
assertTrue
(((
Health
)
result
).
getStatus
()
==
Status
.
UP
);
assertTrue
(((
Health
)
result
).
getStatus
()
==
Status
.
UP
);
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
new
Health
.
Builder
().
down
().
build
());
given
(
this
.
endpoint
.
invoke
()).
willReturn
(
new
Health
.
Builder
().
down
().
build
());
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java
View file @
d17b7c81
...
@@ -26,6 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
...
@@ -26,6 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
*
*
* @author Oliver Gierke
* @author Oliver Gierke
* @author Stephane Nicoll
* @author Stephane Nicoll
* @since 1.2.0
*/
*/
@ConfigurationProperties
(
prefix
=
"spring.mail"
)
@ConfigurationProperties
(
prefix
=
"spring.mail"
)
public
class
MailProperties
{
public
class
MailProperties
{
...
@@ -43,7 +44,7 @@ public class MailProperties {
...
@@ -43,7 +44,7 @@ public class MailProperties {
private
Map
<
String
,
String
>
properties
=
new
HashMap
<
String
,
String
>();
private
Map
<
String
,
String
>
properties
=
new
HashMap
<
String
,
String
>();
public
String
getHost
()
{
public
String
getHost
()
{
return
host
;
return
this
.
host
;
}
}
public
void
setHost
(
String
host
)
{
public
void
setHost
(
String
host
)
{
...
@@ -51,7 +52,7 @@ public class MailProperties {
...
@@ -51,7 +52,7 @@ public class MailProperties {
}
}
public
Integer
getPort
()
{
public
Integer
getPort
()
{
return
port
;
return
this
.
port
;
}
}
public
void
setPort
(
Integer
port
)
{
public
void
setPort
(
Integer
port
)
{
...
@@ -59,7 +60,7 @@ public class MailProperties {
...
@@ -59,7 +60,7 @@ public class MailProperties {
}
}
public
String
getUsername
()
{
public
String
getUsername
()
{
return
username
;
return
this
.
username
;
}
}
public
void
setUsername
(
String
username
)
{
public
void
setUsername
(
String
username
)
{
...
@@ -67,7 +68,7 @@ public class MailProperties {
...
@@ -67,7 +68,7 @@ public class MailProperties {
}
}
public
String
getPassword
()
{
public
String
getPassword
()
{
return
password
;
return
this
.
password
;
}
}
public
void
setPassword
(
String
password
)
{
public
void
setPassword
(
String
password
)
{
...
@@ -75,7 +76,7 @@ public class MailProperties {
...
@@ -75,7 +76,7 @@ public class MailProperties {
}
}
public
String
getDefaultEncoding
()
{
public
String
getDefaultEncoding
()
{
return
defaultEncoding
;
return
this
.
defaultEncoding
;
}
}
public
void
setDefaultEncoding
(
String
defaultEncoding
)
{
public
void
setDefaultEncoding
(
String
defaultEncoding
)
{
...
@@ -83,7 +84,7 @@ public class MailProperties {
...
@@ -83,7 +84,7 @@ public class MailProperties {
}
}
public
Map
<
String
,
String
>
getProperties
()
{
public
Map
<
String
,
String
>
getProperties
()
{
return
properties
;
return
this
.
properties
;
}
}
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfiguration.java
View file @
d17b7c81
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
mail
;
package
org
.
springframework
.
boot
.
autoconfigure
.
mail
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Properties
;
import
javax.activation.MimeType
;
import
javax.activation.MimeType
;
import
javax.mail.internet.MimeMessage
;
import
javax.mail.internet.MimeMessage
;
...
@@ -38,15 +38,17 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
...
@@ -38,15 +38,17 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
*
*
* @author Oliver Gierke
* @author Oliver Gierke
* @author Stephane Nicoll
* @author Stephane Nicoll
* @sicne 1.2.0
*/
*/
@Configuration
@Configuration
@ConditionalOnClass
({
MimeMessage
.
class
,
MimeType
.
class
})
@ConditionalOnClass
({
MimeMessage
.
class
,
MimeType
.
class
})
@ConditionalOnProperty
(
prefix
=
"spring.mail"
,
value
=
"host"
)
@ConditionalOnProperty
(
prefix
=
"spring.mail"
,
value
=
"host"
)
@ConditionalOnMissingBean
(
MailSender
.
class
)
@ConditionalOnMissingBean
(
MailSender
.
class
)
@EnableConfigurationProperties
(
MailProperties
.
class
)
@EnableConfigurationProperties
(
MailProperties
.
class
)
public
class
MailSenderAutoConfiguration
{
public
class
MailSenderAutoConfiguration
{
@Autowired
MailProperties
properties
;
@Autowired
MailProperties
properties
;
@Bean
@Bean
public
JavaMailSender
mailSender
()
{
public
JavaMailSender
mailSender
()
{
...
@@ -58,15 +60,12 @@ public class MailSenderAutoConfiguration {
...
@@ -58,15 +60,12 @@ public class MailSenderAutoConfiguration {
sender
.
setUsername
(
this
.
properties
.
getUsername
());
sender
.
setUsername
(
this
.
properties
.
getUsername
());
sender
.
setPassword
(
this
.
properties
.
getPassword
());
sender
.
setPassword
(
this
.
properties
.
getPassword
());
sender
.
setDefaultEncoding
(
this
.
properties
.
getDefaultEncoding
());
sender
.
setDefaultEncoding
(
this
.
properties
.
getDefaultEncoding
());
Map
<
String
,
String
>
properties
=
this
.
properties
.
getProperties
();
if
(!
this
.
properties
.
getProperties
().
isEmpty
())
{
if
(!
properties
.
isEmpty
())
{
Properties
properties
=
new
Properties
();
Properties
javaMailProperties
=
new
Properties
();
properties
.
putAll
(
this
.
properties
.
getProperties
());
for
(
Map
.
Entry
<
String
,
String
>
entry
:
properties
.
entrySet
())
{
sender
.
setJavaMailProperties
(
properties
);
javaMailProperties
.
setProperty
(
entry
.
getKey
(),
entry
.
getValue
());
}
sender
.
setJavaMailProperties
(
javaMailProperties
);
}
}
return
sender
;
return
sender
;
}
}
}
}
\ No newline at end of file
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java
View file @
d17b7c81
...
@@ -75,7 +75,6 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException
...
@@ -75,7 +75,6 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException
private
void
storeErrorAttributes
(
HttpServletRequest
request
,
Exception
ex
)
{
private
void
storeErrorAttributes
(
HttpServletRequest
request
,
Exception
ex
)
{
request
.
setAttribute
(
ERROR_ATTRIBUTE
,
ex
);
request
.
setAttribute
(
ERROR_ATTRIBUTE
,
ex
);
}
}
@Override
@Override
...
@@ -122,7 +121,8 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException
...
@@ -122,7 +121,8 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException
}
}
}
}
Object
message
=
getAttribute
(
requestAttributes
,
"javax.servlet.error.message"
);
Object
message
=
getAttribute
(
requestAttributes
,
"javax.servlet.error.message"
);
if
((
message
!=
null
||
errorAttributes
.
get
(
"message"
)
==
null
)
&&
!(
error
instanceof
BindingResult
))
{
if
((
message
!=
null
||
errorAttributes
.
get
(
"message"
)
==
null
)
&&
!(
error
instanceof
BindingResult
))
{
errorAttributes
.
put
(
"message"
,
message
==
null
?
"No message available"
errorAttributes
.
put
(
"message"
,
message
==
null
?
"No message available"
:
message
);
:
message
);
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java
View file @
d17b7c81
...
@@ -20,7 +20,6 @@ import org.junit.After;
...
@@ -20,7 +20,6 @@ import org.junit.After;
import
org.junit.Rule
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
import
org.junit.rules.ExpectedException
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -28,7 +27,8 @@ import org.springframework.context.annotation.Configuration;
...
@@ -28,7 +27,8 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.mail.javamail.JavaMailSender
;
import
org.springframework.mail.javamail.JavaMailSender
;
import
org.springframework.mail.javamail.JavaMailSenderImpl
;
import
org.springframework.mail.javamail.JavaMailSenderImpl
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNull
;
/**
/**
* Tests for {@link MailSenderAutoConfiguration}.
* Tests for {@link MailSenderAutoConfiguration}.
...
@@ -53,7 +53,8 @@ public class MailSenderAutoConfigurationTests {
...
@@ -53,7 +53,8 @@ public class MailSenderAutoConfigurationTests {
public
void
smtpHostSet
()
{
public
void
smtpHostSet
()
{
String
host
=
"192.168.1.234"
;
String
host
=
"192.168.1.234"
;
load
(
EmptyConfig
.
class
,
"spring.mail.host:"
+
host
);
load
(
EmptyConfig
.
class
,
"spring.mail.host:"
+
host
);
JavaMailSenderImpl
bean
=
(
JavaMailSenderImpl
)
context
.
getBean
(
JavaMailSender
.
class
);
JavaMailSenderImpl
bean
=
(
JavaMailSenderImpl
)
this
.
context
.
getBean
(
JavaMailSender
.
class
);
assertEquals
(
host
,
bean
.
getHost
());
assertEquals
(
host
,
bean
.
getHost
());
}
}
...
@@ -61,8 +62,10 @@ public class MailSenderAutoConfigurationTests {
...
@@ -61,8 +62,10 @@ public class MailSenderAutoConfigurationTests {
public
void
smptHostWithSettings
()
{
public
void
smptHostWithSettings
()
{
String
host
=
"192.168.1.234"
;
String
host
=
"192.168.1.234"
;
load
(
EmptyConfig
.
class
,
"spring.mail.host:"
+
host
,
"spring.mail.port:42"
,
load
(
EmptyConfig
.
class
,
"spring.mail.host:"
+
host
,
"spring.mail.port:42"
,
"spring.mail.username:john"
,
"spring.mail.password:secret"
,
"spring.mail.default-encoding:ISO-9"
);
"spring.mail.username:john"
,
"spring.mail.password:secret"
,
JavaMailSenderImpl
bean
=
(
JavaMailSenderImpl
)
context
.
getBean
(
JavaMailSender
.
class
);
"spring.mail.default-encoding:ISO-9"
);
JavaMailSenderImpl
bean
=
(
JavaMailSenderImpl
)
this
.
context
.
getBean
(
JavaMailSender
.
class
);
assertEquals
(
host
,
bean
.
getHost
());
assertEquals
(
host
,
bean
.
getHost
());
assertEquals
(
42
,
bean
.
getPort
());
assertEquals
(
42
,
bean
.
getPort
());
assertEquals
(
"john"
,
bean
.
getUsername
());
assertEquals
(
"john"
,
bean
.
getUsername
());
...
@@ -72,29 +75,31 @@ public class MailSenderAutoConfigurationTests {
...
@@ -72,29 +75,31 @@ public class MailSenderAutoConfigurationTests {
@Test
@Test
public
void
smptHostWithJavaMailProperties
()
{
public
void
smptHostWithJavaMailProperties
()
{
load
(
EmptyConfig
.
class
,
"spring.mail.host:localhost"
,
"spring.mail.properties.mail.smtp.auth:true"
);
load
(
EmptyConfig
.
class
,
"spring.mail.host:localhost"
,
JavaMailSenderImpl
bean
=
(
JavaMailSenderImpl
)
context
.
getBean
(
JavaMailSender
.
class
);
"spring.mail.properties.mail.smtp.auth:true"
);
JavaMailSenderImpl
bean
=
(
JavaMailSenderImpl
)
this
.
context
.
getBean
(
JavaMailSender
.
class
);
assertEquals
(
"true"
,
bean
.
getJavaMailProperties
().
get
(
"mail.smtp.auth"
));
assertEquals
(
"true"
,
bean
.
getJavaMailProperties
().
get
(
"mail.smtp.auth"
));
}
}
@Test
@Test
public
void
smtpHostNotSet
()
{
public
void
smtpHostNotSet
()
{
load
(
EmptyConfig
.
class
);
load
(
EmptyConfig
.
class
);
assertEquals
(
0
,
context
.
getBeansOfType
(
JavaMailSender
.
class
).
size
());
assertEquals
(
0
,
this
.
context
.
getBeansOfType
(
JavaMailSender
.
class
).
size
());
}
}
@Test
@Test
public
void
mailSenderBackOff
()
{
public
void
mailSenderBackOff
()
{
load
(
ManualMailConfiguration
.
class
,
"spring.mail.host:smtp.acme.org"
,
load
(
ManualMailConfiguration
.
class
,
"spring.mail.host:smtp.acme.org"
,
"spring.mail.user:user"
,
"spring.mail.password:secret"
);
"spring.mail.user:user"
,
"spring.mail.password:secret"
);
JavaMailSenderImpl
bean
=
(
JavaMailSenderImpl
)
context
.
getBean
(
JavaMailSender
.
class
);
JavaMailSenderImpl
bean
=
(
JavaMailSenderImpl
)
this
.
context
.
getBean
(
JavaMailSender
.
class
);
assertNull
(
bean
.
getUsername
());
assertNull
(
bean
.
getUsername
());
assertNull
(
bean
.
getPassword
());
assertNull
(
bean
.
getPassword
());
}
}
private
void
load
(
Class
<?>
config
,
String
...
environment
)
{
private
void
load
(
Class
<?>
config
,
String
...
environment
)
{
this
.
context
=
doLoad
(
new
Class
<?>[]
{
config
},
environment
);
this
.
context
=
doLoad
(
new
Class
<?>[]
{
config
},
environment
);
}
}
private
AnnotationConfigApplicationContext
doLoad
(
Class
<?>[]
configs
,
private
AnnotationConfigApplicationContext
doLoad
(
Class
<?>[]
configs
,
...
@@ -119,5 +124,7 @@ public class MailSenderAutoConfigurationTests {
...
@@ -119,5 +124,7 @@ public class MailSenderAutoConfigurationTests {
JavaMailSender
customMailSender
()
{
JavaMailSender
customMailSender
()
{
return
new
JavaMailSenderImpl
();
return
new
JavaMailSenderImpl
();
}
}
}
}
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java
View file @
d17b7c81
...
@@ -120,7 +120,8 @@ public class DefaultErrorAttributesTests {
...
@@ -120,7 +120,8 @@ public class DefaultErrorAttributesTests {
@Test
@Test
public
void
nullMessage
()
throws
Exception
{
public
void
nullMessage
()
throws
Exception
{
this
.
request
.
setAttribute
(
"javax.servlet.error.exception"
,
new
RuntimeException
());
this
.
request
.
setAttribute
(
"javax.servlet.error.exception"
,
new
RuntimeException
());
this
.
request
.
setAttribute
(
"javax.servlet.error.message"
,
"Test"
);
this
.
request
.
setAttribute
(
"javax.servlet.error.message"
,
"Test"
);
Map
<
String
,
Object
>
attributes
=
this
.
errorAttributes
.
getErrorAttributes
(
Map
<
String
,
Object
>
attributes
=
this
.
errorAttributes
.
getErrorAttributes
(
this
.
requestAttributes
,
false
);
this
.
requestAttributes
,
false
);
...
...
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
d17b7c81
...
@@ -374,6 +374,7 @@ content into your application; rather pick only the properties that you need.
...
@@ -374,6 +374,7 @@ content into your application; rather pick only the properties that you need.
endpoints.health.id=health
endpoints.health.id=health
endpoints.health.sensitive=false
endpoints.health.sensitive=false
endpoints.health.enabled=true
endpoints.health.enabled=true
endpoints.health.time-to-live=1000
endpoints.info.id=info
endpoints.info.id=info
endpoints.info.sensitive=false
endpoints.info.sensitive=false
endpoints.info.enabled=true
endpoints.info.enabled=true
...
...
spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
d17b7c81
...
@@ -1564,28 +1564,29 @@ would only ever be a development time trick probably).
...
@@ -1564,28 +1564,29 @@ would only ever be a development time trick probably).
[[howto-reload-springloaded-maven]]
[[howto-reload-springloaded-maven]]
==== Configuring Spring Loaded for use with Maven
==== Configuring Spring Loaded for use with Maven
To use Spring Loaded with the Maven command line, just add it as a dependency in the
To use Spring Loaded with the Maven command line, just add it as a dependency in the
Spring Boot plugin declaration, e.g.
Spring Boot plugin declaration, e.g.
.pom.xml
[source,xml,indent=0]
[source,xml,indent=0]
----
----
<plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>org.springframework</groupId>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<artifactId>springloaded</artifactId>
<version>1.2.0.RELEASE</version>
<version>1.2.0.RELEASE</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</plugin>
</plugin>
----
----
This normally works pretty well with Eclipse and IntelliJ as long as
This normally works pretty well with Eclipse and IntelliJ as long as they have their
they have their build configuration aligned with the Maven defaults
build configuration aligned with the Maven defaults (Eclipse m2e does this out of the
(Eclipse m2e does this out of the box).
box).
[[howto-reload-springloaded-gradle-and-intellij]]
[[howto-reload-springloaded-gradle-and-intellij]]
==== Configuring Spring Loaded for use with Gradle and IntelliJ
==== Configuring Spring Loaded for use with Gradle and IntelliJ
...
...
spring-boot-docs/src/main/asciidoc/spring-boot-cli.adoc
View file @
d17b7c81
...
@@ -94,26 +94,30 @@ Here is an example "`hello world`" web application written in Groovy:
...
@@ -94,26 +94,30 @@ Here is an example "`hello world`" web application written in Groovy:
}
}
----
----
T
hen
T
o compile and run the application type:
[indent=0,subs="verbatim,quotes,attributes"]
----
----
$ spring run hello.groovy
$ spring run hello.groovy
----
----
To pass command line arguments to the application, you need to use a
To pass command line arguments to the application, you need to use a
`--` to separate
"--" to separate them from the "spring
" command arguments, e.g.
them from the "`spring`
" command arguments, e.g.
[indent=0,subs="verbatim,quotes,attributes"]
----
----
$ spring run hello.groovy -- --server.port=9000
$ spring run hello.groovy -- --server.port=9000
----
----
and to set JVM command line arguments you can use the `JAVA_OPTS`
To set JVM command line arguments you can use the `JAVA_OPTS` environment variable, e.g.
environment variable, e.g.
[indent=0,subs="verbatim,quotes,attributes"]
----
----
$ JAVA_OPTS=-Xmx1024m spring run hello.groovy
$ JAVA_OPTS=-Xmx1024m spring run hello.groovy
----
----
[[cli-install-uninstall]]
[[cli-install-uninstall]]
=== Adding dependencies to the CLI
=== Adding dependencies to the CLI
You can add dependencies to the CLI using the `install` command. The command takes one
You can add dependencies to the CLI using the `install` command. The command takes one
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java
View file @
d17b7c81
...
@@ -138,8 +138,8 @@ public class SampleActuatorApplicationTests {
...
@@ -138,8 +138,8 @@ public class SampleActuatorApplicationTests {
@Test
@Test
public
void
testSecureHealth
()
throws
Exception
{
public
void
testSecureHealth
()
throws
Exception
{
ResponseEntity
<
String
>
entity
=
new
TestRestTemplate
(
"user"
,
getPassword
())
.
getForEntity
(
ResponseEntity
<
String
>
entity
=
new
TestRestTemplate
(
"user"
,
getPassword
())
"http://localhost:"
+
this
.
port
+
"/health"
,
String
.
class
);
.
getForEntity
(
"http://localhost:"
+
this
.
port
+
"/health"
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
assertTrue
(
"Wrong body: "
+
entity
.
getBody
(),
assertTrue
(
"Wrong body: "
+
entity
.
getBody
(),
entity
.
getBody
().
contains
(
"\"hello\":1"
));
entity
.
getBody
().
contains
(
"\"hello\":1"
));
...
...
spring-boot/src/main/java/org/springframework/boot/cloudfoundry/VcapApplicationListener.java
View file @
d17b7c81
...
@@ -70,7 +70,7 @@ import org.springframework.util.StringUtils;
...
@@ -70,7 +70,7 @@ import org.springframework.util.StringUtils;
* vcap.application.version: 0138c4a6-2a73-416b-aca0-572c09f7ca53
* vcap.application.version: 0138c4a6-2a73-416b-aca0-572c09f7ca53
* vcap.application.name: foo
* vcap.application.name: foo
* vcap.application.uris[0]: foo.cfapps.io
* vcap.application.uris[0]: foo.cfapps.io
*
*
* vcap.services.mysql.name: mysql
* vcap.services.mysql.name: mysql
* vcap.services.mysql.label: rds-mysql-1.0
* vcap.services.mysql.label: rds-mysql-1.0
* vcap.services.mysql.credentials.name: d04fb13d27d964c62b267bbba1cffb9da
* vcap.services.mysql.credentials.name: d04fb13d27d964c62b267bbba1cffb9da
...
@@ -112,13 +112,11 @@ public class VcapApplicationListener implements
...
@@ -112,13 +112,11 @@ public class VcapApplicationListener implements
@Override
@Override
public
void
onApplicationEvent
(
ApplicationEnvironmentPreparedEvent
event
)
{
public
void
onApplicationEvent
(
ApplicationEnvironmentPreparedEvent
event
)
{
ConfigurableEnvironment
environment
=
event
.
getEnvironment
();
ConfigurableEnvironment
environment
=
event
.
getEnvironment
();
if
(!
environment
.
containsProperty
(
VCAP_APPLICATION
)
if
(!
environment
.
containsProperty
(
VCAP_APPLICATION
)
&&
!
environment
.
containsProperty
(
VCAP_SERVICES
))
{
&&
!
environment
.
containsProperty
(
VCAP_SERVICES
))
{
return
;
return
;
}
}
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
addWithPrefix
(
properties
,
getPropertiesFromApplication
(
environment
),
addWithPrefix
(
properties
,
getPropertiesFromApplication
(
environment
),
"vcap.application."
);
"vcap.application."
);
...
@@ -130,12 +128,10 @@ public class VcapApplicationListener implements
...
@@ -130,12 +128,10 @@ public class VcapApplicationListener implements
propertySources
.
addAfter
(
propertySources
.
addAfter
(
CommandLinePropertySource
.
COMMAND_LINE_PROPERTY_SOURCE_NAME
,
CommandLinePropertySource
.
COMMAND_LINE_PROPERTY_SOURCE_NAME
,
new
PropertiesPropertySource
(
"vcap"
,
properties
));
new
PropertiesPropertySource
(
"vcap"
,
properties
));
}
}
else
{
else
{
propertySources
.
addFirst
(
new
PropertiesPropertySource
(
"vcap"
,
properties
));
propertySources
.
addFirst
(
new
PropertiesPropertySource
(
"vcap"
,
properties
));
}
}
}
}
private
void
addWithPrefix
(
Properties
properties
,
Properties
other
,
String
prefix
)
{
private
void
addWithPrefix
(
Properties
properties
,
Properties
other
,
String
prefix
)
{
...
...
spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java
View file @
d17b7c81
...
@@ -16,15 +16,6 @@
...
@@ -16,15 +16,6 @@
package
org
.
springframework
.
boot
.
builder
;
package
org
.
springframework
.
boot
.
builder
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
instanceOf
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLClassLoader
;
import
java.net.URLClassLoader
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -43,6 +34,15 @@ import org.springframework.core.io.DefaultResourceLoader;
...
@@ -43,6 +34,15 @@ import org.springframework.core.io.DefaultResourceLoader;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
instanceOf
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
verify
;
/**
/**
* Tests for {@link SpringApplicationBuilder}.
* Tests for {@link SpringApplicationBuilder}.
*
*
...
...
spring-boot/src/test/java/org/springframework/boot/cloudfoundry/VcapApplicationListenerTests.java
View file @
d17b7c81
...
@@ -16,9 +16,6 @@
...
@@ -16,9 +16,6 @@
package
org
.
springframework
.
boot
.
cloudfoundry
;
package
org
.
springframework
.
boot
.
cloudfoundry
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent
;
import
org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent
;
...
@@ -26,6 +23,9 @@ import org.springframework.boot.test.EnvironmentTestUtils;
...
@@ -26,6 +23,9 @@ import org.springframework.boot.test.EnvironmentTestUtils;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNull
;
/**
/**
* Tests for {@link VcapApplicationListener}.
* Tests for {@link VcapApplicationListener}.
*
*
...
...
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