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
bc47bf44
Commit
bc47bf44
authored
Jun 01, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.x'
parents
81ef6fec
152ce145
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
42 additions
and
47 deletions
+42
-47
README.adoc
README.adoc
+1
-1
JestAutoConfiguration.java
...toconfigure/elasticsearch/jest/JestAutoConfiguration.java
+1
-1
Restarter.java
.../org/springframework/boot/devtools/restart/Restarter.java
+12
-7
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+1
-1
getting-started.adoc
...t/spring-boot-docs/src/main/asciidoc/getting-started.adoc
+1
-1
spring-boot-features.adoc
...ing-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+3
-3
StringSequence.java
...a/org/springframework/boot/loader/jar/StringSequence.java
+3
-3
ConfigFileApplicationListener.java
...rk/boot/context/config/ConfigFileApplicationListener.java
+9
-6
SampleTomcatDeployApplicationIT.java
...src/test/java/sample/SampleTomcatDeployApplicationIT.java
+11
-24
No files found.
README.adoc
View file @
bc47bf44
...
...
@@ -224,7 +224,7 @@ This module contains core items and annotations that can be helpful when testing
=== spring-boot-test-autoconfigure
Like other Spring Boot
Auto-C
onfiguration modules, spring-boot-test-autoconfigure, provides auto-configuration
Like other Spring Boot
auto-c
onfiguration modules, spring-boot-test-autoconfigure, provides auto-configuration
for tests based on the classpath. It includes a number of annotations that can be used to automatically
configure a slice of your application that needs to be tested.
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfiguration.java
View file @
bc47bf44
...
...
@@ -39,7 +39,7 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.util.Assert
;
/**
* {@link EnableAutoConfiguration Auto-
C
onfiguration} for Jest.
* {@link EnableAutoConfiguration Auto-
c
onfiguration} for Jest.
*
* @author Stephane Nicoll
* @since 1.4.0
...
...
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java
View file @
bc47bf44
...
...
@@ -134,7 +134,9 @@ public class Restarter {
Assert
.
notNull
(
thread
,
"Thread must not be null"
);
Assert
.
notNull
(
args
,
"Args must not be null"
);
Assert
.
notNull
(
initializer
,
"Initializer must not be null"
);
this
.
logger
.
debug
(
"Creating new Restarter for thread "
+
thread
);
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Creating new Restarter for thread "
+
thread
);
}
SilentExitExceptionHandler
.
setup
(
thread
);
this
.
forceReferenceCleanup
=
forceReferenceCleanup
;
this
.
initialUrls
=
initializer
.
getInitialUrls
(
thread
);
...
...
@@ -360,7 +362,10 @@ public class Restarter {
clear
(
Class
.
forName
(
className
),
fieldName
);
}
catch
(
Exception
ex
)
{
this
.
logger
.
debug
(
"Unable to clear field "
+
className
+
" "
+
fieldName
,
ex
);
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Unable to clear field "
+
className
+
" "
+
fieldName
,
ex
);
}
}
}
...
...
@@ -377,15 +382,15 @@ public class Restarter {
}
}
catch
(
Exception
ex
)
{
this
.
logger
.
debug
(
"Unable to clear field "
+
type
+
" "
+
fieldName
,
ex
);
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Unable to clear field "
+
type
+
" "
+
fieldName
,
ex
);
}
}
}
private
boolean
isFromRestartClassLoader
(
Object
object
)
{
if
(
object
instanceof
Class
)
{
return
((
Class
<?>)
object
).
getClassLoader
()
instanceof
RestartClassLoader
;
}
return
false
;
return
(
object
instanceof
Class
&&
((
Class
<?>)
object
).
getClassLoader
()
instanceof
RestartClassLoader
);
}
/**
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
bc47bf44
...
...
@@ -3,7 +3,7 @@
[[common-application-properties]]
== Common application properties
Various properties can be specified inside your `application.properties` file, inside
your
`application.yml` file, or as command line switches. This appendix provides a list
your `application.yml` file, or as command line switches. This appendix provides a list
of common Spring Boot properties and references to the underlying classes that consume
them.
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/getting-started.adoc
View file @
bc47bf44
...
...
@@ -662,7 +662,7 @@ that you have added. Since `spring-boot-starter-web` added Tomcat and Spring MVC
auto-configuration assumes that you are developing a web application and sets up Spring
accordingly.
.Starters and Auto-
C
onfiguration
.Starters and Auto-
c
onfiguration
****
Auto-configuration is designed to work well with "`Starters`", but the two concepts are
not directly tied. You are free to pick and choose jar dependencies outside of the
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
bc47bf44
...
...
@@ -2064,7 +2064,7 @@ directory locations). The root Servlet context path, `"/"`, is automatically add
location as well.
In addition to the "`standard`" static resource locations mentioned earlier, a special
case is made for http://www.webjars.org/[Webjars content]. Any resources with a path in
case is made for http
s
://www.webjars.org/[Webjars content]. Any resources with a path in
`+/webjars/**+` are served from jar files if they are packaged in the Webjars format.
TIP: Do not use the `src/main/webapp` directory if your application is packaged as a jar.
...
...
@@ -2625,7 +2625,7 @@ custom locations. So, if there is an `index.html` in any of your locations on st
is the home page of the application.
In addition to the "`standard`" static resource locations listed earlier, a special case
is made for http://www.webjars.org/[Webjars content]. Any resources with a path in
is made for http
s
://www.webjars.org/[Webjars content]. Any resources with a path in
`+/webjars/**+` are served from jar files if they are packaged in the Webjars format.
TIP: Spring WebFlux applications do not strictly depend on the Servlet API, so they
...
...
@@ -7259,7 +7259,7 @@ which auto-configures one for you.
[[boot-features-
environment-test-utiliti
es]]
[[boot-features-
test-property-valu
es]]
==== TestPropertyValues
`TestPropertyValues` lets you quickly add properties to a
`ConfigurableEnvironment` or `ConfigurableApplicationContext`. You can call it with
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java
View file @
bc47bf44
...
...
@@ -99,11 +99,11 @@ final class StringSequence implements CharSequence {
return
startsWith
(
prefix
,
0
);
}
public
boolean
startsWith
(
CharSequence
prefix
,
int
t
offset
)
{
if
(
length
()
-
prefix
.
length
()
-
t
offset
<
0
)
{
public
boolean
startsWith
(
CharSequence
prefix
,
int
offset
)
{
if
(
length
()
-
prefix
.
length
()
-
offset
<
0
)
{
return
false
;
}
return
subSequence
(
toffset
,
t
offset
+
prefix
.
length
()).
equals
(
prefix
);
return
subSequence
(
offset
,
offset
+
prefix
.
length
()).
equals
(
prefix
);
}
@Override
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
View file @
bc47bf44
...
...
@@ -20,6 +20,7 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Deque
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashSet
;
...
...
@@ -301,7 +302,7 @@ public class ConfigFileApplicationListener
private
final
List
<
PropertySourceLoader
>
propertySourceLoaders
;
private
LinkedList
<
Profile
>
profiles
;
private
Deque
<
Profile
>
profiles
;
private
List
<
Profile
>
processedProfiles
;
...
...
@@ -345,9 +346,9 @@ public class ConfigFileApplicationListener
// The default profile for these purposes is represented as null. We add it
// first so that it is processed first and has lowest priority.
this
.
profiles
.
add
(
null
);
Set
<
Profile
>
activatedViaProperty
=
getProfilesActivatedVia
ActiveProfile
Property
();
Set
<
Profile
>
activatedViaProperty
=
getProfilesActivatedViaProperty
();
processOtherActiveProfiles
(
activatedViaProperty
);
// Any pre-existing active
activeP
rofiles set via property sources (e.g.
// Any pre-existing active
p
rofiles set via property sources (e.g.
// System
// properties) take precedence over those added in config files.
addActiveProfiles
(
activatedViaProperty
);
...
...
@@ -360,7 +361,7 @@ public class ConfigFileApplicationListener
}
}
private
Set
<
Profile
>
getProfilesActivatedVia
ActiveProfile
Property
()
{
private
Set
<
Profile
>
getProfilesActivatedViaProperty
()
{
if
(!
this
.
environment
.
containsProperty
(
ACTIVE_PROFILES_PROPERTY
)
&&
!
this
.
environment
.
containsProperty
(
INCLUDE_PROFILES_PROPERTY
))
{
return
Collections
.
emptySet
();
...
...
@@ -385,8 +386,10 @@ public class ConfigFileApplicationListener
return
;
}
addProfiles
(
profiles
);
this
.
logger
.
debug
(
"Activated activeProfiles "
+
StringUtils
.
collectionToCommaDelimitedString
(
profiles
));
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Activated activeProfiles "
+
StringUtils
.
collectionToCommaDelimitedString
(
profiles
));
}
this
.
activatedProfiles
=
true
;
removeUnprocessedDefaultProfiles
();
}
...
...
spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java
View file @
bc47bf44
...
...
@@ -58,62 +58,49 @@ public class SampleTomcatDeployApplicationIT {
@Test
public
void
errorFromExceptionForRequestAcceptingAnythingProducesAJsonResponse
()
throws
Exception
{
assertThat
ErrorFromExceptionProducesExpectedResponse
(
MediaType
.
ALL
,
assertThat
PathProducesExpectedResponse
(
"/bootapp/exception"
,
MediaType
.
ALL
,
MediaType
.
APPLICATION_JSON
);
}
@Test
public
void
errorFromExceptionForRequestAcceptingJsonProducesAJsonResponse
()
throws
Exception
{
assertThat
ErrorFromExceptionProducesExpectedResponse
(
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_JSON
);
assertThat
PathProducesExpectedResponse
(
"/bootapp/exception"
,
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_JSON
);
}
@Test
public
void
errorFromExceptionForRequestAcceptingHtmlProducesAnHtmlResponse
()
throws
Exception
{
assertThat
ErrorFromExceptionProducesExpectedResponse
(
MediaType
.
TEXT_HTML
,
assertThat
PathProducesExpectedResponse
(
"/bootapp/exception"
,
MediaType
.
TEXT_HTML
,
MediaType
.
TEXT_HTML
);
}
@Test
public
void
sendErrorForRequestAcceptingAnythingProducesAJsonResponse
()
throws
Exception
{
assertThat
SendErrorProducesExpectedResponse
(
MediaType
.
ALL
,
assertThat
PathProducesExpectedResponse
(
"/bootapp/send-error"
,
MediaType
.
ALL
,
MediaType
.
APPLICATION_JSON
);
}
@Test
public
void
sendErrorForRequestAcceptingJsonProducesAJsonResponse
()
throws
Exception
{
assertThat
SendErrorProducesExpectedResponse
(
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_JSON
);
assertThat
PathProducesExpectedResponse
(
"/bootapp/send-error"
,
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_JSON
);
}
@Test
public
void
sendErrorForRequestAcceptingHtmlProducesAnHtmlResponse
()
throws
Exception
{
assertThat
SendErrorProducesExpectedResponse
(
MediaType
.
TEXT_HTML
,
assertThat
PathProducesExpectedResponse
(
"/bootapp/send-error"
,
MediaType
.
TEXT_HTML
,
MediaType
.
TEXT_HTML
);
}
private
void
assertThatSendErrorProducesExpectedResponse
(
MediaType
accept
,
MediaType
contentType
)
{
RequestEntity
<
Void
>
request
=
RequestEntity
.
get
(
URI
.
create
(
"http://localhost:"
+
this
.
port
+
"/bootapp/send-error"
))
.
accept
(
accept
).
build
();
ResponseEntity
<
String
>
response
=
this
.
rest
.
exchange
(
request
,
String
.
class
);
assertThat
(
response
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
assertThat
(
contentType
.
isCompatibleWith
(
response
.
getHeaders
().
getContentType
()))
.
as
(
"%s is compatible with %s"
,
contentType
,
response
.
getHeaders
().
getContentType
())
.
isTrue
();
}
private
void
assertThatErrorFromExceptionProducesExpectedResponse
(
MediaType
accept
,
private
void
assertThatPathProducesExpectedResponse
(
String
path
,
MediaType
accept
,
MediaType
contentType
)
{
RequestEntity
<
Void
>
request
=
RequestEntity
.
get
(
URI
.
create
(
"http://localhost:"
+
this
.
port
+
"/bootapp/exception"
)
)
.
accept
(
accept
).
build
();
.
get
(
URI
.
create
(
"http://localhost:"
+
this
.
port
+
path
)).
accept
(
accept
)
.
build
();
ResponseEntity
<
String
>
response
=
this
.
rest
.
exchange
(
request
,
String
.
class
);
assertThat
(
response
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
assertThat
(
contentType
.
isCompatibleWith
(
response
.
getHeaders
().
getContentType
()))
...
...
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