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
05faac2b
Commit
05faac2b
authored
Feb 20, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
cdb56773
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
55 additions
and
72 deletions
+55
-72
CorsEndpointProperties.java
...te/autoconfigure/endpoint/web/CorsEndpointProperties.java
+1
-1
DataSourcePoolMetricsAutoConfigurationTests.java
...ics/jdbc/DataSourcePoolMetricsAutoConfigurationTests.java
+15
-22
SecurityContext.java
...pringframework/boot/actuate/endpoint/SecurityContext.java
+14
-0
EndpointMBean.java
...ingframework/boot/actuate/endpoint/jmx/EndpointMBean.java
+1
-16
AbstractWebFluxEndpointHandlerMapping.java
...t/web/reactive/AbstractWebFluxEndpointHandlerMapping.java
+7
-17
DataSourcePoolMetrics.java
...work/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java
+2
-2
CassandraProperties.java
...ork/boot/autoconfigure/cassandra/CassandraProperties.java
+1
-1
JdbcProperties.java
...ringframework/boot/autoconfigure/jdbc/JdbcProperties.java
+1
-1
OAuth2ClientPropertiesRegistrationAdapter.java
...th2/client/OAuth2ClientPropertiesRegistrationAdapter.java
+1
-1
TransactionProperties.java
...boot/autoconfigure/transaction/TransactionProperties.java
+1
-1
AggregateBinder.java
...amework/boot/context/properties/bind/AggregateBinder.java
+1
-1
BeanBinder.java
...ingframework/boot/context/properties/bind/BeanBinder.java
+1
-1
BindContext.java
...ngframework/boot/context/properties/bind/BindContext.java
+1
-1
DurationFormat.java
...java/org/springframework/boot/convert/DurationFormat.java
+1
-1
DurationUnit.java
...n/java/org/springframework/boot/convert/DurationUnit.java
+1
-1
StringToEnumIgnoringCaseConverterFactory.java
...oot/convert/StringToEnumIgnoringCaseConverterFactory.java
+1
-1
NarayanaProperties.java
...springframework/boot/jta/narayana/NarayanaProperties.java
+1
-1
ConfigurationPropertiesTests.java
...boot/context/properties/ConfigurationPropertiesTests.java
+4
-3
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/CorsEndpointProperties.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jdbc/DataSourcePoolMetricsAutoConfigurationTests.java
View file @
05faac2b
...
...
@@ -54,19 +54,16 @@ public class DataSourcePoolMetricsAutoConfigurationTests {
@Test
public
void
autoConfiguredDataSourceIsInstrumented
()
{
this
.
contextRunner
.
run
((
context
)
->
{
context
.
getBean
(
DataSource
.
class
).
getConnection
().
getMetaData
();
MeterRegistry
registry
=
context
.
getBean
(
MeterRegistry
.
class
);
registry
.
get
(
"jdbc.connections.max"
).
tags
(
"name"
,
"dataSource"
)
.
meter
();
});
this
.
contextRunner
.
run
((
context
)
->
{
context
.
getBean
(
DataSource
.
class
).
getConnection
().
getMetaData
();
MeterRegistry
registry
=
context
.
getBean
(
MeterRegistry
.
class
);
registry
.
get
(
"jdbc.connections.max"
).
tags
(
"name"
,
"dataSource"
).
meter
();
});
}
@Test
public
void
dataSourceInstrumentationCanBeDisabled
()
{
this
.
contextRunner
.
withPropertyValues
(
"management.metrics.enable.jdbc=false"
)
this
.
contextRunner
.
withPropertyValues
(
"management.metrics.enable.jdbc=false"
)
.
run
((
context
)
->
{
context
.
getBean
(
DataSource
.
class
).
getConnection
().
getMetaData
();
MeterRegistry
registry
=
context
.
getBean
(
MeterRegistry
.
class
);
...
...
@@ -92,23 +89,20 @@ public class DataSourcePoolMetricsAutoConfigurationTests {
@Test
public
void
autoConfiguredHikariDataSourceIsInstrumented
()
{
this
.
contextRunner
.
run
((
context
)
->
{
context
.
getBean
(
DataSource
.
class
).
getConnection
();
MeterRegistry
registry
=
context
.
getBean
(
MeterRegistry
.
class
);
registry
.
get
(
"hikaricp.connections"
).
meter
();
});
this
.
contextRunner
.
run
((
context
)
->
{
context
.
getBean
(
DataSource
.
class
).
getConnection
();
MeterRegistry
registry
=
context
.
getBean
(
MeterRegistry
.
class
);
registry
.
get
(
"hikaricp.connections"
).
meter
();
});
}
@Test
public
void
hikariDataSourceInstrumentationCanBeDisabled
()
{
this
.
contextRunner
.
withPropertyValues
(
"management.metrics.enable.hikaricp=false"
)
this
.
contextRunner
.
withPropertyValues
(
"management.metrics.enable.hikaricp=false"
)
.
run
((
context
)
->
{
context
.
getBean
(
DataSource
.
class
).
getConnection
();
MeterRegistry
registry
=
context
.
getBean
(
MeterRegistry
.
class
);
assertThat
(
registry
.
find
(
"hikaricp.connections"
).
meter
())
.
isNull
();
assertThat
(
registry
.
find
(
"hikaricp.connections"
).
meter
()).
isNull
();
});
}
...
...
@@ -135,7 +129,7 @@ public class DataSourcePoolMetricsAutoConfigurationTests {
MeterRegistry
registry
=
context
.
getBean
(
MeterRegistry
.
class
);
assertThat
(
registry
.
get
(
"hikaricp.connections"
).
meter
().
getId
()
.
getTags
())
.
containsExactly
(
Tag
.
of
(
"pool"
,
"firstDataSource"
));
.
containsExactly
(
Tag
.
of
(
"pool"
,
"firstDataSource"
));
});
}
...
...
@@ -215,8 +209,7 @@ public class DataSourcePoolMetricsAutoConfigurationTests {
private
org
.
apache
.
tomcat
.
jdbc
.
pool
.
DataSource
createTomcatDataSource
()
{
String
url
=
"jdbc:hsqldb:mem:test-"
+
UUID
.
randomUUID
();
return
DataSourceBuilder
.
create
().
url
(
url
)
return
DataSourceBuilder
.
create
().
url
(
url
)
.
type
(
org
.
apache
.
tomcat
.
jdbc
.
pool
.
DataSource
.
class
).
build
();
}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SecurityContext.java
View file @
05faac2b
...
...
@@ -26,6 +26,20 @@ import java.security.Principal;
*/
public
interface
SecurityContext
{
public
static
SecurityContext
NONE
=
new
SecurityContext
()
{
@Override
public
Principal
getPrincipal
()
{
return
null
;
}
@Override
public
boolean
isUserInRole
(
String
role
)
{
return
false
;
}
};
/**
* Return the currently authenticated {@link Principal} or {@code null}.
* @return the principal or {@code null}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBean.java
View file @
05faac2b
...
...
@@ -16,7 +16,6 @@
package
org
.
springframework
.
boot
.
actuate
.
endpoint
.
jmx
;
import
java.security.Principal
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -100,7 +99,7 @@ public class EndpointMBean implements DynamicMBean {
.
map
(
JmxOperationParameter:
:
getName
).
toArray
(
String
[]::
new
);
Map
<
String
,
Object
>
arguments
=
getArguments
(
parameterNames
,
params
);
Object
result
=
operation
.
invoke
(
new
InvocationContext
(
new
JmxSecurityContext
()
,
arguments
));
.
invoke
(
new
InvocationContext
(
SecurityContext
.
NONE
,
arguments
));
if
(
REACTOR_PRESENT
)
{
result
=
ReactiveHandler
.
handle
(
result
);
}
...
...
@@ -152,18 +151,4 @@ public class EndpointMBean implements DynamicMBean {
}
private
static
final
class
JmxSecurityContext
implements
SecurityContext
{
@Override
public
Principal
getPrincipal
()
{
return
null
;
}
@Override
public
boolean
isUserInRole
(
String
role
)
{
return
false
;
}
}
}
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java
View file @
05faac2b
...
...
@@ -271,14 +271,16 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
private
ReactiveWebOperationAdapter
(
OperationInvoker
invoker
)
{
this
.
invoker
=
invoker
;
this
.
securityContextSupplier
=
getSecurityContextSupplier
();
}
private
Supplier
<
Mono
<?
extends
SecurityContext
>>
getSecurityContextSupplier
()
{
if
(
ClassUtils
.
isPresent
(
"org.springframework.security.core.context.ReactiveSecurityContextHolder"
,
getClass
().
getClassLoader
()))
{
this
.
securityContextSupplier
=
this
::
springSecurityContext
;
}
else
{
this
.
securityContextSupplier
=
this
::
emptySecurityContext
;
return
this
::
springSecurityContext
;
}
return
this
::
emptySecurityContext
;
}
public
Mono
<?
extends
SecurityContext
>
springSecurityContext
()
{
...
...
@@ -289,19 +291,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
}
public
Mono
<
SecurityContext
>
emptySecurityContext
()
{
return
Mono
.
just
(
new
SecurityContext
()
{
@Override
public
Principal
getPrincipal
()
{
return
null
;
}
@Override
public
boolean
isUserInRole
(
String
role
)
{
return
false
;
}
});
return
Mono
.
just
(
SecurityContext
.
NONE
);
}
@Override
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java
View file @
05faac2b
...
...
@@ -84,8 +84,8 @@ public class DataSourcePoolMetrics implements MeterBinder {
private
<
N
extends
Number
>
void
bindDataSource
(
MeterRegistry
registry
,
String
metricName
,
Function
<
DataSource
,
N
>
function
)
{
if
(
function
.
apply
(
this
.
dataSource
)
!=
null
)
{
registry
.
gauge
(
"jdbc.connections."
+
metricName
,
this
.
tags
,
this
.
dataSource
,
(
m
)
->
function
.
apply
(
m
).
doubleValue
());
registry
.
gauge
(
"jdbc.connections."
+
metricName
,
this
.
tags
,
this
.
dataSource
,
(
m
)
->
function
.
apply
(
m
).
doubleValue
());
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraProperties.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/JdbcProperties.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapter.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionProperties.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BeanBinder.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindContext.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationFormat.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationUnit.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToEnumIgnoringCaseConverterFactory.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/narayana/NarayanaProperties.java
View file @
05faac2b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java
View file @
05faac2b
...
...
@@ -79,10 +79,10 @@ import static org.assertj.core.api.Assertions.assertThat;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
entry
;
import
static
org
.
hamcrest
.
Matchers
.
instanceOf
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
anyString
;
import
static
org
.
mockito
.
ArgumentMatchers
.
eq
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Matchers
.
anyString
;
import
static
org
.
mockito
.
Matchers
.
eq
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
...
...
@@ -989,6 +989,7 @@ public class ConfigurationPropertiesTests {
}
return
null
;
}
}
@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