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
266445aa
Commit
266445aa
authored
Jun 29, 2016
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
d41127d3
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
134 additions
and
104 deletions
+134
-104
TraceProperties.java
...g/springframework/boot/actuate/trace/TraceProperties.java
+2
-2
CassandraDataAutoConfiguration.java
...figure/data/cassandra/CassandraDataAutoConfiguration.java
+4
-3
DeviceDelegatingViewResolverAutoConfiguration.java
...mobile/DeviceDelegatingViewResolverAutoConfiguration.java
+2
-2
DeviceDelegatingViewResolverFactory.java
...configure/mobile/DeviceDelegatingViewResolverFactory.java
+8
-6
AuthorizationServerProperties.java
...rity/oauth2/authserver/AuthorizationServerProperties.java
+6
-6
WebMvcAutoConfiguration.java
...ework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
+1
-2
CassandraDataAutoConfigurationIntegrationTests.java
...andra/CassandraDataAutoConfigurationIntegrationTests.java
+2
-4
CassandraTestServer.java
...oot/autoconfigure/data/cassandra/CassandraTestServer.java
+2
-1
DeviceDelegatingViewResolverAutoConfigurationTests.java
...e/DeviceDelegatingViewResolverAutoConfigurationTests.java
+26
-15
MongoPropertiesTests.java
...mework/boot/autoconfigure/mongo/MongoPropertiesTests.java
+53
-45
WebMvcAutoConfigurationTests.java
.../boot/autoconfigure/web/WebMvcAutoConfigurationTests.java
+14
-12
ConfigurationMetadata.java
...onfigurationprocessor/metadata/ConfigurationMetadata.java
+13
-6
PropertiesConfigurationFactoryTests.java
...mework/boot/bind/PropertiesConfigurationFactoryTests.java
+1
-0
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/TraceProperties.java
View file @
266445aa
...
@@ -46,8 +46,8 @@ public class TraceProperties {
...
@@ -46,8 +46,8 @@ public class TraceProperties {
}
}
/**
/**
* Items to be included in the trace. Defaults to request/response headers (including
cookies)
* Items to be included in the trace. Defaults to request/response headers (including
* and errors.
*
cookies)
and errors.
*/
*/
private
Set
<
Include
>
include
=
new
HashSet
<
Include
>(
DEFAULT_INCLUDES
);
private
Set
<
Include
>
include
=
new
HashSet
<
Include
>(
DEFAULT_INCLUDES
);
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java
View file @
266445aa
...
@@ -73,7 +73,8 @@ public class CassandraDataAutoConfiguration {
...
@@ -73,7 +73,8 @@ public class CassandraDataAutoConfiguration {
this
.
beanFactory
=
beanFactory
;
this
.
beanFactory
=
beanFactory
;
this
.
properties
=
properties
;
this
.
properties
=
properties
;
this
.
cluster
=
cluster
;
this
.
cluster
=
cluster
;
this
.
propertyResolver
=
new
RelaxedPropertyResolver
(
environment
,
"spring.data.cassandra."
);
this
.
propertyResolver
=
new
RelaxedPropertyResolver
(
environment
,
"spring.data.cassandra."
);
}
}
@Bean
@Bean
...
@@ -105,8 +106,8 @@ public class CassandraDataAutoConfiguration {
...
@@ -105,8 +106,8 @@ public class CassandraDataAutoConfiguration {
session
.
setCluster
(
this
.
cluster
);
session
.
setCluster
(
this
.
cluster
);
session
.
setConverter
(
converter
);
session
.
setConverter
(
converter
);
session
.
setKeyspaceName
(
this
.
properties
.
getKeyspaceName
());
session
.
setKeyspaceName
(
this
.
properties
.
getKeyspaceName
());
SchemaAction
schemaAction
=
this
.
propertyResolver
SchemaAction
schemaAction
=
this
.
propertyResolver
.
getProperty
(
"schemaAction"
,
.
getProperty
(
"schemaAction"
,
SchemaAction
.
class
,
SchemaAction
.
NONE
);
SchemaAction
.
class
,
SchemaAction
.
NONE
);
session
.
setSchemaAction
(
schemaAction
);
session
.
setSchemaAction
(
schemaAction
);
return
session
;
return
session
;
}
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java
View file @
266445aa
...
@@ -53,9 +53,9 @@ import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver;
...
@@ -53,9 +53,9 @@ import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver;
@ConditionalOnClass
(
LiteDeviceDelegatingViewResolver
.
class
)
@ConditionalOnClass
(
LiteDeviceDelegatingViewResolver
.
class
)
@ConditionalOnProperty
(
prefix
=
"spring.mobile.devicedelegatingviewresolver"
,
name
=
"enabled"
,
havingValue
=
"true"
)
@ConditionalOnProperty
(
prefix
=
"spring.mobile.devicedelegatingviewresolver"
,
name
=
"enabled"
,
havingValue
=
"true"
)
@EnableConfigurationProperties
(
DeviceDelegatingViewResolverProperties
.
class
)
@EnableConfigurationProperties
(
DeviceDelegatingViewResolverProperties
.
class
)
@AutoConfigureAfter
({
WebMvcAutoConfiguration
.
class
,
FreeMarkerAutoConfiguration
.
class
,
@AutoConfigureAfter
({
WebMvcAutoConfiguration
.
class
,
FreeMarkerAutoConfiguration
.
class
,
GroovyTemplateAutoConfiguration
.
class
,
MustacheAutoConfiguration
.
class
,
GroovyTemplateAutoConfiguration
.
class
,
MustacheAutoConfiguration
.
class
,
ThymeleafAutoConfiguration
.
class
})
ThymeleafAutoConfiguration
.
class
})
public
class
DeviceDelegatingViewResolverAutoConfiguration
{
public
class
DeviceDelegatingViewResolverAutoConfiguration
{
@Configuration
@Configuration
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverFactory.java
View file @
266445aa
...
@@ -21,8 +21,8 @@ import org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver;
...
@@ -21,8 +21,8 @@ import org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver;
import
org.springframework.web.servlet.ViewResolver
;
import
org.springframework.web.servlet.ViewResolver
;
/**
/**
* A factory for {@link LiteDeviceDelegatingViewResolver} that applies customizations
* A factory for {@link LiteDeviceDelegatingViewResolver} that applies customizations
of
*
of
{@link DeviceDelegatingViewResolverProperties}.
* {@link DeviceDelegatingViewResolverProperties}.
*
*
* @author Stephane Nicoll
* @author Stephane Nicoll
* @since 1.4.0
* @since 1.4.0
...
@@ -31,7 +31,8 @@ public class DeviceDelegatingViewResolverFactory {
...
@@ -31,7 +31,8 @@ public class DeviceDelegatingViewResolverFactory {
private
final
DeviceDelegatingViewResolverProperties
properties
;
private
final
DeviceDelegatingViewResolverProperties
properties
;
public
DeviceDelegatingViewResolverFactory
(
DeviceDelegatingViewResolverProperties
properties
)
{
public
DeviceDelegatingViewResolverFactory
(
DeviceDelegatingViewResolverProperties
properties
)
{
this
.
properties
=
properties
;
this
.
properties
=
properties
;
}
}
...
@@ -42,8 +43,8 @@ public class DeviceDelegatingViewResolverFactory {
...
@@ -42,8 +43,8 @@ public class DeviceDelegatingViewResolverFactory {
* @param delegatingOrder the order of the {@link LiteDeviceDelegatingViewResolver}
* @param delegatingOrder the order of the {@link LiteDeviceDelegatingViewResolver}
* @return a {@link LiteDeviceDelegatingViewResolver} handling the specified resolver
* @return a {@link LiteDeviceDelegatingViewResolver} handling the specified resolver
*/
*/
public
LiteDeviceDelegatingViewResolver
createViewResolver
(
public
LiteDeviceDelegatingViewResolver
createViewResolver
(
ViewResolver
delegate
,
ViewResolver
delegate
,
int
delegatingOrder
)
{
int
delegatingOrder
)
{
LiteDeviceDelegatingViewResolver
resolver
=
new
LiteDeviceDelegatingViewResolver
(
LiteDeviceDelegatingViewResolver
resolver
=
new
LiteDeviceDelegatingViewResolver
(
delegate
);
delegate
);
resolver
.
setEnableFallback
(
this
.
properties
.
isEnableFallback
());
resolver
.
setEnableFallback
(
this
.
properties
.
isEnableFallback
());
...
@@ -67,7 +68,8 @@ public class DeviceDelegatingViewResolverFactory {
...
@@ -67,7 +68,8 @@ public class DeviceDelegatingViewResolverFactory {
*/
*/
public
LiteDeviceDelegatingViewResolver
createViewResolver
(
ViewResolver
delegate
)
{
public
LiteDeviceDelegatingViewResolver
createViewResolver
(
ViewResolver
delegate
)
{
if
(!(
delegate
instanceof
Ordered
))
{
if
(!(
delegate
instanceof
Ordered
))
{
throw
new
IllegalStateException
(
"ViewResolver "
+
delegate
+
"should implement "
+
Ordered
.
class
.
getName
());
throw
new
IllegalStateException
(
"ViewResolver "
+
delegate
+
"should implement "
+
Ordered
.
class
.
getName
());
}
}
int
delegateOrder
=
((
Ordered
)
delegate
).
getOrder
();
int
delegateOrder
=
((
Ordered
)
delegate
).
getOrder
();
return
createViewResolver
(
delegate
,
adjustOrder
(
delegateOrder
));
return
createViewResolver
(
delegate
,
adjustOrder
(
delegateOrder
));
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/authserver/AuthorizationServerProperties.java
View file @
266445aa
...
@@ -28,22 +28,22 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
...
@@ -28,22 +28,22 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
public
class
AuthorizationServerProperties
{
public
class
AuthorizationServerProperties
{
/**
/**
*
A
Spring Security access rule for the check token endpoint (e.g. a SpEL expression
* Spring Security access rule for the check token endpoint (e.g. a SpEL expression
* like "isAuthenticated()") . Default is empty, which is interpreted as "denyAll()"
* like "isAuthenticated()") . Default is empty, which is interpreted as "denyAll()"
* (no access).
* (no access).
*/
*/
private
String
checkTokenAccess
;
private
String
checkTokenAccess
;
/**
/**
*
A Spring Security access rule for the token key endpoint (e.g. a SpEL expression
*
Spring Security access rule for the token key endpoint (e.g. a SpEL expression like
*
like "isAuthenticated()"). Default is empty, which is interpreted as "denyAll()"
*
"isAuthenticated()"). Default is empty, which is interpreted as "denyAll()" (no
*
(no
access).
* access).
*/
*/
private
String
tokenKeyAccess
;
private
String
tokenKeyAccess
;
/**
/**
*
The realm name for client authentication. If an unauthenticated request comes in to
*
Realm name for client authentication. If an unauthenticated request comes in to the
* t
he t
oken endpoint, it will respond with a challenge including this name.
* token endpoint, it will respond with a challenge including this name.
*/
*/
private
String
realm
;
private
String
realm
;
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
View file @
266445aa
...
@@ -429,8 +429,7 @@ public class WebMvcAutoConfiguration {
...
@@ -429,8 +429,7 @@ public class WebMvcAutoConfiguration {
for
(
HandlerExceptionResolver
resolver
:
exceptionResolvers
)
{
for
(
HandlerExceptionResolver
resolver
:
exceptionResolvers
)
{
if
(
resolver
instanceof
AbstractHandlerExceptionResolver
)
{
if
(
resolver
instanceof
AbstractHandlerExceptionResolver
)
{
((
AbstractHandlerExceptionResolver
)
resolver
)
((
AbstractHandlerExceptionResolver
)
resolver
)
.
setWarnLogCategory
(
resolver
.
getClass
()
.
setWarnLogCategory
(
resolver
.
getClass
().
getName
());
.
getName
());
}
}
}
}
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationIntegrationTests.java
View file @
266445aa
...
@@ -71,14 +71,12 @@ public class CassandraDataAutoConfigurationIntegrationTests {
...
@@ -71,14 +71,12 @@ public class CassandraDataAutoConfigurationIntegrationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
=
new
AnnotationConfigApplicationContext
();
String
cityPackage
=
City
.
class
.
getPackage
().
getName
();
String
cityPackage
=
City
.
class
.
getPackage
().
getName
();
AutoConfigurationPackages
.
register
(
this
.
context
,
cityPackage
);
AutoConfigurationPackages
.
register
(
this
.
context
,
cityPackage
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"spring.data.cassandra.schemaAction:RECREATE_DROP_UNUSED"
,
"spring.data.cassandra.keyspaceName:boot_test"
);
"spring.data.cassandra.schemaAction:RECREATE_DROP_UNUSED"
,
"spring.data.cassandra.keyspaceName:boot_test"
);
this
.
context
.
register
(
CassandraAutoConfiguration
.
class
,
this
.
context
.
register
(
CassandraAutoConfiguration
.
class
,
CassandraDataAutoConfiguration
.
class
);
CassandraDataAutoConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
CassandraSessionFactoryBean
bean
=
this
.
context
CassandraSessionFactoryBean
bean
=
this
.
context
.
getBean
(
CassandraSessionFactoryBean
.
class
);
.
getBean
(
CassandraSessionFactoryBean
.
class
);
assertThat
(
bean
.
getSchemaAction
()).
isEqualTo
(
SchemaAction
.
RECREATE_DROP_UNUSED
);
assertThat
(
bean
.
getSchemaAction
()).
isEqualTo
(
SchemaAction
.
RECREATE_DROP_UNUSED
);
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraTestServer.java
View file @
266445aa
...
@@ -91,7 +91,8 @@ public class CassandraTestServer implements TestRule {
...
@@ -91,7 +91,8 @@ public class CassandraTestServer implements TestRule {
@Override
@Override
public
void
evaluate
()
throws
Throwable
{
public
void
evaluate
()
throws
Throwable
{
Assume
.
assumeTrue
(
"Skipping test due to Cassandra not being available"
,
false
);
Assume
.
assumeTrue
(
"Skipping test due to Cassandra not being available"
,
false
);
}
}
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfigurationTests.java
View file @
266445aa
...
@@ -79,7 +79,8 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
...
@@ -79,7 +79,8 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
@Test
@Test
public
void
deviceDelegatingJspResourceViewResolver
()
throws
Exception
{
public
void
deviceDelegatingJspResourceViewResolver
()
throws
Exception
{
load
(
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
load
(
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
)).
hasSize
(
1
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
))
.
hasSize
(
1
);
InternalResourceViewResolver
internalResourceViewResolver
=
this
.
context
InternalResourceViewResolver
internalResourceViewResolver
=
this
.
context
.
getBean
(
InternalResourceViewResolver
.
class
);
.
getBean
(
InternalResourceViewResolver
.
class
);
assertLiteDeviceDelegatingViewResolver
(
internalResourceViewResolver
,
assertLiteDeviceDelegatingViewResolver
(
internalResourceViewResolver
,
...
@@ -90,8 +91,10 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
...
@@ -90,8 +91,10 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
public
void
deviceDelegatingFreemarkerViewResolver
()
throws
Exception
{
public
void
deviceDelegatingFreemarkerViewResolver
()
throws
Exception
{
load
(
Collections
.<
Class
<?>>
singletonList
(
FreeMarkerAutoConfiguration
.
class
),
load
(
Collections
.<
Class
<?>>
singletonList
(
FreeMarkerAutoConfiguration
.
class
),
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
)).
hasSize
(
2
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
))
assertLiteDeviceDelegatingViewResolver
(
this
.
context
.
getBean
(
FreeMarkerViewResolver
.
class
),
.
hasSize
(
2
);
assertLiteDeviceDelegatingViewResolver
(
this
.
context
.
getBean
(
FreeMarkerViewResolver
.
class
),
"deviceDelegatingFreemarkerViewResolver"
);
"deviceDelegatingFreemarkerViewResolver"
);
}
}
...
@@ -99,8 +102,10 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
...
@@ -99,8 +102,10 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
public
void
deviceDelegatingGroovyMarkupViewResolver
()
throws
Exception
{
public
void
deviceDelegatingGroovyMarkupViewResolver
()
throws
Exception
{
load
(
Collections
.<
Class
<?>>
singletonList
(
GroovyTemplateAutoConfiguration
.
class
),
load
(
Collections
.<
Class
<?>>
singletonList
(
GroovyTemplateAutoConfiguration
.
class
),
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
)).
hasSize
(
2
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
))
assertLiteDeviceDelegatingViewResolver
(
this
.
context
.
getBean
(
GroovyMarkupViewResolver
.
class
),
.
hasSize
(
2
);
assertLiteDeviceDelegatingViewResolver
(
this
.
context
.
getBean
(
GroovyMarkupViewResolver
.
class
),
"deviceDelegatingGroovyMarkupViewResolver"
);
"deviceDelegatingGroovyMarkupViewResolver"
);
}
}
...
@@ -108,8 +113,10 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
...
@@ -108,8 +113,10 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
public
void
deviceDelegatingMustacheViewResolver
()
throws
Exception
{
public
void
deviceDelegatingMustacheViewResolver
()
throws
Exception
{
load
(
Collections
.<
Class
<?>>
singletonList
(
MustacheAutoConfiguration
.
class
),
load
(
Collections
.<
Class
<?>>
singletonList
(
MustacheAutoConfiguration
.
class
),
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
)).
hasSize
(
2
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
))
assertLiteDeviceDelegatingViewResolver
(
this
.
context
.
getBean
(
MustacheViewResolver
.
class
),
.
hasSize
(
2
);
assertLiteDeviceDelegatingViewResolver
(
this
.
context
.
getBean
(
MustacheViewResolver
.
class
),
"deviceDelegatingMustacheViewResolver"
);
"deviceDelegatingMustacheViewResolver"
);
}
}
...
@@ -117,26 +124,30 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
...
@@ -117,26 +124,30 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
public
void
deviceDelegatingThymeleafViewResolver
()
throws
Exception
{
public
void
deviceDelegatingThymeleafViewResolver
()
throws
Exception
{
load
(
Collections
.<
Class
<?>>
singletonList
(
ThymeleafAutoConfiguration
.
class
),
load
(
Collections
.<
Class
<?>>
singletonList
(
ThymeleafAutoConfiguration
.
class
),
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
"spring.mobile.devicedelegatingviewresolver.enabled:true"
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
)).
hasSize
(
2
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
))
assertLiteDeviceDelegatingViewResolver
(
this
.
context
.
getBean
(
ThymeleafViewResolver
.
class
),
.
hasSize
(
2
);
assertLiteDeviceDelegatingViewResolver
(
this
.
context
.
getBean
(
ThymeleafViewResolver
.
class
),
"deviceDelegatingThymeleafViewResolver"
);
"deviceDelegatingThymeleafViewResolver"
);
}
}
public
void
assertLiteDeviceDelegatingViewResolver
(
ViewResolver
delegate
,
String
delegatingBeanName
)
{
public
void
assertLiteDeviceDelegatingViewResolver
(
ViewResolver
delegate
,
String
delegatingBeanName
)
{
LiteDeviceDelegatingViewResolver
deviceDelegatingViewResolver
=
this
.
context
LiteDeviceDelegatingViewResolver
deviceDelegatingViewResolver
=
this
.
context
.
getBean
(
delegatingBeanName
,
LiteDeviceDelegatingViewResolver
.
class
);
.
getBean
(
delegatingBeanName
,
LiteDeviceDelegatingViewResolver
.
class
);
assertThat
(
deviceDelegatingViewResolver
.
getViewResolver
())
assertThat
(
deviceDelegatingViewResolver
.
getViewResolver
()).
isSameAs
(
delegate
);
.
isSameAs
(
delegate
);
assertThat
(
deviceDelegatingViewResolver
.
getOrder
())
assertThat
(
deviceDelegatingViewResolver
.
getOrder
())
.
isEqualTo
(((
Ordered
)
delegate
).
getOrder
()
-
1
);
.
isEqualTo
(((
Ordered
)
delegate
).
getOrder
()
-
1
);
}
}
@Test
@Test
public
void
deviceDelegatingViewResolverDisabled
()
throws
Exception
{
public
void
deviceDelegatingViewResolverDisabled
()
throws
Exception
{
load
(
Arrays
.
asList
(
FreeMarkerAutoConfiguration
.
class
,
GroovyTemplateAutoConfiguration
.
class
,
load
(
Arrays
.
asList
(
FreeMarkerAutoConfiguration
.
class
,
MustacheAutoConfiguration
.
class
,
ThymeleafAutoConfiguration
.
class
),
GroovyTemplateAutoConfiguration
.
class
,
MustacheAutoConfiguration
.
class
,
ThymeleafAutoConfiguration
.
class
),
"spring.mobile.devicedelegatingviewresolver.enabled:false"
);
"spring.mobile.devicedelegatingviewresolver.enabled:false"
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
)).
hasSize
(
0
);
assertThat
(
this
.
context
.
getBeansOfType
(
LiteDeviceDelegatingViewResolver
.
class
))
.
hasSize
(
0
);
}
}
@Test
@Test
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoPropertiesTests.java
View file @
266445aa
...
@@ -48,7 +48,7 @@ public class MongoPropertiesTests {
...
@@ -48,7 +48,7 @@ public class MongoPropertiesTests {
// gh-1572
// gh-1572
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
context
,
"spring.data.mongodb.password:word"
);
EnvironmentTestUtils
.
addEnvironment
(
context
,
"spring.data.mongodb.password:word"
);
context
.
register
(
Conf
.
class
);
context
.
register
(
Conf
ig
.
class
);
context
.
refresh
();
context
.
refresh
();
MongoProperties
properties
=
context
.
getBean
(
MongoProperties
.
class
);
MongoProperties
properties
=
context
.
getBean
(
MongoProperties
.
class
);
assertThat
(
properties
.
getPassword
()).
isEqualTo
(
"word"
.
toCharArray
());
assertThat
(
properties
.
getPassword
()).
isEqualTo
(
"word"
.
toCharArray
());
...
@@ -123,50 +123,58 @@ public class MongoPropertiesTests {
...
@@ -123,50 +123,58 @@ public class MongoPropertiesTests {
@Test
@Test
public
void
allMongoClientOptionsCanBeSet
()
throws
UnknownHostException
{
public
void
allMongoClientOptionsCanBeSet
()
throws
UnknownHostException
{
MongoClientOptions
mco
=
MongoClientOptions
.
builder
()
MongoClientOptions
.
Builder
builder
=
MongoClientOptions
.
builder
();
.
alwaysUseMBeans
(
true
)
builder
.
alwaysUseMBeans
(
true
);
.
connectionsPerHost
(
101
)
builder
.
connectionsPerHost
(
101
);
.
connectTimeout
(
10001
)
builder
.
connectTimeout
(
10001
);
.
cursorFinalizerEnabled
(
false
)
builder
.
cursorFinalizerEnabled
(
false
);
.
description
(
"test"
)
builder
.
description
(
"test"
);
.
maxWaitTime
(
120001
)
builder
.
maxWaitTime
(
120001
);
.
socketKeepAlive
(
true
)
builder
.
socketKeepAlive
(
true
);
.
socketTimeout
(
1000
)
builder
.
socketTimeout
(
1000
);
.
threadsAllowedToBlockForConnectionMultiplier
(
6
)
builder
.
threadsAllowedToBlockForConnectionMultiplier
(
6
);
.
minConnectionsPerHost
(
0
)
builder
.
minConnectionsPerHost
(
0
);
.
maxConnectionIdleTime
(
60000
)
builder
.
maxConnectionIdleTime
(
60000
);
.
maxConnectionLifeTime
(
60000
)
builder
.
maxConnectionLifeTime
(
60000
);
.
heartbeatFrequency
(
10001
)
builder
.
heartbeatFrequency
(
10001
);
.
minHeartbeatFrequency
(
501
)
builder
.
minHeartbeatFrequency
(
501
);
.
heartbeatConnectTimeout
(
20001
)
builder
.
heartbeatConnectTimeout
(
20001
);
.
heartbeatSocketTimeout
(
20001
)
builder
.
heartbeatSocketTimeout
(
20001
);
.
localThreshold
(
20
)
builder
.
localThreshold
(
20
);
.
requiredReplicaSetName
(
"testReplicaSetName"
)
builder
.
requiredReplicaSetName
(
"testReplicaSetName"
);
.
build
();
MongoClientOptions
options
=
builder
.
build
();
MongoProperties
properties
=
new
MongoProperties
();
MongoProperties
properties
=
new
MongoProperties
();
MongoClient
client
=
properties
.
createMongoClient
(
mco
,
null
);
MongoClient
client
=
properties
.
createMongoClient
(
options
,
null
);
MongoClientOptions
wrappedMco
=
client
.
getMongoClientOptions
();
MongoClientOptions
wrapped
=
client
.
getMongoClientOptions
();
assertThat
(
wrapped
.
isAlwaysUseMBeans
()).
isEqualTo
(
options
.
isAlwaysUseMBeans
());
assertThat
(
wrappedMco
.
isAlwaysUseMBeans
()).
isEqualTo
(
mco
.
isAlwaysUseMBeans
());
assertThat
(
wrapped
.
getConnectionsPerHost
())
assertThat
(
wrappedMco
.
getConnectionsPerHost
()).
isEqualTo
(
mco
.
getConnectionsPerHost
());
.
isEqualTo
(
options
.
getConnectionsPerHost
());
assertThat
(
wrappedMco
.
getConnectTimeout
()).
isEqualTo
(
mco
.
getConnectTimeout
());
assertThat
(
wrapped
.
getConnectTimeout
()).
isEqualTo
(
options
.
getConnectTimeout
());
assertThat
(
wrappedMco
.
isCursorFinalizerEnabled
()).
isEqualTo
(
mco
.
isCursorFinalizerEnabled
());
assertThat
(
wrapped
.
isCursorFinalizerEnabled
())
assertThat
(
wrappedMco
.
getDescription
()).
isEqualTo
(
mco
.
getDescription
());
.
isEqualTo
(
options
.
isCursorFinalizerEnabled
());
assertThat
(
wrappedMco
.
getMaxWaitTime
()).
isEqualTo
(
mco
.
getMaxWaitTime
());
assertThat
(
wrapped
.
getDescription
()).
isEqualTo
(
options
.
getDescription
());
assertThat
(
wrappedMco
.
getSocketTimeout
()).
isEqualTo
(
mco
.
getSocketTimeout
());
assertThat
(
wrapped
.
getMaxWaitTime
()).
isEqualTo
(
options
.
getMaxWaitTime
());
assertThat
(
wrappedMco
.
isSocketKeepAlive
()).
isEqualTo
(
mco
.
isSocketKeepAlive
());
assertThat
(
wrapped
.
getSocketTimeout
()).
isEqualTo
(
options
.
getSocketTimeout
());
assertThat
(
wrappedMco
.
getThreadsAllowedToBlockForConnectionMultiplier
()).
isEqualTo
(
assertThat
(
wrapped
.
isSocketKeepAlive
()).
isEqualTo
(
options
.
isSocketKeepAlive
());
mco
.
getThreadsAllowedToBlockForConnectionMultiplier
());
assertThat
(
wrapped
.
getThreadsAllowedToBlockForConnectionMultiplier
())
assertThat
(
wrappedMco
.
getMinConnectionsPerHost
()).
isEqualTo
(
mco
.
getMinConnectionsPerHost
());
.
isEqualTo
(
options
.
getThreadsAllowedToBlockForConnectionMultiplier
());
assertThat
(
wrappedMco
.
getMaxConnectionIdleTime
()).
isEqualTo
(
mco
.
getMaxConnectionIdleTime
());
assertThat
(
wrapped
.
getMinConnectionsPerHost
())
assertThat
(
wrappedMco
.
getMaxConnectionLifeTime
()).
isEqualTo
(
mco
.
getMaxConnectionLifeTime
());
.
isEqualTo
(
options
.
getMinConnectionsPerHost
());
assertThat
(
wrappedMco
.
getHeartbeatFrequency
()).
isEqualTo
(
mco
.
getHeartbeatFrequency
());
assertThat
(
wrapped
.
getMaxConnectionIdleTime
())
assertThat
(
wrappedMco
.
getMinHeartbeatFrequency
()).
isEqualTo
(
mco
.
getMinHeartbeatFrequency
());
.
isEqualTo
(
options
.
getMaxConnectionIdleTime
());
assertThat
(
wrappedMco
.
getHeartbeatConnectTimeout
()).
isEqualTo
(
mco
.
getHeartbeatConnectTimeout
());
assertThat
(
wrapped
.
getMaxConnectionLifeTime
())
assertThat
(
wrappedMco
.
getHeartbeatSocketTimeout
()).
isEqualTo
(
mco
.
getHeartbeatSocketTimeout
());
.
isEqualTo
(
options
.
getMaxConnectionLifeTime
());
assertThat
(
wrappedMco
.
getLocalThreshold
()).
isEqualTo
(
mco
.
getLocalThreshold
());
assertThat
(
wrapped
.
getHeartbeatFrequency
())
assertThat
(
wrappedMco
.
getRequiredReplicaSetName
()).
isEqualTo
(
mco
.
getRequiredReplicaSetName
());
.
isEqualTo
(
options
.
getHeartbeatFrequency
());
assertThat
(
wrapped
.
getMinHeartbeatFrequency
())
.
isEqualTo
(
options
.
getMinHeartbeatFrequency
());
assertThat
(
wrapped
.
getHeartbeatConnectTimeout
())
.
isEqualTo
(
options
.
getHeartbeatConnectTimeout
());
assertThat
(
wrapped
.
getHeartbeatSocketTimeout
())
.
isEqualTo
(
options
.
getHeartbeatSocketTimeout
());
assertThat
(
wrapped
.
getLocalThreshold
()).
isEqualTo
(
options
.
getLocalThreshold
());
assertThat
(
wrapped
.
getRequiredReplicaSetName
())
.
isEqualTo
(
options
.
getRequiredReplicaSetName
());
}
}
private
List
<
ServerAddress
>
extractServerAddresses
(
MongoClient
client
)
{
private
List
<
ServerAddress
>
extractServerAddresses
(
MongoClient
client
)
{
...
@@ -192,7 +200,7 @@ public class MongoPropertiesTests {
...
@@ -192,7 +200,7 @@ public class MongoPropertiesTests {
@Configuration
@Configuration
@EnableConfigurationProperties
(
MongoProperties
.
class
)
@EnableConfigurationProperties
(
MongoProperties
.
class
)
static
class
Conf
{
static
class
Conf
ig
{
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java
View file @
266445aa
...
@@ -541,20 +541,22 @@ public class WebMvcAutoConfigurationTests {
...
@@ -541,20 +541,22 @@ public class WebMvcAutoConfigurationTests {
}
}
private
void
testLogResolvedExceptionCustomization
(
final
boolean
expected
)
{
private
void
testLogResolvedExceptionCustomization
(
final
boolean
expected
)
{
HandlerExceptionResolver
exceptionResolver
=
this
.
context
.
getBean
(
HandlerExceptionResolver
exceptionResolver
=
this
.
context
HandlerExceptionResolver
.
class
);
.
getBean
(
HandlerExceptionResolver
.
class
);
assertThat
(
exceptionResolver
).
isInstanceOf
(
HandlerExceptionResolverComposite
.
class
);
assertThat
(
exceptionResolver
)
List
<
HandlerExceptionResolver
>
delegates
=
.
isInstanceOf
(
HandlerExceptionResolverComposite
.
class
);
((
HandlerExceptionResolverComposite
)
exceptionResolver
).
getExceptionResolvers
();
List
<
HandlerExceptionResolver
>
delegates
=
((
HandlerExceptionResolverComposite
)
exceptionResolver
)
.
getExceptionResolvers
();
for
(
HandlerExceptionResolver
delegate
:
delegates
)
{
for
(
HandlerExceptionResolver
delegate
:
delegates
)
{
if
(
delegate
instanceof
AbstractHandlerMethodAdapter
)
{
if
(
delegate
instanceof
AbstractHandlerMethodAdapter
)
{
assertThat
(
new
DirectFieldAccessor
(
delegate
).
getPropertyValue
(
"warnLogger"
))
assertThat
(
.
is
(
new
Condition
<
Object
>()
{
new
DirectFieldAccessor
(
delegate
).
getPropertyValue
(
"warnLogger"
))
@Override
.
is
(
new
Condition
<
Object
>()
{
public
boolean
matches
(
Object
value
)
{
@Override
return
(
expected
?
value
!=
null
:
value
==
null
);
public
boolean
matches
(
Object
value
)
{
}
return
(
expected
?
value
!=
null
:
value
==
null
);
});
}
});
}
}
}
}
}
}
...
...
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java
View file @
266445aa
...
@@ -19,8 +19,10 @@ package org.springframework.boot.configurationprocessor.metadata;
...
@@ -19,8 +19,10 @@ package org.springframework.boot.configurationprocessor.metadata;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.ListIterator
;
import
java.util.ListIterator
;
import
java.util.Set
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.LinkedMultiValueMap
;
...
@@ -37,7 +39,12 @@ import org.springframework.util.ObjectUtils;
...
@@ -37,7 +39,12 @@ import org.springframework.util.ObjectUtils;
*/
*/
public
class
ConfigurationMetadata
{
public
class
ConfigurationMetadata
{
private
static
final
List
<
Character
>
SEPARATORS
=
Arrays
.
asList
(
'-'
,
'_'
);
private
static
final
Set
<
Character
>
SEPARATORS
;
static
{
List
<
Character
>
chars
=
Arrays
.
asList
(
'-'
,
'_'
);
SEPARATORS
=
Collections
.
unmodifiableSet
(
new
HashSet
<
Character
>(
chars
));
}
private
final
MultiValueMap
<
String
,
ItemMetadata
>
items
;
private
final
MultiValueMap
<
String
,
ItemMetadata
>
items
;
...
@@ -159,23 +166,23 @@ public class ConfigurationMetadata {
...
@@ -159,23 +166,23 @@ public class ConfigurationMetadata {
}
}
static
String
toDashedCase
(
String
name
)
{
static
String
toDashedCase
(
String
name
)
{
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
dashed
=
new
StringBuilder
();
Character
previous
=
null
;
Character
previous
=
null
;
for
(
char
current
:
name
.
toCharArray
())
{
for
(
char
current
:
name
.
toCharArray
())
{
if
(
SEPARATORS
.
contains
(
current
))
{
if
(
SEPARATORS
.
contains
(
current
))
{
sb
.
append
(
"-"
);
dashed
.
append
(
"-"
);
}
}
else
if
(
Character
.
isUpperCase
(
current
)
&&
previous
!=
null
else
if
(
Character
.
isUpperCase
(
current
)
&&
previous
!=
null
&&
!
SEPARATORS
.
contains
(
previous
))
{
&&
!
SEPARATORS
.
contains
(
previous
))
{
sb
.
append
(
"-"
).
append
(
current
);
dashed
.
append
(
"-"
).
append
(
current
);
}
}
else
{
else
{
sb
.
append
(
current
);
dashed
.
append
(
current
);
}
}
previous
=
current
;
previous
=
current
;
}
}
return
sb
.
toString
().
toLowerCase
();
return
dashed
.
toString
().
toLowerCase
();
}
}
private
static
<
T
extends
Comparable
<
T
>>
List
<
T
>
flattenValues
(
private
static
<
T
extends
Comparable
<
T
>>
List
<
T
>
flattenValues
(
...
...
spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java
View file @
266445aa
...
@@ -259,6 +259,7 @@ public class PropertiesConfigurationFactoryTests {
...
@@ -259,6 +259,7 @@ public class PropertiesConfigurationFactoryTests {
public
void
setFooDLQBar
(
String
fooDLQBar
)
{
public
void
setFooDLQBar
(
String
fooDLQBar
)
{
this
.
fooDLQBar
=
fooDLQBar
;
this
.
fooDLQBar
=
fooDLQBar
;
}
}
}
}
}
}
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