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
ab6adc82
Commit
ab6adc82
authored
Jun 29, 2018
by
Johnny Lim
Committed by
Stephane Nicoll
Jul 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
Closes gh-13616
parent
809e3050
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
16 deletions
+16
-16
ServletEndpointRegistrar.java
...k/boot/actuate/endpoint/web/ServletEndpointRegistrar.java
+6
-5
OnExpressionCondition.java
...k/boot/autoconfigure/condition/OnExpressionCondition.java
+2
-3
ConditionalOnExpressionTests.java
...autoconfigure/condition/ConditionalOnExpressionTests.java
+3
-6
SpringIterableConfigurationPropertySource.java
...ies/source/SpringIterableConfigurationPropertySource.java
+1
-1
SpringProfileAction.java
...ngframework/boot/logging/logback/SpringProfileAction.java
+4
-1
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java
View file @
ab6adc82
...
@@ -81,11 +81,12 @@ public class ServletEndpointRegistrar implements ServletContextInitializer {
...
@@ -81,11 +81,12 @@ public class ServletEndpointRegistrar implements ServletContextInitializer {
}
}
private
String
[]
getUrlMappings
(
String
endpointPath
,
String
name
)
{
private
String
[]
getUrlMappings
(
String
endpointPath
,
String
name
)
{
return
this
.
basePaths
.
stream
()
return
this
.
basePaths
.
map
((
bp
)
->
(
bp
!=
null
?
bp
+
"/"
+
endpointPath
:
"/"
+
endpointPath
))
.
stream
().
map
((
basePath
)
->
(
basePath
!=
null
.
distinct
().
map
((
p
)
->
{
?
basePath
+
"/"
+
endpointPath
:
"/"
+
endpointPath
))
logger
.
info
(
"Registered '"
+
p
+
"' to "
+
name
);
.
distinct
().
map
((
path
)
->
{
return
(
p
.
endsWith
(
"/"
)
?
p
+
"*"
:
p
+
"/*"
);
logger
.
info
(
"Registered '"
+
path
+
"' to "
+
name
);
return
(
path
.
endsWith
(
"/"
)
?
path
+
"*"
:
path
+
"/*"
);
}).
toArray
(
String
[]::
new
);
}).
toArray
(
String
[]::
new
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java
View file @
ab6adc82
...
@@ -42,10 +42,9 @@ class OnExpressionCondition extends SpringBootCondition {
...
@@ -42,10 +42,9 @@ class OnExpressionCondition extends SpringBootCondition {
.
getAnnotationAttributes
(
ConditionalOnExpression
.
class
.
getName
())
.
getAnnotationAttributes
(
ConditionalOnExpression
.
class
.
getName
())
.
get
(
"value"
);
.
get
(
"value"
);
expression
=
wrapIfNecessary
(
expression
);
expression
=
wrapIfNecessary
(
expression
);
String
rawExpression
=
expression
;
expression
=
context
.
getEnvironment
().
resolvePlaceholders
(
expression
);
ConditionMessage
.
Builder
messageBuilder
=
ConditionMessage
ConditionMessage
.
Builder
messageBuilder
=
ConditionMessage
.
forCondition
(
ConditionalOnExpression
.
class
,
"("
+
rawExpression
+
")"
);
.
forCondition
(
ConditionalOnExpression
.
class
,
"("
+
expression
+
")"
);
expression
=
context
.
getEnvironment
().
resolvePlaceholders
(
expression
);
ConfigurableListableBeanFactory
beanFactory
=
context
.
getBeanFactory
();
ConfigurableListableBeanFactory
beanFactory
=
context
.
getBeanFactory
();
if
(
beanFactory
!=
null
)
{
if
(
beanFactory
!=
null
)
{
boolean
result
=
evaluateExpression
(
beanFactory
,
expression
);
boolean
result
=
evaluateExpression
(
beanFactory
,
expression
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpressionTests.java
View file @
ab6adc82
...
@@ -16,8 +16,7 @@
...
@@ -16,8 +16,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
condition
;
package
org
.
springframework
.
boot
.
autoconfigure
.
condition
;
import
java.util.HashMap
;
import
java.util.Collections
;
import
java.util.Map
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -49,7 +48,7 @@ public class ConditionalOnExpressionTests {
...
@@ -49,7 +48,7 @@ public class ConditionalOnExpressionTests {
}
}
@Test
@Test
public
void
expressionEvaluatesToTrueRegisterBean
()
{
public
void
expressionEvaluatesToTrueRegister
s
Bean
()
{
this
.
contextRunner
.
withUserConfiguration
(
MissingConfiguration
.
class
)
this
.
contextRunner
.
withUserConfiguration
(
MissingConfiguration
.
class
)
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
"foo"
));
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
"foo"
));
}
}
...
@@ -75,10 +74,8 @@ public class ConditionalOnExpressionTests {
...
@@ -75,10 +74,8 @@ public class ConditionalOnExpressionTests {
private
AnnotatedTypeMetadata
mockMetaData
(
String
value
)
{
private
AnnotatedTypeMetadata
mockMetaData
(
String
value
)
{
AnnotatedTypeMetadata
metadata
=
mock
(
AnnotatedTypeMetadata
.
class
);
AnnotatedTypeMetadata
metadata
=
mock
(
AnnotatedTypeMetadata
.
class
);
Map
<
String
,
Object
>
attributes
=
new
HashMap
<>();
attributes
.
put
(
"value"
,
value
);
given
(
metadata
.
getAnnotationAttributes
(
ConditionalOnExpression
.
class
.
getName
()))
given
(
metadata
.
getAnnotationAttributes
(
ConditionalOnExpression
.
class
.
getName
()))
.
willReturn
(
attributes
);
.
willReturn
(
Collections
.
singletonMap
(
"value"
,
value
)
);
return
metadata
;
return
metadata
;
}
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java
View file @
ab6adc82
...
@@ -174,7 +174,7 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope
...
@@ -174,7 +174,7 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope
private
static
final
class
CacheKey
{
private
static
final
class
CacheKey
{
private
Object
key
;
private
final
Object
key
;
private
CacheKey
(
Object
key
)
{
private
CacheKey
(
Object
key
)
{
this
.
key
=
key
;
this
.
key
=
key
;
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java
View file @
ab6adc82
...
@@ -67,9 +67,12 @@ class SpringProfileAction extends Action implements InPlayListener {
...
@@ -67,9 +67,12 @@ class SpringProfileAction extends Action implements InPlayListener {
}
}
private
boolean
acceptsProfiles
(
InterpretationContext
ic
,
Attributes
attributes
)
{
private
boolean
acceptsProfiles
(
InterpretationContext
ic
,
Attributes
attributes
)
{
if
(
this
.
environment
==
null
)
{
return
false
;
}
String
[]
profileNames
=
StringUtils
.
trimArrayElements
(
StringUtils
String
[]
profileNames
=
StringUtils
.
trimArrayElements
(
StringUtils
.
commaDelimitedListToStringArray
(
attributes
.
getValue
(
NAME_ATTRIBUTE
)));
.
commaDelimitedListToStringArray
(
attributes
.
getValue
(
NAME_ATTRIBUTE
)));
if
(
this
.
environment
==
null
||
profileNames
.
length
==
0
)
{
if
(
profileNames
.
length
==
0
)
{
return
false
;
return
false
;
}
}
for
(
int
i
=
0
;
i
<
profileNames
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
profileNames
.
length
;
i
++)
{
...
...
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