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
68910f2b
Commit
68910f2b
authored
Jul 19, 2017
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
cd23de6e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
33 deletions
+40
-33
DropwizardMetricServices.java
.../actuate/metrics/dropwizard/DropwizardMetricServices.java
+1
-1
AllNestedConditions.java
...ork/boot/autoconfigure/condition/AllNestedConditions.java
+5
-3
AnyNestedCondition.java
...work/boot/autoconfigure/condition/AnyNestedCondition.java
+5
-3
NoneNestedConditions.java
...rk/boot/autoconfigure/condition/NoneNestedConditions.java
+5
-3
ResourceServerTokenServicesConfigurationTests.java
...source/ResourceServerTokenServicesConfigurationTests.java
+5
-4
ExitCodeApplication.java
...in/java/org/springframework/boot/ExitCodeApplication.java
+5
-5
CorsSampleActuatorApplicationTests.java
...a/sample/actuator/CorsSampleActuatorApplicationTests.java
+14
-14
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServices.java
View file @
68910f2b
/*
/*
* 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/condition/AllNestedConditions.java
View file @
68910f2b
...
@@ -43,9 +43,11 @@ import org.springframework.context.annotation.Condition;
...
@@ -43,9 +43,11 @@ import org.springframework.context.annotation.Condition;
* }
* }
* </pre>
* </pre>
* <p>
* <p>
* The {@link ConfigurationPhase} should be specified according to the conditions that
* The
* are defined. In the example above, all conditions are static and can be evaluated
* {@link org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase
* early so {@code PARSE_CONFIGURATION} is a right fit.
* ConfigurationPhase} should be specified according to the conditions that are defined.
* In the example above, all conditions are static and can be evaluated early so
* {@code PARSE_CONFIGURATION} is a right fit.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @since 1.3.0
* @since 1.3.0
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AnyNestedCondition.java
View file @
68910f2b
...
@@ -45,9 +45,11 @@ import org.springframework.core.annotation.Order;
...
@@ -45,9 +45,11 @@ import org.springframework.core.annotation.Order;
* }
* }
* </pre>
* </pre>
* <p>
* <p>
* The {@link ConfigurationPhase} should be specified according to the conditions that
* The
* are defined. In the example above, all conditions are static and can be evaluated
* {@link org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase
* early so {@code PARSE_CONFIGURATION} is a right fit.
* ConfigurationPhase} should be specified according to the conditions that are defined.
* In the example above, all conditions are static and can be evaluated early so
* {@code PARSE_CONFIGURATION} is a right fit.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @since 1.2.0
* @since 1.2.0
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/NoneNestedConditions.java
View file @
68910f2b
...
@@ -43,9 +43,11 @@ import org.springframework.context.annotation.Condition;
...
@@ -43,9 +43,11 @@ import org.springframework.context.annotation.Condition;
* }
* }
* </pre>
* </pre>
* <p>
* <p>
* The {@link ConfigurationPhase} should be specified according to the conditions that
* The
* are defined. In the example above, all conditions are static and can be evaluated
* {@link org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase
* early so {@code PARSE_CONFIGURATION} is a right fit.
* ConfigurationPhase} should be specified according to the conditions that are defined.
* In the example above, all conditions are static and can be evaluated early so
* {@code PARSE_CONFIGURATION} is a right fit.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @since 1.3.0
* @since 1.3.0
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java
View file @
68910f2b
...
@@ -264,8 +264,8 @@ public class ResourceServerTokenServicesConfigurationTests {
...
@@ -264,8 +264,8 @@ public class ResourceServerTokenServicesConfigurationTests {
EnvironmentTestUtils
.
addEnvironment
(
this
.
environment
,
EnvironmentTestUtils
.
addEnvironment
(
this
.
environment
,
"security.oauth2.resource.jwk.key-set-uri=http://my-auth-server/token_keys"
);
"security.oauth2.resource.jwk.key-set-uri=http://my-auth-server/token_keys"
);
this
.
context
=
new
SpringApplicationBuilder
(
JwkTokenStoreConfiguration
.
class
,
this
.
context
=
new
SpringApplicationBuilder
(
JwkTokenStoreConfiguration
.
class
,
ResourceConfiguration
.
class
)
ResourceConfiguration
.
class
)
.
environment
(
this
.
environment
).
web
(
false
)
.
environment
(
this
.
environment
).
web
(
false
)
.
run
();
.
run
();
assertThat
(
this
.
context
.
getBeansOfType
(
JwkTokenStore
.
class
)).
hasSize
(
1
);
assertThat
(
this
.
context
.
getBeansOfType
(
JwkTokenStore
.
class
)).
hasSize
(
1
);
}
}
...
@@ -273,8 +273,9 @@ public class ResourceServerTokenServicesConfigurationTests {
...
@@ -273,8 +273,9 @@ public class ResourceServerTokenServicesConfigurationTests {
public
void
jwtTokenStoreShouldBeConditionalOnMissingBean
()
throws
Exception
{
public
void
jwtTokenStoreShouldBeConditionalOnMissingBean
()
throws
Exception
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
environment
,
EnvironmentTestUtils
.
addEnvironment
(
this
.
environment
,
"security.oauth2.resource.jwt.keyValue="
+
PUBLIC_KEY
);
"security.oauth2.resource.jwt.keyValue="
+
PUBLIC_KEY
);
this
.
context
=
new
SpringApplicationBuilder
(
JwtTokenStoreConfiguration
.
class
,
ResourceConfiguration
.
class
)
this
.
context
=
new
SpringApplicationBuilder
(
JwtTokenStoreConfiguration
.
class
,
.
environment
(
this
.
environment
).
web
(
false
).
run
();
ResourceConfiguration
.
class
).
environment
(
this
.
environment
).
web
(
false
)
.
run
();
assertThat
(
this
.
context
.
getBeansOfType
(
JwtTokenStore
.
class
)).
hasSize
(
1
);
assertThat
(
this
.
context
.
getBeansOfType
(
JwtTokenStore
.
class
)).
hasSize
(
1
);
}
}
...
...
spring-boot-docs/src/main/java/org/springframework/boot/ExitCodeApplication.java
View file @
68910f2b
...
@@ -28,11 +28,6 @@ import org.springframework.context.annotation.Bean;
...
@@ -28,11 +28,6 @@ import org.springframework.context.annotation.Bean;
@SpringBootApplication
@SpringBootApplication
public
class
ExitCodeApplication
{
public
class
ExitCodeApplication
{
public
static
void
main
(
String
[]
args
)
{
System
.
exit
(
SpringApplication
.
exit
(
SpringApplication
.
run
(
ExitCodeApplication
.
class
,
args
)));
}
@Bean
@Bean
public
ExitCodeGenerator
exitCodeGenerator
()
{
public
ExitCodeGenerator
exitCodeGenerator
()
{
return
new
ExitCodeGenerator
()
{
return
new
ExitCodeGenerator
()
{
...
@@ -43,5 +38,10 @@ public class ExitCodeApplication {
...
@@ -43,5 +38,10 @@ public class ExitCodeApplication {
};
};
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
exit
(
SpringApplication
.
exit
(
SpringApplication
.
run
(
ExitCodeApplication
.
class
,
args
)));
}
}
}
// end::example[]
// end::example[]
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/CorsSampleActuatorApplicationTests.java
View file @
68910f2b
...
@@ -51,37 +51,37 @@ public class CorsSampleActuatorApplicationTests {
...
@@ -51,37 +51,37 @@ public class CorsSampleActuatorApplicationTests {
@Test
@Test
public
void
sensitiveEndpointShouldReturnUnauthorized
()
throws
Exception
{
public
void
sensitiveEndpointShouldReturnUnauthorized
()
throws
Exception
{
ResponseEntity
<
Map
>
entity
=
this
.
testRestTemplate
.
getForEntity
(
"/env"
,
Map
.
class
);
ResponseEntity
<
?
>
entity
=
this
.
testRestTemplate
.
getForEntity
(
"/env"
,
Map
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
UNAUTHORIZED
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
UNAUTHORIZED
);
}
}
@Test
@Test
public
void
preflightRequestForInsensitiveShouldReturnOk
()
throws
Exception
{
public
void
preflightRequestForInsensitiveShouldReturnOk
()
throws
Exception
{
RequestEntity
<?>
healthRequest
=
RequestEntity
.
options
(
new
URI
(
"/health"
))
RequestEntity
<?>
healthRequest
=
RequestEntity
.
options
(
new
URI
(
"/health"
))
.
header
(
"Origin"
,
"http://localhost:8080"
)
.
header
(
"Origin"
,
"http://localhost:8080"
)
.
header
(
"Access-Control-Request-Method"
,
"GET"
)
.
header
(
"Access-Control-Request-Method"
,
"GET"
)
.
build
();
.
build
();
ResponseEntity
<?>
exchange
=
this
.
testRestTemplate
.
exchange
(
healthRequest
,
ResponseEntity
<
Map
>
exchange
=
this
.
testRestTemplate
.
exchange
(
healthRequest
,
Map
.
class
);
Map
.
class
);
assertThat
(
exchange
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
exchange
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
}
@Test
@Test
public
void
preflightRequestForSensitiveEndpointShouldReturnOk
()
throws
Exception
{
public
void
preflightRequestForSensitiveEndpointShouldReturnOk
()
throws
Exception
{
RequestEntity
<?>
entity
=
RequestEntity
.
options
(
new
URI
(
"/env"
))
RequestEntity
<?>
entity
=
RequestEntity
.
options
(
new
URI
(
"/env"
))
.
header
(
"Origin"
,
"http://localhost:8080"
)
.
header
(
"Origin"
,
"http://localhost:8080"
)
.
header
(
"Access-Control-Request-Method"
,
"GET"
)
.
header
(
"Access-Control-Request-Method"
,
"GET"
).
build
();
.
build
();
ResponseEntity
<?>
env
=
this
.
testRestTemplate
.
exchange
(
entity
,
Map
.
class
);
ResponseEntity
<
Map
>
env
=
this
.
testRestTemplate
.
exchange
(
entity
,
Map
.
class
);
assertThat
(
env
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
env
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
}
@Test
@Test
public
void
preflightRequestWhenCorsConfigInvalidShouldReturnForbidden
()
throws
Exception
{
public
void
preflightRequestWhenCorsConfigInvalidShouldReturnForbidden
()
throws
Exception
{
RequestEntity
<?>
entity
=
RequestEntity
.
options
(
new
URI
(
"/health"
))
RequestEntity
<?>
entity
=
RequestEntity
.
options
(
new
URI
(
"/health"
))
.
header
(
"Origin"
,
"http://localhost:9095"
)
.
header
(
"Origin"
,
"http://localhost:9095"
)
.
header
(
"Access-Control-Request-Method"
,
"GET"
)
.
header
(
"Access-Control-Request-Method"
,
"GET"
)
.
build
();
.
build
();
ResponseEntity
<
byte
[]>
exchange
=
this
.
testRestTemplate
.
exchange
(
entity
,
ResponseEntity
<
byte
[]>
exchange
=
this
.
testRestTemplate
.
exchange
(
entity
,
byte
[].
class
);
byte
[].
class
);
assertThat
(
exchange
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
FORBIDDEN
);
assertThat
(
exchange
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
FORBIDDEN
);
}
}
...
...
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