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
f8a4df08
Commit
f8a4df08
authored
Aug 28, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
544bc64d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
51 additions
and
48 deletions
+51
-48
RepositoryRestMvcAutoConfiguration.java
...nfigure/data/rest/RepositoryRestMvcAutoConfiguration.java
+6
-11
RepositoryRestMvcAutoConfigurationTests.java
...re/data/rest/RepositoryRestMvcAutoConfigurationTests.java
+11
-10
caching.groovy
spring-boot-cli/samples/caching.groovy
+0
-0
jms.groovy
spring-boot-cli/samples/jms.groovy
+2
-1
CachingCompilerAutoConfiguration.java
...piler/autoconfigure/CachingCompilerAutoConfiguration.java
+3
-4
JmsCompilerAutoConfiguration.java
.../compiler/autoconfigure/JmsCompilerAutoConfiguration.java
+8
-10
org.springframework.boot.cli.compiler.CompilerAutoConfiguration
...ringframework.boot.cli.compiler.CompilerAutoConfiguration
+2
-2
GrabCommandIntegrationTests.java
...springframework/boot/cli/GrabCommandIntegrationTests.java
+5
-2
ReproIntegrationTests.java
...a/org/springframework/boot/cli/ReproIntegrationTests.java
+0
-5
SampleIntegrationTests.java
.../org/springframework/boot/cli/SampleIntegrationTests.java
+8
-0
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+3
-0
ConfigurationBeanFactoryMetaData.java
.../context/properties/ConfigurationBeanFactoryMetaData.java
+3
-3
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.java
View file @
f8a4df08
...
...
@@ -23,7 +23,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.data.rest.core.config.RepositoryRestConfiguration
;
import
org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration
;
...
...
@@ -33,12 +32,9 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguratio
* <p>
* Activates when the application is a web application and no
* {@link RepositoryRestMvcConfiguration} is found.
* </p>
* <p>
* Once in effect, the auto-configuration allows to configure any property
* of {@link RepositoryRestConfiguration} using the {@code spring.data.rest}
* prefix.
* </p>
* Once in effect, the auto-configuration allows to configure any property of
* {@link RepositoryRestConfiguration} using the {@code spring.data.rest} prefix.
*
* @author Rob Winch
* @author Stephane Nicoll
...
...
@@ -48,18 +44,17 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguratio
@ConditionalOnWebApplication
@ConditionalOnMissingBean
(
RepositoryRestMvcConfiguration
.
class
)
@ConditionalOnClass
(
RepositoryRestMvcConfiguration
.
class
)
@Import
(
RepositoryRestMvcAutoConfiguration
.
RepositoryRestMvcBootConfiguration
.
class
)
public
class
RepositoryRestMvcAutoConfiguration
{
static
class
RepositoryRestMvcBootConfiguration
extends
RepositoryRestMvcConfiguration
{
@Configuration
static
class
RepositoryRestMvcBootConfiguration
extends
RepositoryRestMvcConfiguration
{
@Override
@Bean
@ConfigurationProperties
(
prefix
=
"spring.data.rest"
)
@Override
public
RepositoryRestConfiguration
config
()
{
return
super
.
config
();
}
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java
View file @
f8a4df08
...
...
@@ -20,7 +20,6 @@ import java.net.URI;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.TestAutoConfigurationPackage
;
import
org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration
;
...
...
@@ -36,7 +35,8 @@ import org.springframework.mock.web.MockServletContext;
import
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
/**
* Tests for {@link RepositoryRestMvcAutoConfiguration}.
...
...
@@ -64,7 +64,8 @@ public class RepositoryRestMvcAutoConfigurationTests {
public
void
testWithCustomBaseUri
()
throws
Exception
{
load
(
TestConfiguration
.
class
,
"spring.data.rest.baseUri:foo"
);
assertNotNull
(
this
.
context
.
getBean
(
RepositoryRestMvcConfiguration
.
class
));
RepositoryRestConfiguration
bean
=
this
.
context
.
getBean
(
RepositoryRestConfiguration
.
class
);
RepositoryRestConfiguration
bean
=
this
.
context
.
getBean
(
RepositoryRestConfiguration
.
class
);
assertEquals
(
"Custom baseURI not set"
,
URI
.
create
(
"foo"
),
bean
.
getBaseUri
());
}
...
...
@@ -72,17 +73,17 @@ public class RepositoryRestMvcAutoConfigurationTests {
public
void
backOffWithCustomConfiguration
()
{
load
(
TestConfigurationWithRestMvcConfig
.
class
,
"spring.data.rest.baseUri:foo"
);
assertNotNull
(
this
.
context
.
getBean
(
RepositoryRestMvcConfiguration
.
class
));
RepositoryRestConfiguration
bean
=
this
.
context
.
getBean
(
RepositoryRestConfiguration
.
class
);
assertEquals
(
"Custom base URI should not have been set"
,
URI
.
create
(
""
),
bean
.
getBaseUri
());
RepositoryRestConfiguration
bean
=
this
.
context
.
getBean
(
RepositoryRestConfiguration
.
class
);
assertEquals
(
"Custom base URI should not have been set"
,
URI
.
create
(
""
),
bean
.
getBaseUri
());
}
private
void
load
(
Class
<?>
config
,
String
...
environment
)
{
private
void
load
(
Class
<?>
config
,
String
...
environment
)
{
AnnotationConfigWebApplicationContext
applicationContext
=
new
AnnotationConfigWebApplicationContext
();
applicationContext
.
setServletContext
(
new
MockServletContext
());
applicationContext
.
register
(
config
,
EmbeddedDataSourceConfiguration
.
class
,
applicationContext
.
register
(
config
,
EmbeddedDataSourceConfiguration
.
class
,
HibernateJpaAutoConfiguration
.
class
,
JpaRepositoriesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
,
...
...
@@ -99,7 +100,7 @@ public class RepositoryRestMvcAutoConfigurationTests {
}
@Import
({
TestConfiguration
.
class
,
RepositoryRestMvcConfiguration
.
class
})
@Import
({
TestConfiguration
.
class
,
RepositoryRestMvcConfiguration
.
class
})
protected
static
class
TestConfigurationWithRestMvcConfig
{
}
...
...
spring-boot-cli/s
rc/test/resources/repro-s
amples/caching.groovy
→
spring-boot-cli/samples/caching.groovy
View file @
f8a4df08
File moved
spring-boot-cli/samples/jms.groovy
View file @
f8a4df08
...
...
@@ -28,4 +28,5 @@ class JmsExample implements CommandLineRunner {
log
.
info
"Received ${message}"
latch
.
countDown
()
}
}
\ No newline at end of file
}
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/CachingAutoConfiguration.java
→
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/Caching
Compiler
AutoConfiguration.java
View file @
f8a4df08
...
...
@@ -19,7 +19,6 @@ package org.springframework.boot.cli.compiler.autoconfigure;
import
org.codehaus.groovy.ast.ClassNode
;
import
org.codehaus.groovy.control.CompilationFailedException
;
import
org.codehaus.groovy.control.customizers.ImportCustomizer
;
import
org.springframework.boot.cli.compiler.AstUtils
;
import
org.springframework.boot.cli.compiler.CompilerAutoConfiguration
;
import
org.springframework.boot.cli.compiler.DependencyCustomizer
;
...
...
@@ -30,7 +29,7 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer;
* @author Stephane Nicoll
* @since 1.2.0
*/
public
class
CachingAutoConfiguration
extends
CompilerAutoConfiguration
{
public
class
Caching
Compiler
AutoConfiguration
extends
CompilerAutoConfiguration
{
@Override
public
boolean
matches
(
ClassNode
classNode
)
{
...
...
@@ -41,13 +40,13 @@ public class CachingAutoConfiguration extends CompilerAutoConfiguration {
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
throws
CompilationFailedException
{
dependencies
.
add
(
"spring-context-support"
);
}
@Override
public
void
applyImports
(
ImportCustomizer
imports
)
throws
CompilationFailedException
{
imports
.
addStarImports
(
"org.springframework.cache"
,
"org.springframework.cache.annotation"
,
"org.springframework.cache.concurrent"
);
"org.springframework.cache.annotation"
,
"org.springframework.cache.concurrent"
);
}
}
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JmsCompilerAutoConfiguration.java
View file @
f8a4df08
...
...
@@ -22,7 +22,6 @@ import org.codehaus.groovy.control.customizers.ImportCustomizer;
import
org.springframework.boot.cli.compiler.AstUtils
;
import
org.springframework.boot.cli.compiler.CompilerAutoConfiguration
;
import
org.springframework.boot.cli.compiler.DependencyCustomizer
;
import
org.springframework.boot.groovy.EnableJmsMessaging
;
/**
* {@link CompilerAutoConfiguration} for Spring JMS.
...
...
@@ -34,26 +33,25 @@ public class JmsCompilerAutoConfiguration extends CompilerAutoConfiguration {
@Override
public
boolean
matches
(
ClassNode
classNode
)
{
return
AstUtils
.
hasAtLeastOneAnnotation
(
classNode
,
"EnableJms"
)
||
AstUtils
.
hasAtLeastOneAnnotation
(
classNode
,
"EnableJmsMessaging"
);
return
AstUtils
.
hasAtLeastOneAnnotation
(
classNode
,
"EnableJms"
)
||
AstUtils
.
hasAtLeastOneAnnotation
(
classNode
,
"EnableJmsMessaging"
);
}
@Override
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
throws
CompilationFailedException
{
dependencies
.
add
(
"spring-jms"
,
"jms-api"
);
}
@Override
@SuppressWarnings
(
"deprecation"
)
public
void
applyImports
(
ImportCustomizer
imports
)
throws
CompilationFailedException
{
imports
.
addStarImports
(
"javax.jms"
,
"org.springframework.jms.annotation"
,
"org.springframework.jms.config"
,
"org.springframework.jms.core"
,
imports
.
addStarImports
(
"javax.jms"
,
"org.springframework.jms.annotation"
,
"org.springframework.jms.config"
,
"org.springframework.jms.core"
,
"org.springframework.jms.listener"
,
"org.springframework.jms.listener.adapter"
)
.
addImports
(
EnableJmsMessaging
.
class
.
getCanonicalName
());
"org.springframework.jms.listener.adapter"
).
addImports
(
org
.
springframework
.
boot
.
groovy
.
EnableJmsMessaging
.
class
.
getCanonicalName
());
}
}
spring-boot-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration
View file @
f8a4df08
...
...
@@ -4,7 +4,7 @@ org.springframework.boot.cli.compiler.autoconfigure.SpringMvcCompilerAutoConfigu
org.springframework.boot.cli.compiler.autoconfigure.SpringBatchCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.RabbitCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.ReactorCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.CachingAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.Caching
Compiler
AutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.JdbcCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.JmsCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.JUnitCompilerAutoConfiguration
...
...
@@ -17,4 +17,4 @@ org.springframework.boot.cli.compiler.autoconfigure.SpringSocialFacebookCompiler
org.springframework.boot.cli.compiler.autoconfigure.SpringSocialLinkedInCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.SpringSocialTwitterCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.SpringTestCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.SpringWebsocketCompilerAutoConfiguration
\ No newline at end of file
org.springframework.boot.cli.compiler.autoconfigure.SpringWebsocketCompilerAutoConfiguration
spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java
View file @
f8a4df08
...
...
@@ -27,6 +27,8 @@ import org.junit.Test;
import
org.springframework.boot.cli.command.grab.GrabCommand
;
import
org.springframework.util.FileSystemUtils
;
import
static
org
.
hamcrest
.
Matchers
.
containsString
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
...
...
@@ -68,8 +70,9 @@ public class GrabCommandIntegrationTests {
this
.
cli
.
grab
(
"duplicateGrabMetadata.groovy"
);
fail
();
}
catch
(
Exception
e
)
{
assertTrue
(
e
.
getMessage
().
contains
(
"Duplicate @GrabMetadata annotation"
));
catch
(
Exception
ex
)
{
assertThat
(
ex
.
getMessage
(),
containsString
(
"Duplicate @GrabMetadata annotation"
));
}
}
...
...
spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java
View file @
f8a4df08
...
...
@@ -79,9 +79,4 @@ public class ReproIntegrationTests {
assertThat
(
this
.
cli
.
getOutput
(),
containsString
(
"Hello World"
));
}
@Test
public
void
caching
()
throws
Exception
{
this
.
cli
.
run
(
"caching.groovy"
);
assertThat
(
this
.
cli
.
getOutput
(),
containsString
(
"Hello World"
));
}
}
spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java
View file @
f8a4df08
...
...
@@ -24,7 +24,9 @@ import org.junit.Ignore;
import
org.junit.Rule
;
import
org.junit.Test
;
import
static
org
.
hamcrest
.
Matchers
.
containsString
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
...
...
@@ -156,4 +158,10 @@ public class SampleIntegrationTests {
assertEquals
(
"Hello Normal Device!"
,
this
.
cli
.
getHttpOutput
());
}
@Test
public
void
caching
()
throws
Exception
{
this
.
cli
.
run
(
"caching.groovy"
);
assertThat
(
this
.
cli
.
getOutput
(),
containsString
(
"Hello World"
));
}
}
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
f8a4df08
...
...
@@ -1847,6 +1847,7 @@ resolved against their provided names.
[[boot-features-using-jms-template]]
[[boot-features-using-jms-sending]]
==== Sending a message
Spring's `JmsTemplate` is auto-configured and you can autowire it directly into your
...
...
@@ -1876,6 +1877,8 @@ own beans:
NOTE: {spring-javadoc}/jms/core/JmsMessagingTemplate.{dc-ext}[`JmsMessagingTemplate`]
(new in Spring 4.1) can be injected in a similar manner.
[[boot-features-using-jms-receiving]]
==== Receiving a message
...
...
spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java
View file @
f8a4df08
...
...
@@ -80,7 +80,7 @@ public class ConfigurationBeanFactoryMetaData implements BeanFactoryPostProcesso
if
(!
this
.
beans
.
containsKey
(
beanName
))
{
return
null
;
}
final
AtomicReference
<
Method
>
found
=
new
AtomicReference
<
Method
>();
final
AtomicReference
<
Method
>
found
=
new
AtomicReference
<
Method
>(
null
);
MetaData
meta
=
this
.
beans
.
get
(
beanName
);
final
String
factory
=
meta
.
getMethod
();
Class
<?>
type
=
this
.
beanFactory
.
getType
(
meta
.
getBean
());
...
...
@@ -88,8 +88,8 @@ public class ConfigurationBeanFactoryMetaData implements BeanFactoryPostProcesso
@Override
public
void
doWith
(
Method
method
)
throws
IllegalArgumentException
,
IllegalAccessException
{
if
(
found
.
get
()
==
null
&&
method
.
getName
().
equals
(
factory
))
{
found
.
set
(
method
);
if
(
method
.
getName
().
equals
(
factory
))
{
found
.
compareAndSet
(
null
,
method
);
}
}
});
...
...
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