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
49039c33
Commit
49039c33
authored
Jun 15, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
d87f2713
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
18 deletions
+16
-18
CacheConfigFileCondition.java
...rk/boot/autoconfigure/cache/CacheConfigFileCondition.java
+5
-6
CacheConfigFileConditionTests.java
...ot/autoconfigure/cache/CacheConfigFileConditionTests.java
+7
-7
retry.groovy
spring-boot-cli/samples/retry.groovy
+2
-4
SpringRetryCompilerAutoConfiguration.java
...r/autoconfigure/SpringRetryCompilerAutoConfiguration.java
+2
-1
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigFileCondition.java
View file @
49039c33
...
...
@@ -28,20 +28,19 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
*
* @author Stephane Nicoll
* @author Phillip Webb
* @since 1.3.0
*/
abstract
class
CacheConfigFileCondition
extends
SpringBootCondition
{
private
final
String
name
;
private
final
String
configP
refix
;
private
final
String
p
refix
;
private
final
String
[]
resourceLocations
;
public
CacheConfigFileCondition
(
String
name
,
String
configP
refix
,
public
CacheConfigFileCondition
(
String
name
,
String
p
refix
,
String
...
resourceLocations
)
{
this
.
name
=
name
;
this
.
configPrefix
=
(
configPrefix
.
endsWith
(
"."
)
?
configPrefix
:
configP
refix
+
"."
);
this
.
prefix
=
(
prefix
.
endsWith
(
"."
)
?
prefix
:
p
refix
+
"."
);
this
.
resourceLocations
=
resourceLocations
;
}
...
...
@@ -49,9 +48,9 @@ abstract class CacheConfigFileCondition extends SpringBootCondition {
public
ConditionOutcome
getMatchOutcome
(
ConditionContext
context
,
AnnotatedTypeMetadata
metadata
)
{
RelaxedPropertyResolver
resolver
=
new
RelaxedPropertyResolver
(
context
.
getEnvironment
(),
this
.
configP
refix
);
context
.
getEnvironment
(),
this
.
p
refix
);
if
(
resolver
.
containsProperty
(
"config"
))
{
return
ConditionOutcome
.
match
(
"A '"
+
this
.
configP
refix
+
".config' "
return
ConditionOutcome
.
match
(
"A '"
+
this
.
p
refix
+
".config' "
+
"property is specified"
);
}
return
getResourceOutcome
(
context
,
metadata
);
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheConfigFileConditionTests.java
View file @
49039c33
...
...
@@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.cache;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
...
...
@@ -63,8 +62,7 @@ public class CacheConfigFileConditionTests {
assertTrue
(
this
.
context
.
containsBean
(
"foo"
));
}
private
void
load
(
Class
<?>
config
,
String
...
environment
)
{
private
void
load
(
Class
<?>
config
,
String
...
environment
)
{
AnnotationConfigApplicationContext
applicationContext
=
new
AnnotationConfigApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
applicationContext
,
environment
);
applicationContext
.
register
(
config
);
...
...
@@ -72,7 +70,6 @@ public class CacheConfigFileConditionTests {
this
.
context
=
applicationContext
;
}
@Configuration
@Conditional
(
CacheConfigFileDefaultFileCondition
.
class
)
static
class
DefaultFileConfiguration
{
...
...
@@ -93,16 +90,19 @@ public class CacheConfigFileConditionTests {
}
}
private
static
class
CacheConfigFileDefaultFileCondition
extends
CacheConfigFileCondition
{
private
static
class
CacheConfigFileDefaultFileCondition
extends
CacheConfigFileCondition
{
public
CacheConfigFileDefaultFileCondition
()
{
super
(
"test"
,
"spring.cache.test."
,
"classpath:/ehcache.xml"
);
}
}
private
static
class
CacheConfigFileNoDefaultFileCondition
extends
CacheConfigFileCondition
{
private
static
class
CacheConfigFileNoDefaultFileCondition
extends
CacheConfigFileCondition
{
public
CacheConfigFileNoDefaultFileCondition
()
{
super
(
"test"
,
"spring.cache.test"
,
"classpath:/this-cache-file-does-not-exist.xml"
);
super
(
"test"
,
"spring.cache.test"
,
"classpath:/this-cache-file-does-not-exist.xml"
);
}
}
...
...
spring-boot-cli/samples/retry.groovy
View file @
49039c33
...
...
@@ -8,14 +8,14 @@ class Example implements CommandLineRunner {
private
MyService
myService
void
run
(
String
...
args
)
{
println
"Hello ${this.myService.sayWorld()} From ${getClass().getClassLoader().getResource('samples/retry.groovy')}"
println
"Hello ${this.myService.sayWorld()} From ${getClass().getClassLoader().getResource('samples/retry.groovy')}"
}
}
@Service
class
MyService
{
static
int
count
=
0
@Retryable
...
...
@@ -26,5 +26,3 @@ class MyService {
return
"World!"
}
}
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringRetryCompilerAutoConfiguration.java
View file @
49039c33
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
5
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.
...
...
@@ -26,6 +26,7 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer;
* {@link CompilerAutoConfiguration} for Spring Retry.
*
* @author Dave Syer
* @since 1.3.0
*/
public
class
SpringRetryCompilerAutoConfiguration
extends
CompilerAutoConfiguration
{
...
...
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