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
3893383c
Commit
3893383c
authored
Jan 24, 2017
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
d1727f25
5703fb15
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
81 additions
and
76 deletions
+81
-76
EndpointDocumentation.java
...mework/boot/actuate/hypermedia/EndpointDocumentation.java
+1
-1
HealthEndpointDocumentation.java
.../boot/actuate/hypermedia/HealthEndpointDocumentation.java
+1
-1
HypermediaEndpointDocumentation.java
...t/actuate/hypermedia/HypermediaEndpointDocumentation.java
+1
-1
EndpointWebMvcHypermediaManagementContextConfiguration.java
...dpointWebMvcHypermediaManagementContextConfiguration.java
+13
-9
ActuatorGetMapping.java
...amework/boot/actuate/endpoint/mvc/ActuatorGetMapping.java
+0
-1
ActuatorMediaTypes.java
...amework/boot/actuate/endpoint/mvc/ActuatorMediaTypes.java
+1
-0
ActuatorPostMapping.java
...mework/boot/actuate/endpoint/mvc/ActuatorPostMapping.java
+0
-1
HealthMvcEndpoint.java
...ramework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java
+1
-1
EnvironmentMvcEndpointTests.java
...oot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java
+1
-1
HypermediaHttpMessageConverterConfiguration.java
.../hateoas/HypermediaHttpMessageConverterConfiguration.java
+25
-22
ServerPropertiesTests.java
...amework/boot/autoconfigure/web/ServerPropertiesTests.java
+1
-1
CustomerRepository.java
...b/src/main/java/sample/data/mongo/CustomerRepository.java
+1
-1
AutoConfigureDataMongo.java
...test/autoconfigure/data/mongo/AutoConfigureDataMongo.java
+2
-1
DataMongoTest.java
...ork/boot/test/autoconfigure/data/mongo/DataMongoTest.java
+10
-12
DataMongoTypeExcludeFilter.java
.../autoconfigure/data/mongo/DataMongoTypeExcludeFilter.java
+8
-8
DataMongoTestIntegrationTests.java
...toconfigure/data/mongo/DataMongoTestIntegrationTests.java
+2
-4
DataMongoTestWithIncludeFilterIntegrationTests.java
...mongo/DataMongoTestWithIncludeFilterIntegrationTests.java
+2
-2
ExampleDocument.java
...k/boot/test/autoconfigure/data/mongo/ExampleDocument.java
+2
-2
ExampleMongoApplication.java
...est/autoconfigure/data/mongo/ExampleMongoApplication.java
+2
-2
ExampleRepository.java
...boot/test/autoconfigure/data/mongo/ExampleRepository.java
+3
-2
ExampleService.java
...rk/boot/test/autoconfigure/data/mongo/ExampleService.java
+2
-1
ConfigFileApplicationListener.java
...rk/boot/context/config/ConfigFileApplicationListener.java
+1
-1
ConfigFileApplicationListenerTests.java
...ot/context/config/ConfigFileApplicationListenerTests.java
+1
-1
No files found.
spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HealthEndpointDocumentation.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HypermediaEndpointDocumentation.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
@@ -240,18 +240,22 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
...
@@ -240,18 +240,22 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
for
(
RequestMappingHandlerAdapter
handlerAdapter
:
this
.
handlerAdapters
)
{
for
(
RequestMappingHandlerAdapter
handlerAdapter
:
this
.
handlerAdapters
)
{
for
(
HttpMessageConverter
<?>
messageConverter
:
handlerAdapter
for
(
HttpMessageConverter
<?>
messageConverter
:
handlerAdapter
.
getMessageConverters
())
{
.
getMessageConverters
())
{
if
(
messageConverter
instanceof
TypeConstrainedMappingJackson2HttpMessageConverter
)
{
configureHttpMessageConverter
(
messageConverter
);
List
<
MediaType
>
supportedMediaTypes
=
new
ArrayList
<
MediaType
>(
messageConverter
.
getSupportedMediaTypes
());
supportedMediaTypes
.
add
(
ActuatorMediaTypes
.
APPLICATION_ACTUATOR_V1_JSON
);
((
AbstractHttpMessageConverter
<?>)
messageConverter
)
.
setSupportedMediaTypes
(
supportedMediaTypes
);
}
}
}
}
}
}
}
private
void
configureHttpMessageConverter
(
HttpMessageConverter
<?>
messageConverter
)
{
if
(
messageConverter
instanceof
TypeConstrainedMappingJackson2HttpMessageConverter
)
{
List
<
MediaType
>
supportedMediaTypes
=
new
ArrayList
<
MediaType
>(
messageConverter
.
getSupportedMediaTypes
());
supportedMediaTypes
.
add
(
ActuatorMediaTypes
.
APPLICATION_ACTUATOR_V1_JSON
);
((
AbstractHttpMessageConverter
<?>)
messageConverter
)
.
setSupportedMediaTypes
(
supportedMediaTypes
);
}
}
@Override
@Override
public
boolean
supports
(
MethodParameter
returnType
,
public
boolean
supports
(
MethodParameter
returnType
,
Class
<?
extends
HttpMessageConverter
<?>>
converterType
)
{
Class
<?
extends
HttpMessageConverter
<?>>
converterType
)
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorGetMapping.java
View file @
3893383c
...
@@ -44,7 +44,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
...
@@ -44,7 +44,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
/**
/**
* Alias for {@link RequestMapping#value}.
* Alias for {@link RequestMapping#value}.
*
* @return the value
* @return the value
*/
*/
@AliasFor
(
annotation
=
RequestMapping
.
class
)
@AliasFor
(
annotation
=
RequestMapping
.
class
)
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorMediaTypes.java
View file @
3893383c
...
@@ -22,6 +22,7 @@ import org.springframework.http.MediaType;
...
@@ -22,6 +22,7 @@ import org.springframework.http.MediaType;
* {@link MediaType MediaTypes} that can be consumed and produced by Actuator endpoints.
* {@link MediaType MediaTypes} that can be consumed and produced by Actuator endpoints.
*
*
* @author Andy Wilkinson
* @author Andy Wilkinson
* @since 1.5.0
*/
*/
public
final
class
ActuatorMediaTypes
{
public
final
class
ActuatorMediaTypes
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorPostMapping.java
View file @
3893383c
...
@@ -48,7 +48,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
...
@@ -48,7 +48,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
/**
/**
* Alias for {@link RequestMapping#value}.
* Alias for {@link RequestMapping#value}.
*
* @return the value
* @return the value
*/
*/
@AliasFor
(
annotation
=
RequestMapping
.
class
)
@AliasFor
(
annotation
=
RequestMapping
.
class
)
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaHttpMessageConverterConfiguration.java
View file @
3893383c
/*
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
7
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.
...
@@ -17,9 +17,8 @@
...
@@ -17,9 +17,8 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
hateoas
;
package
org
.
springframework
.
boot
.
autoconfigure
.
hateoas
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
...
@@ -63,28 +62,32 @@ public class HypermediaHttpMessageConverterConfiguration {
...
@@ -63,28 +62,32 @@ public class HypermediaHttpMessageConverterConfiguration {
private
volatile
BeanFactory
beanFactory
;
private
volatile
BeanFactory
beanFactory
;
@PostConstruct
@PostConstruct
public
void
c
ustomizedSupportedMediaType
s
()
{
public
void
c
onfigureHttpMessageConverter
s
()
{
if
(
this
.
beanFactory
instanceof
ListableBeanFactory
)
{
if
(
this
.
beanFactory
instanceof
ListableBeanFactory
)
{
Map
<
String
,
RequestMappingHandlerAdapter
>
handlerAdapters
=
((
ListableBeanFactory
)
this
.
beanFactory
)
configureHttpMessageConverters
(((
ListableBeanFactory
)
this
.
beanFactory
)
.
getBeansOfType
(
RequestMappingHandlerAdapter
.
class
);
.
getBeansOfType
(
RequestMappingHandlerAdapter
.
class
).
values
());
for
(
Entry
<
String
,
RequestMappingHandlerAdapter
>
entry
:
handlerAdapters
}
.
entrySet
())
{
}
RequestMappingHandlerAdapter
handlerAdapter
=
entry
.
getValue
();
for
(
HttpMessageConverter
<?>
converter
:
handlerAdapter
private
void
configureHttpMessageConverters
(
.
getMessageConverters
())
{
Collection
<
RequestMappingHandlerAdapter
>
handlerAdapters
)
{
if
(
converter
instanceof
TypeConstrainedMappingJackson2HttpMessageConverter
)
{
for
(
RequestMappingHandlerAdapter
handlerAdapter
:
handlerAdapters
)
{
List
<
MediaType
>
supportedMediaTypes
=
new
ArrayList
<
MediaType
>(
for
(
HttpMessageConverter
<?>
messageConverter
:
handlerAdapter
converter
.
getSupportedMediaTypes
());
.
getMessageConverters
())
{
if
(!
supportedMediaTypes
configureHttpMessageConverter
(
messageConverter
);
.
contains
(
MediaType
.
APPLICATION_JSON
))
{
}
supportedMediaTypes
.
add
(
MediaType
.
APPLICATION_JSON
);
}
}
}
((
AbstractHttpMessageConverter
<?>)
converter
)
.
setSupportedMediaTypes
(
supportedMediaTypes
);
}
}
private
void
configureHttpMessageConverter
(
HttpMessageConverter
<?>
converter
)
{
if
(
converter
instanceof
TypeConstrainedMappingJackson2HttpMessageConverter
)
{
List
<
MediaType
>
supportedMediaTypes
=
new
ArrayList
<
MediaType
>(
converter
.
getSupportedMediaTypes
());
if
(!
supportedMediaTypes
.
contains
(
MediaType
.
APPLICATION_JSON
))
{
supportedMediaTypes
.
add
(
MediaType
.
APPLICATION_JSON
);
}
}
((
AbstractHttpMessageConverter
<?>)
converter
)
.
setSupportedMediaTypes
(
supportedMediaTypes
);
}
}
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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-data-mongodb/src/main/java/sample/data/mongo/CustomerRepository.java
View file @
3893383c
/*
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
7
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-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/mongo/AutoConfigureDataMongo.java
View file @
3893383c
...
@@ -30,7 +30,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
...
@@ -30,7 +30,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
* tests. Most tests should consider using {@link DataMongoTest @DataMongoTest} rather
* tests. Most tests should consider using {@link DataMongoTest @DataMongoTest} rather
* than using this annotation directly.
* than using this annotation directly.
*
*
* @author Michael
J.
Simons
* @author Michael Simons
* @since 1.5.0
* @since 1.5.0
* @see DataMongoTest
* @see DataMongoTest
*/
*/
...
@@ -40,4 +40,5 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
...
@@ -40,4 +40,5 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
@Inherited
@Inherited
@ImportAutoConfiguration
@ImportAutoConfiguration
public
@interface
AutoConfigureDataMongo
{
public
@interface
AutoConfigureDataMongo
{
}
}
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/mongo/DataMongoTest.java
View file @
3893383c
...
@@ -35,8 +35,8 @@ import org.springframework.test.context.BootstrapWith;
...
@@ -35,8 +35,8 @@ import org.springframework.test.context.BootstrapWith;
/**
/**
* Annotation that can be used in combination with {@code @RunWith(SpringRunner.class)}
* Annotation that can be used in combination with {@code @RunWith(SpringRunner.class)}
* for a typical MongoDB test. Can be used when a test focuses
* for a typical MongoDB test. Can be used when a test focuses
<strong>only</strong> on
*
<strong>only</strong> on
MongoDB components.
* MongoDB components.
* <p>
* <p>
* Using this annotation will disable full auto-configuration and instead apply only
* Using this annotation will disable full auto-configuration and instead apply only
* configuration relevant to MongoDB tests.
* configuration relevant to MongoDB tests.
...
@@ -44,7 +44,7 @@ import org.springframework.test.context.BootstrapWith;
...
@@ -44,7 +44,7 @@ import org.springframework.test.context.BootstrapWith;
* By default, tests annotated with {@code @DataMongoTest} will use an embedded in-memory
* By default, tests annotated with {@code @DataMongoTest} will use an embedded in-memory
* MongoDB process (if available).
* MongoDB process (if available).
*
*
* @author Michael
J.
Simons
* @author Michael Simons
* @author Stephane Nicoll
* @author Stephane Nicoll
* @since 1.5.0
* @since 1.5.0
*/
*/
...
@@ -62,9 +62,8 @@ public @interface DataMongoTest {
...
@@ -62,9 +62,8 @@ public @interface DataMongoTest {
/**
/**
* Determines if default filtering should be used with
* Determines if default filtering should be used with
* {@link SpringBootApplication @SpringBootApplication}. By default no beans
* {@link SpringBootApplication @SpringBootApplication}. By default no beans are
* are included.
* included.
*
* @see #includeFilters()
* @see #includeFilters()
* @see #excludeFilters()
* @see #excludeFilters()
* @return if default filters should be used
* @return if default filters should be used
...
@@ -72,17 +71,15 @@ public @interface DataMongoTest {
...
@@ -72,17 +71,15 @@ public @interface DataMongoTest {
boolean
useDefaultFilters
()
default
true
;
boolean
useDefaultFilters
()
default
true
;
/**
/**
* A set of include filters which can be used to add otherwise filtered
* A set of include filters which can be used to add otherwise filtered beans to the
* beans to the application context.
* application context.
*
* @return include filters to apply
* @return include filters to apply
*/
*/
Filter
[]
includeFilters
()
default
{};
Filter
[]
includeFilters
()
default
{};
/**
/**
* A set of exclude filters which can be used to filter beans that would
* A set of exclude filters which can be used to filter beans that would otherwise be
* otherwise be added to the application context.
* added to the application context.
*
* @return exclude filters to apply
* @return exclude filters to apply
*/
*/
Filter
[]
excludeFilters
()
default
{};
Filter
[]
excludeFilters
()
default
{};
...
@@ -93,4 +90,5 @@ public @interface DataMongoTest {
...
@@ -93,4 +90,5 @@ public @interface DataMongoTest {
*/
*/
@AliasFor
(
annotation
=
ImportAutoConfiguration
.
class
,
attribute
=
"exclude"
)
@AliasFor
(
annotation
=
ImportAutoConfiguration
.
class
,
attribute
=
"exclude"
)
Class
<?>[]
excludeAutoConfiguration
()
default
{};
Class
<?>[]
excludeAutoConfiguration
()
default
{};
}
}
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/mongo/DataMongoTypeExcludeFilter.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
@@ -30,7 +30,7 @@ import org.springframework.core.type.classreading.MetadataReaderFactory;
...
@@ -30,7 +30,7 @@ import org.springframework.core.type.classreading.MetadataReaderFactory;
/**
/**
* {@link TypeExcludeFilter} for {@link DataMongoTest @DataMongoTest}.
* {@link TypeExcludeFilter} for {@link DataMongoTest @DataMongoTest}.
*
*
* @author Michael
J.
Simons
* @author Michael Simons
*/
*/
class
DataMongoTypeExcludeFilter
extends
AnnotationCustomizableTypeExcludeFilter
{
class
DataMongoTypeExcludeFilter
extends
AnnotationCustomizableTypeExcludeFilter
{
...
@@ -49,12 +49,12 @@ class DataMongoTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter
...
@@ -49,12 +49,12 @@ class DataMongoTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter
@Override
@Override
protected
Filter
[]
getFilters
(
final
FilterType
type
)
{
protected
Filter
[]
getFilters
(
final
FilterType
type
)
{
switch
(
type
)
{
switch
(
type
)
{
case
INCLUDE:
case
INCLUDE:
return
this
.
annotation
.
includeFilters
();
return
this
.
annotation
.
includeFilters
();
case
EXCLUDE:
case
EXCLUDE:
return
this
.
annotation
.
excludeFilters
();
return
this
.
annotation
.
excludeFilters
();
default
:
default
:
throw
new
IllegalStateException
(
"Unsupported type "
+
type
);
throw
new
IllegalStateException
(
"Unsupported type "
+
type
);
}
}
}
}
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/mongo/DataMongoTestIntegrationTests.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
/**
* Sample test for {@link DataMongoTest @DataMongoTest}
* Sample test for {@link DataMongoTest @DataMongoTest}
*
*
* @author Michael
J.
Simons
* @author Michael Simons
*/
*/
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DataMongoTest
@DataMongoTest
...
@@ -54,10 +54,8 @@ public class DataMongoTestIntegrationTests {
...
@@ -54,10 +54,8 @@ public class DataMongoTestIntegrationTests {
public
void
testRepository
()
{
public
void
testRepository
()
{
ExampleDocument
exampleDocument
=
new
ExampleDocument
();
ExampleDocument
exampleDocument
=
new
ExampleDocument
();
exampleDocument
.
setText
(
"Look, new @DataMongoTest!"
);
exampleDocument
.
setText
(
"Look, new @DataMongoTest!"
);
exampleDocument
=
this
.
exampleRepository
.
save
(
exampleDocument
);
exampleDocument
=
this
.
exampleRepository
.
save
(
exampleDocument
);
assertThat
(
exampleDocument
.
getId
()).
isNotNull
();
assertThat
(
exampleDocument
.
getId
()).
isNotNull
();
assertThat
(
this
.
mongoTemplate
.
collectionExists
(
"exampleDocuments"
)).
isTrue
();
assertThat
(
this
.
mongoTemplate
.
collectionExists
(
"exampleDocuments"
)).
isTrue
();
}
}
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/mongo/DataMongoTestWithIncludeFilterIntegrationTests.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
@@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
/**
* Integration test with custom include filter for {@link DataMongoTest}.
* Integration test with custom include filter for {@link DataMongoTest}.
*
*
* @author Michael
J.
Simons
* @author Michael Simons
*/
*/
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DataMongoTest
(
includeFilters
=
@Filter
(
Service
.
class
))
@DataMongoTest
(
includeFilters
=
@Filter
(
Service
.
class
))
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/mongo/ExampleDocument.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -21,7 +21,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
...
@@ -21,7 +21,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
/**
/**
* Example document used with {@link DataMongoTest} tests.
* Example document used with {@link DataMongoTest} tests.
*
*
* @author Michael
J.
Simons
* @author Michael Simons
*/
*/
@Document
(
collection
=
"exampleDocuments"
)
@Document
(
collection
=
"exampleDocuments"
)
public
class
ExampleDocument
{
public
class
ExampleDocument
{
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/mongo/ExampleMongoApplication.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -21,7 +21,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
...
@@ -21,7 +21,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
/**
* Example {@link SpringBootApplication} used with {@link DataMongoTest} tests.
* Example {@link SpringBootApplication} used with {@link DataMongoTest} tests.
*
*
* @author Michael
J.
Simons
* @author Michael Simons
*/
*/
@SpringBootApplication
@SpringBootApplication
public
class
ExampleMongoApplication
{
public
class
ExampleMongoApplication
{
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/mongo/ExampleRepository.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -21,7 +21,8 @@ import org.springframework.data.mongodb.repository.MongoRepository;
...
@@ -21,7 +21,8 @@ import org.springframework.data.mongodb.repository.MongoRepository;
/**
/**
* Example repository used with {@link DataMongoTest} tests.
* Example repository used with {@link DataMongoTest} tests.
*
*
* @author Michael
J.
Simons
* @author Michael Simons
*/
*/
public
interface
ExampleRepository
extends
MongoRepository
<
ExampleDocument
,
String
>
{
public
interface
ExampleRepository
extends
MongoRepository
<
ExampleDocument
,
String
>
{
}
}
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/mongo/ExampleService.java
View file @
3893383c
...
@@ -22,10 +22,11 @@ import org.springframework.stereotype.Service;
...
@@ -22,10 +22,11 @@ import org.springframework.stereotype.Service;
/**
/**
* Example service used with {@link DataMongoTest} tests.
* Example service used with {@link DataMongoTest} tests.
*
*
* @author Michael
J.
Simons
* @author Michael Simons
*/
*/
@Service
@Service
public
class
ExampleService
{
public
class
ExampleService
{
private
final
MongoTemplate
mongoTemplate
;
private
final
MongoTemplate
mongoTemplate
;
public
ExampleService
(
MongoTemplate
mongoTemplate
)
{
public
ExampleService
(
MongoTemplate
mongoTemplate
)
{
...
...
spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java
View file @
3893383c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
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