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
0489a3b4
Commit
0489a3b4
authored
Dec 10, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
f3bcf94f
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
135 additions
and
121 deletions
+135
-121
ManagementWebSecurityAutoConfiguration.java
...autoconfigure/ManagementWebSecurityAutoConfiguration.java
+41
-31
SystemPublicMetrics.java
...gframework/boot/actuate/endpoint/SystemPublicMetrics.java
+34
-28
HalBrowserMvcEndpointBrowserPathIntegrationTests.java
...mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java
+1
-2
HalBrowserMvcEndpointManagementContextPathIntegrationTests.java
...wserMvcEndpointManagementContextPathIntegrationTests.java
+2
-2
HalBrowserMvcEndpointServerContextPathIntegrationTests.java
...lBrowserMvcEndpointServerContextPathIntegrationTests.java
+2
-2
HalBrowserMvcEndpointServerPortIntegrationTests.java
.../mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java
+2
-2
SpringBootCondition.java
...ork/boot/autoconfigure/condition/SpringBootCondition.java
+8
-6
CommonsDbcp2DataSourcePoolMetadata.java
...ure/jdbc/metadata/CommonsDbcp2DataSourcePoolMetadata.java
+0
-1
EmbeddedMongoAutoConfiguration.java
...figure/mongo/embedded/EmbeddedMongoAutoConfiguration.java
+6
-2
FlywayAutoConfigurationTests.java
...ot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
+2
-1
OAuth2AutoConfigurationTests.java
...nfigure/security/oauth2/OAuth2AutoConfigurationTests.java
+1
-2
ResourceServerTokenServicesConfigurationTests.java
...source/ResourceServerTokenServicesConfigurationTests.java
+1
-0
DefaultCommandFactory.java
...a/org/springframework/boot/cli/DefaultCommandFactory.java
+2
-2
SpringApplicationRunnerTests.java
...rk/boot/cli/command/run/SpringApplicationRunnerTests.java
+2
-1
RestartCompatibleRedisSerializerConfigurer.java
...configure/RestartCompatibleRedisSerializerConfigurer.java
+5
-10
DefaultSourceFolderUrlFilter.java
...devtools/restart/server/DefaultSourceFolderUrlFilter.java
+3
-4
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+1
-0
InsecureManagementPortAndPathSampleActuatorApplicationTests.java
...eManagementPortAndPathSampleActuatorApplicationTests.java
+1
-1
ManagementPortAndPathSampleActuatorApplicationTests.java
.../ManagementPortAndPathSampleActuatorApplicationTests.java
+1
-1
ApplicationHome.java
...c/main/java/org/springframework/boot/ApplicationHome.java
+3
-2
SpringApplication.java
...main/java/org/springframework/boot/SpringApplication.java
+0
-3
ConfigurableEmbeddedServletContainer.java
...ontext/embedded/ConfigurableEmbeddedServletContainer.java
+2
-2
SpringApplicationJsonEnvironmentPostProcessor.java
...ot/env/SpringApplicationJsonEnvironmentPostProcessor.java
+3
-4
AtomikosProperties.java
...springframework/boot/jta/atomikos/AtomikosProperties.java
+3
-3
SpringBootMockServletContext.java
...ringframework/boot/test/SpringBootMockServletContext.java
+2
-1
SpringApplicationIntegrationTestTests.java
...work/boot/test/SpringApplicationIntegrationTestTests.java
+2
-2
SpringApplicationMockMvcTests.java
...ingframework/boot/test/SpringApplicationMockMvcTests.java
+2
-3
SpringApplicationWebIntegrationTestTests.java
...k/boot/test/SpringApplicationWebIntegrationTestTests.java
+3
-3
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java
View file @
0489a3b4
...
@@ -150,39 +150,44 @@ public class ManagementWebSecurityAutoConfiguration {
...
@@ -150,39 +150,44 @@ public class ManagementWebSecurityAutoConfiguration {
@Override
@Override
public
void
init
(
WebSecurity
builder
)
throws
Exception
{
public
void
init
(
WebSecurity
builder
)
throws
Exception
{
if
(
this
.
server
!=
null
)
{
if
(
this
.
server
==
null
)
{
IgnoredRequestConfigurer
ignoring
=
builder
.
ignoring
();
return
;
// The ignores are not cumulative, so to prevent overwriting the defaults
}
// we add them back.
IgnoredRequestConfigurer
ignoring
=
builder
.
ignoring
();
Set
<
String
>
ignored
=
new
LinkedHashSet
<
String
>(
// The ignores are not cumulative, so to prevent overwriting the defaults
SpringBootWebSecurityConfiguration
.
getIgnored
(
this
.
security
));
// we add them back.
if
(
ignored
.
contains
(
"none"
))
{
Set
<
String
>
ignored
=
new
LinkedHashSet
<
String
>(
ignored
.
remove
(
"none"
);
SpringBootWebSecurityConfiguration
.
getIgnored
(
this
.
security
));
}
if
(
ignored
.
contains
(
"none"
))
{
if
(
this
.
errorController
!=
null
)
{
ignored
.
remove
(
"none"
);
ignored
.
add
(
normalizePath
(
this
.
errorController
.
getErrorPath
()));
}
}
if
(
this
.
errorController
!=
null
)
{
String
[]
paths
=
this
.
server
.
getPathsArray
(
ignored
);
ignored
.
add
(
normalizePath
(
this
.
errorController
.
getErrorPath
()));
RequestMatcher
requestMatcher
=
this
.
management
.
getSecurity
().
isEnabled
()
}
?
null
RequestMatcher
requestMatcher
=
getRequestMatcher
();
:
LazyEndpointPathRequestMatcher
String
[]
paths
=
this
.
server
.
getPathsArray
(
ignored
);
.
getRequestMatcher
(
this
.
contextResolver
);
if
(!
ObjectUtils
.
isEmpty
(
paths
))
{
if
(!
ObjectUtils
.
isEmpty
(
paths
))
{
List
<
RequestMatcher
>
matchers
=
new
ArrayList
<
RequestMatcher
>();
List
<
RequestMatcher
>
matchers
=
new
ArrayList
<
RequestMatcher
>();
for
(
String
pattern
:
paths
)
{
for
(
String
pattern
:
paths
)
{
matchers
.
add
(
new
AntPathRequestMatcher
(
pattern
,
null
));
matchers
.
add
(
new
AntPathRequestMatcher
(
pattern
,
null
));
}
if
(
requestMatcher
!=
null
)
{
matchers
.
add
(
requestMatcher
);
}
requestMatcher
=
new
OrRequestMatcher
(
matchers
);
}
}
if
(
requestMatcher
!=
null
)
{
if
(
requestMatcher
!=
null
)
{
ignoring
.
requestMatchers
(
requestMatcher
);
matchers
.
add
(
requestMatcher
);
}
}
requestMatcher
=
new
OrRequestMatcher
(
matchers
);
}
if
(
requestMatcher
!=
null
)
{
ignoring
.
requestMatchers
(
requestMatcher
);
}
}
}
}
private
RequestMatcher
getRequestMatcher
()
{
if
(
this
.
management
.
getSecurity
().
isEnabled
())
{
return
null
;
}
return
LazyEndpointPathRequestMatcher
.
getRequestMatcher
(
this
.
contextResolver
);
}
private
String
normalizePath
(
String
errorPath
)
{
private
String
normalizePath
(
String
errorPath
)
{
String
result
=
StringUtils
.
cleanPath
(
errorPath
);
String
result
=
StringUtils
.
cleanPath
(
errorPath
);
if
(!
result
.
startsWith
(
"/"
))
{
if
(!
result
.
startsWith
(
"/"
))
{
...
@@ -239,10 +244,7 @@ public class ManagementWebSecurityAutoConfiguration {
...
@@ -239,10 +244,7 @@ public class ManagementWebSecurityAutoConfiguration {
@Override
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
// secure endpoints
// secure endpoints
RequestMatcher
matcher
=
this
.
management
.
getSecurity
().
isEnabled
()
RequestMatcher
matcher
=
getRequestMatcher
();
?
LazyEndpointPathRequestMatcher
.
getRequestMatcher
(
this
.
contextResolver
)
:
null
;
if
(
matcher
!=
null
)
{
if
(
matcher
!=
null
)
{
// Always protect them if present
// Always protect them if present
if
(
this
.
security
.
isRequireSsl
())
{
if
(
this
.
security
.
isRequireSsl
())
{
...
@@ -264,6 +266,14 @@ public class ManagementWebSecurityAutoConfiguration {
...
@@ -264,6 +266,14 @@ public class ManagementWebSecurityAutoConfiguration {
}
}
}
}
private
RequestMatcher
getRequestMatcher
()
{
if
(
this
.
management
.
getSecurity
().
isEnabled
())
{
return
LazyEndpointPathRequestMatcher
.
getRequestMatcher
(
this
.
contextResolver
);
}
return
null
;
}
private
AuthenticationEntryPoint
entryPoint
()
{
private
AuthenticationEntryPoint
entryPoint
()
{
BasicAuthenticationEntryPoint
entryPoint
=
new
BasicAuthenticationEntryPoint
();
BasicAuthenticationEntryPoint
entryPoint
=
new
BasicAuthenticationEntryPoint
();
entryPoint
.
setRealmName
(
this
.
security
.
getBasic
().
getRealm
());
entryPoint
.
setRealmName
(
this
.
security
.
getBasic
().
getRealm
());
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java
View file @
0489a3b4
...
@@ -65,15 +65,24 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered {
...
@@ -65,15 +65,24 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered {
*/
*/
protected
void
addBasicMetrics
(
Collection
<
Metric
<?>>
result
)
{
protected
void
addBasicMetrics
(
Collection
<
Metric
<?>>
result
)
{
// NOTE: ManagementFactory must not be used here since it fails on GAE
// NOTE: ManagementFactory must not be used here since it fails on GAE
result
.
add
(
new
Metric
<
Long
>(
"mem"
,
Runtime
.
getRuntime
().
totalMemory
()
/
1024
)
);
Runtime
runtime
=
Runtime
.
getRuntime
(
);
result
.
add
(
result
.
add
(
newMemoryMetric
(
"mem"
,
new
Metric
<
Long
>(
"mem.free"
,
Runtime
.
getRuntime
().
freeMemory
()
/
1024
));
runtime
.
totalMemory
()
+
getTotalNonHeapMemoryIfPossible
()
));
result
.
add
(
new
Metric
<
Integer
>(
"processors"
,
result
.
add
(
new
MemoryMetric
(
"mem.free"
,
runtime
.
freeMemory
()));
Runtime
.
getRuntime
()
.
availableProcessors
()));
result
.
add
(
new
Metric
<
Integer
>(
"processors"
,
runtime
.
availableProcessors
()));
result
.
add
(
new
Metric
<
Long
>(
"instance.uptime"
,
result
.
add
(
new
Metric
<
Long
>(
"instance.uptime"
,
System
.
currentTimeMillis
()
-
this
.
timestamp
));
System
.
currentTimeMillis
()
-
this
.
timestamp
));
}
}
private
long
getTotalNonHeapMemoryIfPossible
()
{
try
{
return
ManagementFactory
.
getMemoryMXBean
().
getNonHeapMemoryUsage
().
getUsed
();
}
catch
(
Throwable
ex
)
{
return
0
;
}
}
/**
/**
* Add metrics from ManagementFactory if possible. Note that ManagementFactory is not
* Add metrics from ManagementFactory if possible. Note that ManagementFactory is not
* available on Google App Engine.
* available on Google App Engine.
...
@@ -87,6 +96,7 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered {
...
@@ -87,6 +96,7 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered {
result
.
add
(
new
Metric
<
Double
>(
"systemload.average"
,
result
.
add
(
new
Metric
<
Double
>(
"systemload.average"
,
ManagementFactory
.
getOperatingSystemMXBean
().
getSystemLoadAverage
()));
ManagementFactory
.
getOperatingSystemMXBean
().
getSystemLoadAverage
()));
addHeapMetrics
(
result
);
addHeapMetrics
(
result
);
addNonHeapMetrics
(
result
);
addThreadMetrics
(
result
);
addThreadMetrics
(
result
);
addClassLoadingMetrics
(
result
);
addClassLoadingMetrics
(
result
);
addGarbageCollectionMetrics
(
result
);
addGarbageCollectionMetrics
(
result
);
...
@@ -103,31 +113,27 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered {
...
@@ -103,31 +113,27 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered {
protected
void
addHeapMetrics
(
Collection
<
Metric
<?>>
result
)
{
protected
void
addHeapMetrics
(
Collection
<
Metric
<?>>
result
)
{
MemoryUsage
memoryUsage
=
ManagementFactory
.
getMemoryMXBean
()
MemoryUsage
memoryUsage
=
ManagementFactory
.
getMemoryMXBean
()
.
getHeapMemoryUsage
();
.
getHeapMemoryUsage
();
result
.
add
(
new
Metric
<
Long
>(
"heap.committed"
,
memoryUsage
.
getCommitted
()
/
1024
));
result
.
add
(
newMemoryMetric
(
"heap.committed"
,
memoryUsage
.
getCommitted
()));
result
.
add
(
new
Metric
<
Long
>(
"heap.init"
,
memoryUsage
.
getInit
()
/
1024
));
result
.
add
(
newMemoryMetric
(
"heap.init"
,
memoryUsage
.
getInit
()));
result
.
add
(
new
Metric
<
Long
>(
"heap.used"
,
memoryUsage
.
getUsed
()
/
1024
));
result
.
add
(
newMemoryMetric
(
"heap.used"
,
memoryUsage
.
getUsed
()));
result
.
add
(
new
Metric
<
Long
>(
"heap"
,
memoryUsage
.
getMax
()
/
1024
));
result
.
add
(
newMemoryMetric
(
"heap"
,
memoryUsage
.
getMax
()));
memoryUsage
=
ManagementFactory
.
getMemoryMXBean
().
getNonHeapMemoryUsage
();
result
.
add
(
new
Metric
<
Long
>(
"nonheap.committed"
,
memoryUsage
.
getCommitted
()
/
1024
));
result
.
add
(
new
Metric
<
Long
>(
"nonheap.init"
,
memoryUsage
.
getInit
()
/
1024
));
result
.
add
(
new
Metric
<
Long
>(
"nonheap.used"
,
memoryUsage
.
getUsed
()
/
1024
));
result
.
add
(
new
Metric
<
Long
>(
"nonheap"
,
memoryUsage
.
getMax
()
/
1024
));
Metric
<
Long
>
mem
=
findMemory
(
result
);
if
(
mem
!=
null
)
{
mem
.
increment
(
new
Long
(
memoryUsage
.
getUsed
()
/
1024
).
intValue
());
}
}
}
private
Metric
<
Long
>
findMemory
(
Collection
<
Metric
<?>>
result
)
{
/**
for
(
Metric
<?>
metric
:
result
)
{
* Add JVM non-heap metrics.
if
(
"mem"
.
equals
(
metric
.
getName
()))
{
* @param result the result
@SuppressWarnings
(
"unchecked"
)
*/
Metric
<
Long
>
value
=
(
Metric
<
Long
>)
metric
;
private
void
addNonHeapMetrics
(
Collection
<
Metric
<?>>
result
)
{
return
value
;
MemoryUsage
memoryUsage
=
ManagementFactory
.
getMemoryMXBean
()
}
.
getNonHeapMemoryUsage
();
}
result
.
add
(
newMemoryMetric
(
"nonheap.committed"
,
memoryUsage
.
getCommitted
()));
return
null
;
result
.
add
(
newMemoryMetric
(
"nonheap.init"
,
memoryUsage
.
getInit
()));
result
.
add
(
newMemoryMetric
(
"nonheap.used"
,
memoryUsage
.
getUsed
()));
result
.
add
(
newMemoryMetric
(
"nonheap"
,
memoryUsage
.
getMax
()));
}
private
Metric
<
Long
>
newMemoryMetric
(
String
name
,
long
bytes
)
{
return
new
Metric
<
Long
>(
name
,
bytes
/
1024
);
}
}
/**
/**
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java
View file @
0489a3b4
...
@@ -41,8 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
...
@@ -41,8 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
/**
/**
* Integration tests for {@link HalBrowserMvcEndpoint}'s support for producing
* Integration tests for {@link HalBrowserMvcEndpoint}'s support for producing text/html
* text/html
*
*
* @author Dave Syer
* @author Dave Syer
* @author Andy Wilkinson
* @author Andy Wilkinson
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointManagementContextPathIntegrationTests.java
View file @
0489a3b4
...
@@ -44,8 +44,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
...
@@ -44,8 +44,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
/**
/**
* Integration tests for {@link HalBrowserMvcEndpoint} when a custom management
* Integration tests for {@link HalBrowserMvcEndpoint} when a custom management
context
*
context
path has been configured.
* path has been configured.
*
*
* @author Dave Syer
* @author Dave Syer
* @author Andy Wilkinson
* @author Andy Wilkinson
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java
View file @
0489a3b4
...
@@ -45,8 +45,8 @@ import static org.junit.Assert.assertTrue;
...
@@ -45,8 +45,8 @@ import static org.junit.Assert.assertTrue;
import
static
org
.
springframework
.
hateoas
.
mvc
.
ControllerLinkBuilder
.
linkTo
;
import
static
org
.
springframework
.
hateoas
.
mvc
.
ControllerLinkBuilder
.
linkTo
;
/**
/**
* Integration tests for {@link HalBrowserMvcEndpoint} when a custom server context
* Integration tests for {@link HalBrowserMvcEndpoint} when a custom server context
path
*
path
has been configured.
* has been configured.
*
*
* @author Dave Syer
* @author Dave Syer
* @author Andy Wilkinson
* @author Andy Wilkinson
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java
View file @
0489a3b4
...
@@ -45,8 +45,8 @@ import static org.junit.Assert.assertTrue;
...
@@ -45,8 +45,8 @@ import static org.junit.Assert.assertTrue;
import
static
org
.
springframework
.
hateoas
.
mvc
.
ControllerLinkBuilder
.
linkTo
;
import
static
org
.
springframework
.
hateoas
.
mvc
.
ControllerLinkBuilder
.
linkTo
;
/**
/**
* Integration tests for {@link HalBrowserMvcEndpoint} when a custom server port has
* Integration tests for {@link HalBrowserMvcEndpoint} when a custom server port has
been
*
been
configured.
* configured.
*
*
* @author Dave Syer
* @author Dave Syer
* @author Andy Wilkinson
* @author Andy Wilkinson
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java
View file @
0489a3b4
...
@@ -50,12 +50,14 @@ public abstract class SpringBootCondition implements Condition {
...
@@ -50,12 +50,14 @@ public abstract class SpringBootCondition implements Condition {
return
outcome
.
isMatch
();
return
outcome
.
isMatch
();
}
}
catch
(
NoClassDefFoundError
ex
)
{
catch
(
NoClassDefFoundError
ex
)
{
throw
new
IllegalStateException
(
"Could not evaluate condition on "
throw
new
IllegalStateException
(
+
classOrMethodName
+
" due to "
+
ex
.
getMessage
()
+
" not "
"Could not evaluate condition on "
+
classOrMethodName
+
" due to "
+
"found. Make sure your own configuration does not rely on "
+
ex
.
getMessage
()
+
" not "
+
"that class. This can also happen if you are "
+
"found. Make sure your own configuration does not rely on "
+
"@ComponentScanning a springframework package (e.g. if you "
+
"that class. This can also happen if you are "
+
"put a @ComponentScan in the default package by mistake)"
,
ex
);
+
"@ComponentScanning a springframework package (e.g. if you "
+
"put a @ComponentScan in the default package by mistake)"
,
ex
);
}
}
catch
(
RuntimeException
ex
)
{
catch
(
RuntimeException
ex
)
{
throw
new
IllegalStateException
(
throw
new
IllegalStateException
(
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcp2DataSourcePoolMetadata.java
View file @
0489a3b4
...
@@ -54,4 +54,3 @@ public class CommonsDbcp2DataSourcePoolMetadata
...
@@ -54,4 +54,3 @@ public class CommonsDbcp2DataSourcePoolMetadata
}
}
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java
View file @
0489a3b4
...
@@ -78,6 +78,11 @@ import org.springframework.util.Assert;
...
@@ -78,6 +78,11 @@ import org.springframework.util.Assert;
@ConditionalOnClass
({
Mongo
.
class
,
MongodStarter
.
class
})
@ConditionalOnClass
({
Mongo
.
class
,
MongodStarter
.
class
})
public
class
EmbeddedMongoAutoConfiguration
{
public
class
EmbeddedMongoAutoConfiguration
{
private
static
final
byte
[]
IP4_LOOPBACK_ADDRESS
=
{
127
,
0
,
0
,
1
};
private
static
final
byte
[]
IP6_LOOPBACK_ADDRESS
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
};
@Autowired
@Autowired
private
MongoProperties
properties
;
private
MongoProperties
properties
;
...
@@ -158,8 +163,7 @@ public class EmbeddedMongoAutoConfiguration {
...
@@ -158,8 +163,7 @@ public class EmbeddedMongoAutoConfiguration {
private
InetAddress
getHost
()
throws
UnknownHostException
{
private
InetAddress
getHost
()
throws
UnknownHostException
{
if
(
this
.
properties
.
getHost
()
==
null
)
{
if
(
this
.
properties
.
getHost
()
==
null
)
{
return
InetAddress
.
getByAddress
(
Network
.
localhostIsIPv6
()
return
InetAddress
.
getByAddress
(
Network
.
localhostIsIPv6
()
?
new
byte
[]
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
}
?
IP6_LOOPBACK_ADDRESS
:
IP4_LOOPBACK_ADDRESS
);
:
new
byte
[]
{
127
,
0
,
0
,
1
});
}
}
return
InetAddress
.
getByName
(
this
.
properties
.
getHost
());
return
InetAddress
.
getByName
(
this
.
properties
.
getHost
());
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
View file @
0489a3b4
...
@@ -204,7 +204,8 @@ public class FlywayAutoConfigurationTests {
...
@@ -204,7 +204,8 @@ public class FlywayAutoConfigurationTests {
FlywayAutoConfiguration
.
class
,
FlywayAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
PropertyPlaceholderAutoConfiguration
.
class
);
Flyway
flyway
=
this
.
context
.
getBean
(
Flyway
.
class
);
Flyway
flyway
=
this
.
context
.
getBean
(
Flyway
.
class
);
assertThat
(
flyway
.
getBaselineVersion
(),
equalTo
(
MigrationVersion
.
fromVersion
(
"0"
)));
assertThat
(
flyway
.
getBaselineVersion
(),
equalTo
(
MigrationVersion
.
fromVersion
(
"0"
)));
}
}
private
void
registerAndRefresh
(
Class
<?>...
annotatedClasses
)
{
private
void
registerAndRefresh
(
Class
<?>...
annotatedClasses
)
{
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java
View file @
0489a3b4
...
@@ -146,8 +146,7 @@ public class OAuth2AutoConfigurationTests {
...
@@ -146,8 +146,7 @@ public class OAuth2AutoConfigurationTests {
"security.oauth2.client.clientSecret:mysecret"
,
"security.oauth2.client.clientSecret:mysecret"
,
"security.oauth2.client.autoApproveScopes:read,write"
,
"security.oauth2.client.autoApproveScopes:read,write"
,
"security.oauth2.client.accessTokenValiditySeconds:40"
,
"security.oauth2.client.accessTokenValiditySeconds:40"
,
"security.oauth2.client.refreshTokenValiditySeconds:80"
"security.oauth2.client.refreshTokenValiditySeconds:80"
);
);
this
.
context
.
register
(
AuthorizationAndResourceServerConfiguration
.
class
,
this
.
context
.
register
(
AuthorizationAndResourceServerConfiguration
.
class
,
MinimalSecureWebApplication
.
class
);
MinimalSecureWebApplication
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java
View file @
0489a3b4
...
@@ -277,6 +277,7 @@ public class ResourceServerTokenServicesConfigurationTests {
...
@@ -277,6 +277,7 @@ public class ResourceServerTokenServicesConfigurationTests {
ClientHttpRequestExecution
execution
)
throws
IOException
{
ClientHttpRequestExecution
execution
)
throws
IOException
{
return
execution
.
execute
(
request
,
body
);
return
execution
.
execute
(
request
,
body
);
}
}
});
});
}
}
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/DefaultCommandFactory.java
View file @
0489a3b4
...
@@ -41,8 +41,8 @@ public class DefaultCommandFactory implements CommandFactory {
...
@@ -41,8 +41,8 @@ public class DefaultCommandFactory implements CommandFactory {
private
static
final
List
<
Command
>
DEFAULT_COMMANDS
=
Arrays
.<
Command
>
asList
(
private
static
final
List
<
Command
>
DEFAULT_COMMANDS
=
Arrays
.<
Command
>
asList
(
new
VersionCommand
(),
new
RunCommand
(),
new
TestCommand
(),
new
GrabCommand
(),
new
VersionCommand
(),
new
RunCommand
(),
new
TestCommand
(),
new
GrabCommand
(),
new
JarCommand
(),
new
WarCommand
(),
new
InstallCommand
(),
new
UninstallCommand
(),
new
JarCommand
(),
new
WarCommand
(),
new
InstallCommand
(),
new
InitCommand
());
new
UninstallCommand
(),
new
InitCommand
());
@Override
@Override
public
Collection
<
Command
>
getCommands
()
{
public
Collection
<
Command
>
getCommands
()
{
...
...
spring-boot-cli/src/test/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerTests.java
View file @
0489a3b4
...
@@ -44,7 +44,8 @@ public class SpringApplicationRunnerTests {
...
@@ -44,7 +44,8 @@ public class SpringApplicationRunnerTests {
given
(
configuration
.
getLogLevel
()).
willReturn
(
Level
.
INFO
);
given
(
configuration
.
getLogLevel
()).
willReturn
(
Level
.
INFO
);
this
.
thrown
.
expect
(
RuntimeException
.
class
);
this
.
thrown
.
expect
(
RuntimeException
.
class
);
this
.
thrown
.
expectMessage
(
equalTo
(
"No classes found in '[foo, bar]'"
));
this
.
thrown
.
expectMessage
(
equalTo
(
"No classes found in '[foo, bar]'"
));
new
SpringApplicationRunner
(
configuration
,
new
String
[]
{
"foo"
,
"bar"
}).
compileAndRun
();
new
SpringApplicationRunner
(
configuration
,
new
String
[]
{
"foo"
,
"bar"
})
.
compileAndRun
();
}
}
}
}
spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RestartCompatibleRedisSerializerConfigurer.java
View file @
0489a3b4
...
@@ -35,7 +35,6 @@ import org.springframework.util.ObjectUtils;
...
@@ -35,7 +35,6 @@ import org.springframework.util.ObjectUtils;
*
*
* @author Andy Wilkinson
* @author Andy Wilkinson
* @author Rob Winch
* @author Rob Winch
*
* @see RedisTemplate#setHashKeySerializer(RedisSerializer)
* @see RedisTemplate#setHashKeySerializer(RedisSerializer)
* @see RedisTemplate#setHashValueSerializer(RedisSerializer)
* @see RedisTemplate#setHashValueSerializer(RedisSerializer)
* @see RedisTemplate#setKeySerializer(RedisSerializer)
* @see RedisTemplate#setKeySerializer(RedisSerializer)
...
@@ -69,6 +68,8 @@ class RestartCompatibleRedisSerializerConfigurer implements BeanClassLoaderAware
...
@@ -69,6 +68,8 @@ class RestartCompatibleRedisSerializerConfigurer implements BeanClassLoaderAware
static
class
RestartCompatibleRedisSerializer
implements
RedisSerializer
<
Object
>
{
static
class
RestartCompatibleRedisSerializer
implements
RedisSerializer
<
Object
>
{
private
static
final
byte
[]
NO_BYTES
=
new
byte
[
0
];
private
final
Converter
<
Object
,
byte
[]>
serializer
=
new
SerializingConverter
();
private
final
Converter
<
Object
,
byte
[]>
serializer
=
new
SerializingConverter
();
private
final
Converter
<
byte
[],
Object
>
deserializer
;
private
final
Converter
<
byte
[],
Object
>
deserializer
;
...
@@ -80,12 +81,9 @@ class RestartCompatibleRedisSerializerConfigurer implements BeanClassLoaderAware
...
@@ -80,12 +81,9 @@ class RestartCompatibleRedisSerializerConfigurer implements BeanClassLoaderAware
@Override
@Override
public
Object
deserialize
(
byte
[]
bytes
)
{
public
Object
deserialize
(
byte
[]
bytes
)
{
if
(
ObjectUtils
.
isEmpty
(
bytes
))
{
return
null
;
}
try
{
try
{
return
this
.
deserializer
.
convert
(
bytes
);
return
(
ObjectUtils
.
isEmpty
(
bytes
)
?
null
:
this
.
deserializer
.
convert
(
bytes
));
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
throw
new
SerializationException
(
"Cannot deserialize"
,
ex
);
throw
new
SerializationException
(
"Cannot deserialize"
,
ex
);
...
@@ -94,11 +92,8 @@ class RestartCompatibleRedisSerializerConfigurer implements BeanClassLoaderAware
...
@@ -94,11 +92,8 @@ class RestartCompatibleRedisSerializerConfigurer implements BeanClassLoaderAware
@Override
@Override
public
byte
[]
serialize
(
Object
object
)
{
public
byte
[]
serialize
(
Object
object
)
{
if
(
object
==
null
)
{
return
new
byte
[
0
];
}
try
{
try
{
return
this
.
serializer
.
convert
(
object
);
return
(
object
==
null
?
NO_BYTES
:
this
.
serializer
.
convert
(
object
)
);
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
throw
new
SerializationException
(
"Cannot serialize"
,
ex
);
throw
new
SerializationException
(
"Cannot serialize"
,
ex
);
...
...
spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilter.java
View file @
0489a3b4
...
@@ -41,10 +41,9 @@ public class DefaultSourceFolderUrlFilter implements SourceFolderUrlFilter {
...
@@ -41,10 +41,9 @@ public class DefaultSourceFolderUrlFilter implements SourceFolderUrlFilter {
private
static
final
Pattern
VERSION_PATTERN
=
Pattern
private
static
final
Pattern
VERSION_PATTERN
=
Pattern
.
compile
(
"^-\\d+(?:\\.\\d+)*(?:[.-].+)?$"
);
.
compile
(
"^-\\d+(?:\\.\\d+)*(?:[.-].+)?$"
);
private
static
final
Set
<
String
>
SKIPPED_PROJECTS
=
new
HashSet
<
String
>(
private
static
final
Set
<
String
>
SKIPPED_PROJECTS
=
new
HashSet
<
String
>(
Arrays
.
asList
(
Arrays
.
asList
(
"spring-boot"
,
"spring-boot-devtools"
,
"spring-boot"
,
"spring-boot-devtools"
,
"spring-boot-autoconfigure"
,
"spring-boot-autoconfigure"
,
"spring-boot-actuator"
,
"spring-boot-actuator"
,
"spring-boot-starter"
));
"spring-boot-starter"
));
@Override
@Override
public
boolean
isMatch
(
String
sourceFolder
,
URL
url
)
{
public
boolean
isMatch
(
String
sourceFolder
,
URL
url
)
{
...
...
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
0489a3b4
...
@@ -4026,6 +4026,7 @@ same semantic as the regular `@Order` annotation but provides a dedicated order
...
@@ -4026,6 +4026,7 @@ same semantic as the regular `@Order` annotation but provides a dedicated order
auto-configuration classes.
auto-configuration classes.
[[boot-features-condition-annotations]]
[[boot-features-condition-annotations]]
=== Condition annotations
=== Condition annotations
You almost always want to include one or more `@Conditional` annotations on your
You almost always want to include one or more `@Conditional` annotations on your
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java
View file @
0489a3b4
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
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.
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java
View file @
0489a3b4
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
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.
...
...
spring-boot/src/main/java/org/springframework/boot/ApplicationHome.java
View file @
0489a3b4
...
@@ -95,8 +95,9 @@ public class ApplicationHome {
...
@@ -95,8 +95,9 @@ public class ApplicationHome {
}
}
/**
/**
* Returns the underlying source used to find the home directory. This is usually the jar
* Returns the underlying source used to find the home directory. This is usually the
* file or a directory. Can return {@code null} if the source cannot be determined.
* jar file or a directory. Can return {@code null} if the source cannot be
* determined.
* @return the underlying source or {@code null}
* @return the underlying source or {@code null}
*/
*/
public
File
getSource
()
{
public
File
getSource
()
{
...
...
spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
View file @
0489a3b4
...
@@ -520,9 +520,7 @@ public class SpringApplication {
...
@@ -520,9 +520,7 @@ public class SpringApplication {
* @see #setBannerMode
* @see #setBannerMode
*/
*/
protected
void
printBanner
(
Environment
environment
)
{
protected
void
printBanner
(
Environment
environment
)
{
Banner
selectedBanner
=
selectBanner
(
environment
);
Banner
selectedBanner
=
selectBanner
(
environment
);
if
(
this
.
bannerMode
==
Banner
.
Mode
.
LOG
)
{
if
(
this
.
bannerMode
==
Banner
.
Mode
.
LOG
)
{
try
{
try
{
this
.
log
.
info
(
createStringFromBanner
(
selectedBanner
,
environment
));
this
.
log
.
info
(
createStringFromBanner
(
selectedBanner
,
environment
));
...
@@ -542,7 +540,6 @@ public class SpringApplication {
...
@@ -542,7 +540,6 @@ public class SpringApplication {
ResourceLoader
resourceLoader
=
this
.
resourceLoader
!=
null
?
this
.
resourceLoader
ResourceLoader
resourceLoader
=
this
.
resourceLoader
!=
null
?
this
.
resourceLoader
:
new
DefaultResourceLoader
(
getClassLoader
());
:
new
DefaultResourceLoader
(
getClassLoader
());
Resource
resource
=
resourceLoader
.
getResource
(
location
);
Resource
resource
=
resourceLoader
.
getResource
(
location
);
if
(
resource
.
exists
())
{
if
(
resource
.
exists
())
{
return
new
ResourceBanner
(
resource
);
return
new
ResourceBanner
(
resource
);
}
}
...
...
spring-boot/src/main/java/org/springframework/boot/context/embedded/ConfigurableEmbeddedServletContainer.java
View file @
0489a3b4
...
@@ -144,8 +144,8 @@ public interface ConfigurableEmbeddedServletContainer {
...
@@ -144,8 +144,8 @@ public interface ConfigurableEmbeddedServletContainer {
void
setMimeMappings
(
MimeMappings
mimeMappings
);
void
setMimeMappings
(
MimeMappings
mimeMappings
);
/**
/**
* Sets the document root directory which will be used by the web context to serve
static
* Sets the document root directory which will be used by the web context to serve
* files.
*
static
files.
* @param documentRoot the document root or {@code null} if not required
* @param documentRoot the document root or {@code null} if not required
*/
*/
void
setDocumentRoot
(
File
documentRoot
);
void
setDocumentRoot
(
File
documentRoot
);
...
...
spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java
View file @
0489a3b4
...
@@ -39,10 +39,9 @@ import org.springframework.web.context.support.StandardServletEnvironment;
...
@@ -39,10 +39,9 @@ import org.springframework.web.context.support.StandardServletEnvironment;
/**
/**
* An {@link EnvironmentPostProcessor} that parses JSON from
* An {@link EnvironmentPostProcessor} that parses JSON from
* {@code spring.application.json} or equivalently
* {@code spring.application.json} or equivalently {@code SPRING_APPLICATION_JSON} and
* {@code SPRING_APPLICATION_JSON} and adds it as a map property
* adds it as a map property source to the {@link Environment}. The new properties are
* source to the {@link Environment}. The new properties are added with higher priority
* added with higher priority than the system properties.
* than the system properties.
*
*
* @author Dave Syer
* @author Dave Syer
* @author Phillip Webb
* @author Phillip Webb
...
...
spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java
View file @
0489a3b4
...
@@ -106,9 +106,9 @@ public class AtomikosProperties {
...
@@ -106,9 +106,9 @@ public class AtomikosProperties {
/**
/**
* Specifies if subtransactions should be joined when possible. Defaults to true. When
* Specifies if subtransactions should be joined when possible. Defaults to true. When
* false, no attempt to call {@code XAResource.start(TM_JOIN)} will be made for
* false, no attempt to call {@code XAResource.start(TM_JOIN)} will be made for
* different but related subtransactions. This setting has no effect on resource
access
* different but related subtransactions. This setting has no effect on resource
*
within one and the same transaction. If you don't use subtransactions then this
*
access within one and the same transaction. If you don't use subtransactions then
* setting can be ignored.
*
this
setting can be ignored.
* @param serialJtaTransactions if serial JTA transaction are supported
* @param serialJtaTransactions if serial JTA transaction are supported
*/
*/
public
void
setSerialJtaTransactions
(
boolean
serialJtaTransactions
)
{
public
void
setSerialJtaTransactions
(
boolean
serialJtaTransactions
)
{
...
...
spring-boot/src/main/java/org/springframework/boot/test/SpringBootMockServletContext.java
View file @
0489a3b4
...
@@ -28,7 +28,8 @@ import org.springframework.mock.web.MockServletContext;
...
@@ -28,7 +28,8 @@ import org.springframework.mock.web.MockServletContext;
/**
/**
* {@link MockServletContext} implementation for Spring Boot. Respects well know Spring
* {@link MockServletContext} implementation for Spring Boot. Respects well know Spring
* Boot resource locations and uses an empty directory for "/" if no locations can be found.
* Boot resource locations and uses an empty directory for "/" if no locations can be
* found.
*
*
* @author Phillip Webb
* @author Phillip Webb
*/
*/
...
...
spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java
View file @
0489a3b4
...
@@ -82,8 +82,8 @@ public class SpringApplicationIntegrationTestTests {
...
@@ -82,8 +82,8 @@ public class SpringApplicationIntegrationTestTests {
@Test
@Test
public
void
validateWebApplicationContextIsSet
()
{
public
void
validateWebApplicationContextIsSet
()
{
assertSame
(
this
.
context
,
WebApplicationContextUtils
assertSame
(
this
.
context
,
.
getWebApplicationContext
(
this
.
servletContext
));
WebApplicationContextUtils
.
getWebApplicationContext
(
this
.
servletContext
));
}
}
@Configuration
@Configuration
...
...
spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationMockMvcTests.java
View file @
0489a3b4
...
@@ -71,11 +71,10 @@ public class SpringApplicationMockMvcTests {
...
@@ -71,11 +71,10 @@ public class SpringApplicationMockMvcTests {
@Test
@Test
public
void
validateWebApplicationContextIsSet
()
{
public
void
validateWebApplicationContextIsSet
()
{
assertSame
(
this
.
context
,
WebApplicationContextUtils
assertSame
(
this
.
context
,
.
getWebApplicationContext
(
this
.
servletContext
));
WebApplicationContextUtils
.
getWebApplicationContext
(
this
.
servletContext
));
}
}
@Configuration
@Configuration
@EnableWebMvc
@EnableWebMvc
@RestController
@RestController
...
...
spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java
View file @
0489a3b4
...
@@ -49,7 +49,7 @@ import static org.junit.Assert.assertSame;
...
@@ -49,7 +49,7 @@ import static org.junit.Assert.assertSame;
*/
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
Config
.
class
)
@SpringApplicationConfiguration
(
Config
.
class
)
@WebIntegrationTest
({
"server.port=0"
,
"value=123"
})
@WebIntegrationTest
({
"server.port=0"
,
"value=123"
})
public
class
SpringApplicationWebIntegrationTestTests
{
public
class
SpringApplicationWebIntegrationTestTests
{
@Value
(
"${local.server.port}"
)
@Value
(
"${local.server.port}"
)
...
@@ -80,8 +80,8 @@ public class SpringApplicationWebIntegrationTestTests {
...
@@ -80,8 +80,8 @@ public class SpringApplicationWebIntegrationTestTests {
@Test
@Test
public
void
validateWebApplicationContextIsSet
()
{
public
void
validateWebApplicationContextIsSet
()
{
assertSame
(
this
.
context
,
WebApplicationContextUtils
assertSame
(
this
.
context
,
.
getWebApplicationContext
(
this
.
servletContext
));
WebApplicationContextUtils
.
getWebApplicationContext
(
this
.
servletContext
));
}
}
@Configuration
@Configuration
...
...
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