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
9a529b41
Commit
9a529b41
authored
Sep 18, 2013
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
b857a900
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
162 additions
and
86 deletions
+162
-86
pom.xml
spring-boot-autoconfigure/pom.xml
+1
-0
AbstractRepositoryConfigurationSourceSupport.java
...re/data/AbstractRepositoryConfigurationSourceSupport.java
+35
-21
JpaRepositoriesAutoConfigureRegistrar.java
...configure/data/JpaRepositoriesAutoConfigureRegistrar.java
+9
-4
MongoRepositoriesAutoConfigureRegistrar.java
...nfigure/data/MongoRepositoriesAutoConfigureRegistrar.java
+9
-4
JmsTemplateAutoConfiguration.java
.../boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java
+4
-2
JmsTemplateAutoConfigurationTests.java
.../autoconfigure/jms/JmsTemplateAutoConfigurationTests.java
+32
-33
JdbcCompilerAutoConfiguration.java
...compiler/autoconfigure/JdbcCompilerAutoConfiguration.java
+6
-6
SpringMvcCompilerAutoConfiguration.java
...ler/autoconfigure/SpringMvcCompilerAutoConfiguration.java
+6
-6
TransactionManagementCompilerAutoConfiguration.java
...igure/TransactionManagementCompilerAutoConfiguration.java
+5
-5
SampleIntegrationTests.java
.../org/springframework/boot/cli/SampleIntegrationTests.java
+3
-3
logback.xml
spring-boot-cli/src/test/resources/logback.xml
+3
-1
ServiceMonitor.java
...ringframework/boot/sample/aop/monitor/ServiceMonitor.java
+16
-0
Customer.java
.../org/springframework/boot/sample/data/mongo/Customer.java
+16
-1
CustomerRepository.java
...gframework/boot/sample/data/mongo/CustomerRepository.java
+17
-0
No files found.
spring-boot-autoconfigure/pom.xml
View file @
9a529b41
...
@@ -139,6 +139,7 @@
...
@@ -139,6 +139,7 @@
<dependency>
<dependency>
<groupId>
org.apache.geronimo.specs
</groupId>
<groupId>
org.apache.geronimo.specs
</groupId>
<artifactId>
geronimo-jms_1.1_spec
</artifactId>
<artifactId>
geronimo-jms_1.1_spec
</artifactId>
<optional>
true
</optional>
</dependency>
</dependency>
<!-- Test -->
<!-- Test -->
<dependency>
<dependency>
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport.java
View file @
9a529b41
...
@@ -41,34 +41,38 @@ import org.springframework.data.repository.config.RepositoryConfiguration;
...
@@ -41,34 +41,38 @@ import org.springframework.data.repository.config.RepositoryConfiguration;
import
org.springframework.data.repository.config.RepositoryConfigurationExtension
;
import
org.springframework.data.repository.config.RepositoryConfigurationExtension
;
/**
/**
* Base {@link ImportBeanDefinitionRegistrar} used to auto-configure Spring Data
* Repositories.
*
* @author Phillip Webb
* @author Dave Syer
* @author Dave Syer
*/
*/
public
abstract
class
AbstractRepositoryConfigurationSourceSupport
implements
public
abstract
class
AbstractRepositoryConfigurationSourceSupport
implements
BeanFactoryAware
,
ImportBeanDefinitionRegistrar
,
BeanClassLoaderAware
{
BeanFactoryAware
,
ImportBeanDefinitionRegistrar
,
BeanClassLoaderAware
{
private
ClassLoader
beanClassLoader
;
private
static
Log
logger
=
LogFactory
private
static
Log
logger
=
LogFactory
.
getLog
(
AbstractRepositoryConfigurationSourceSupport
.
class
);
.
getLog
(
AbstractRepositoryConfigurationSourceSupport
.
class
);
private
ClassLoader
beanClassLoader
;
private
BeanFactory
beanFactory
;
private
BeanFactory
beanFactory
;
@Override
@Override
public
void
registerBeanDefinitions
(
AnnotationMetadata
importingClassMetadata
,
public
void
registerBeanDefinitions
(
AnnotationMetadata
importingClassMetadata
,
final
BeanDefinitionRegistry
registry
)
{
final
BeanDefinitionRegistry
registry
)
{
final
ResourceLoader
resourceLoader
=
new
DefaultResourceLoader
();
ResourceLoader
resourceLoader
=
new
DefaultResourceLoader
();
final
AnnotationRepositoryConfigurationSource
configurationSource
=
getConfigurationSource
();
AnnotationRepositoryConfigurationSource
configurationSource
=
getConfigurationSource
();
final
RepositoryConfigurationExtension
extension
=
getRepositoryConfigurationExtension
();
RepositoryConfigurationExtension
extension
=
getRepositoryConfigurationExtension
();
extension
.
registerBeansForRoot
(
registry
,
configurationSource
);
extension
.
registerBeansForRoot
(
registry
,
configurationSource
);
final
RepositoryBeanNameGenerator
generator
=
new
RepositoryBeanNameGenerator
();
RepositoryBeanNameGenerator
generator
=
new
RepositoryBeanNameGenerator
();
generator
.
setBeanClassLoader
(
this
.
beanClassLoader
);
generator
.
setBeanClassLoader
(
this
.
beanClassLoader
);
Collection
<
RepositoryConfiguration
<
AnnotationRepositoryConfigurationSource
>>
repositoryConfigurations
=
extension
Collection
<
RepositoryConfiguration
<
AnnotationRepositoryConfigurationSource
>>
repositoryConfigurations
=
extension
.
getRepositoryConfigurations
(
configurationSource
,
resourceLoader
);
.
getRepositoryConfigurations
(
configurationSource
,
resourceLoader
);
for
(
final
RepositoryConfiguration
<
AnnotationRepositoryConfigurationSource
>
repositoryConfiguration
:
repositoryConfigurations
)
{
for
(
RepositoryConfiguration
<
AnnotationRepositoryConfigurationSource
>
repositoryConfiguration
:
repositoryConfigurations
)
{
RepositoryBeanDefinitionBuilder
builder
=
new
RepositoryBeanDefinitionBuilder
(
RepositoryBeanDefinitionBuilder
builder
=
new
RepositoryBeanDefinitionBuilder
(
repositoryConfiguration
,
extension
);
repositoryConfiguration
,
extension
);
BeanDefinitionBuilder
definitionBuilder
=
builder
.
build
(
registry
,
BeanDefinitionBuilder
definitionBuilder
=
builder
.
build
(
registry
,
...
@@ -82,21 +86,11 @@ public abstract class AbstractRepositoryConfigurationSourceSupport implements
...
@@ -82,21 +86,11 @@ public abstract class AbstractRepositoryConfigurationSourceSupport implements
}
}
}
}
@Override
private
AnnotationRepositoryConfigurationSource
getConfigurationSource
()
{
public
void
setBeanClassLoader
(
ClassLoader
classLoader
)
{
StandardAnnotationMetadata
metadata
=
new
StandardAnnotationMetadata
(
this
.
beanClassLoader
=
classLoader
;
getConfiguration
(),
true
);
}
protected
abstract
RepositoryConfigurationExtension
getRepositoryConfigurationExtension
();
protected
abstract
AnnotationRepositoryConfigurationSource
getConfigurationSource
();
protected
AnnotationRepositoryConfigurationSource
getConfigurationSource
(
Class
<?>
annotated
,
Class
<?
extends
Annotation
>
annotation
)
{
StandardAnnotationMetadata
metadata
=
new
StandardAnnotationMetadata
(
annotated
,
true
);
AnnotationRepositoryConfigurationSource
configurationSource
=
new
AnnotationRepositoryConfigurationSource
(
AnnotationRepositoryConfigurationSource
configurationSource
=
new
AnnotationRepositoryConfigurationSource
(
metadata
,
annotation
)
{
metadata
,
getAnnotation
()
)
{
@Override
@Override
public
java
.
lang
.
Iterable
<
String
>
getBasePackages
()
{
public
java
.
lang
.
Iterable
<
String
>
getBasePackages
()
{
...
@@ -117,6 +111,26 @@ public abstract class AbstractRepositoryConfigurationSourceSupport implements
...
@@ -117,6 +111,26 @@ public abstract class AbstractRepositoryConfigurationSourceSupport implements
return
basePackages
;
return
basePackages
;
}
}
/**
* The Spring Data annotation used to enable the particular repository support.
*/
protected
abstract
Class
<?
extends
Annotation
>
getAnnotation
();
/**
* The configuration class that will be used by Spring Boot as a template.
*/
protected
abstract
Class
<?>
getConfiguration
();
/**
* The {@link RepositoryConfigurationExtension} for the particular repository support.
*/
protected
abstract
RepositoryConfigurationExtension
getRepositoryConfigurationExtension
();
@Override
public
void
setBeanClassLoader
(
ClassLoader
classLoader
)
{
this
.
beanClassLoader
=
classLoader
;
}
@Override
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
this
.
beanFactory
=
beanFactory
;
this
.
beanFactory
=
beanFactory
;
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java
View file @
9a529b41
...
@@ -16,10 +16,11 @@
...
@@ -16,10 +16,11 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
data
;
package
org
.
springframework
.
boot
.
autoconfigure
.
data
;
import
java.lang.annotation.Annotation
;
import
org.springframework.context.annotation.ImportBeanDefinitionRegistrar
;
import
org.springframework.context.annotation.ImportBeanDefinitionRegistrar
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension
;
import
org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension
;
import
org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource
;
import
org.springframework.data.repository.config.RepositoryConfigurationExtension
;
import
org.springframework.data.repository.config.RepositoryConfigurationExtension
;
/**
/**
...
@@ -33,9 +34,13 @@ class JpaRepositoriesAutoConfigureRegistrar extends
...
@@ -33,9 +34,13 @@ class JpaRepositoriesAutoConfigureRegistrar extends
AbstractRepositoryConfigurationSourceSupport
{
AbstractRepositoryConfigurationSourceSupport
{
@Override
@Override
protected
AnnotationRepositoryConfigurationSource
getConfigurationSource
()
{
protected
Class
<?
extends
Annotation
>
getAnnotation
()
{
return
getConfigurationSource
(
EnableJpaRepositoriesConfiguration
.
class
,
return
EnableJpaRepositories
.
class
;
EnableJpaRepositories
.
class
);
}
@Override
protected
Class
<?>
getConfiguration
()
{
return
EnableJpaRepositoriesConfiguration
.
class
;
}
}
@Override
@Override
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/MongoRepositoriesAutoConfigureRegistrar.java
View file @
9a529b41
...
@@ -16,10 +16,11 @@
...
@@ -16,10 +16,11 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
data
;
package
org
.
springframework
.
boot
.
autoconfigure
.
data
;
import
java.lang.annotation.Annotation
;
import
org.springframework.context.annotation.ImportBeanDefinitionRegistrar
;
import
org.springframework.context.annotation.ImportBeanDefinitionRegistrar
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
import
org.springframework.data.mongodb.repository.config.MongoRepositoryConfigurationExtension
;
import
org.springframework.data.mongodb.repository.config.MongoRepositoryConfigurationExtension
;
import
org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource
;
import
org.springframework.data.repository.config.RepositoryConfigurationExtension
;
import
org.springframework.data.repository.config.RepositoryConfigurationExtension
;
/**
/**
...
@@ -32,9 +33,13 @@ class MongoRepositoriesAutoConfigureRegistrar extends
...
@@ -32,9 +33,13 @@ class MongoRepositoriesAutoConfigureRegistrar extends
AbstractRepositoryConfigurationSourceSupport
{
AbstractRepositoryConfigurationSourceSupport
{
@Override
@Override
protected
AnnotationRepositoryConfigurationSource
getConfigurationSource
()
{
protected
Class
<?
extends
Annotation
>
getAnnotation
()
{
return
getConfigurationSource
(
EnableMongoRepositoriesConfiguration
.
class
,
return
EnableMongoRepositories
.
class
;
EnableMongoRepositories
.
class
);
}
@Override
protected
Class
<?>
getConfiguration
()
{
return
EnableMongoRepositoriesConfiguration
.
class
;
}
}
@Override
@Override
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java
View file @
9a529b41
...
@@ -41,11 +41,11 @@ public class JmsTemplateAutoConfiguration {
...
@@ -41,11 +41,11 @@ public class JmsTemplateAutoConfiguration {
protected
static
class
JmsTemplateCreator
{
protected
static
class
JmsTemplateCreator
{
@Autowired
@Autowired
ConnectionFactory
connectionFactory
;
private
ConnectionFactory
connectionFactory
;
@Bean
@Bean
public
JmsTemplate
jmsTemplate
()
{
public
JmsTemplate
jmsTemplate
()
{
JmsTemplate
jmsTemplate
=
new
JmsTemplate
(
connectionFactory
);
JmsTemplate
jmsTemplate
=
new
JmsTemplate
(
this
.
connectionFactory
);
jmsTemplate
.
setPubSubDomain
(
true
);
jmsTemplate
.
setPubSubDomain
(
true
);
return
jmsTemplate
;
return
jmsTemplate
;
}
}
...
@@ -56,10 +56,12 @@ public class JmsTemplateAutoConfiguration {
...
@@ -56,10 +56,12 @@ public class JmsTemplateAutoConfiguration {
@ConditionalOnClass
(
ActiveMQConnectionFactory
.
class
)
@ConditionalOnClass
(
ActiveMQConnectionFactory
.
class
)
@ConditionalOnMissingBean
(
ConnectionFactory
.
class
)
@ConditionalOnMissingBean
(
ConnectionFactory
.
class
)
protected
static
class
ActiveMQConnectionFactoryCreator
{
protected
static
class
ActiveMQConnectionFactoryCreator
{
@Bean
@Bean
ConnectionFactory
connectionFactory
()
{
ConnectionFactory
connectionFactory
()
{
return
new
ActiveMQConnectionFactory
(
"vm://localhost"
);
return
new
ActiveMQConnectionFactory
(
"vm://localhost"
);
}
}
}
}
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfigurationTests.java
View file @
9a529b41
...
@@ -16,11 +16,6 @@
...
@@ -16,11 +16,6 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
jms
;
package
org
.
springframework
.
boot
.
autoconfigure
.
jms
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
javax.jms.ConnectionFactory
;
import
javax.jms.ConnectionFactory
;
import
org.apache.activemq.ActiveMQConnectionFactory
;
import
org.apache.activemq.ActiveMQConnectionFactory
;
...
@@ -32,6 +27,11 @@ import org.springframework.context.annotation.Bean;
...
@@ -32,6 +27,11 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.jms.core.JmsTemplate
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
/**
* Tests for {@link JmsTemplateAutoConfiguration}.
* Tests for {@link JmsTemplateAutoConfiguration}.
*
*
...
@@ -55,10 +55,6 @@ public class JmsTemplateAutoConfigurationTests {
...
@@ -55,10 +55,6 @@ public class JmsTemplateAutoConfigurationTests {
assertEquals
(
jmsTemplate
.
getConnectionFactory
(),
connectionFactory
);
assertEquals
(
jmsTemplate
.
getConnectionFactory
(),
connectionFactory
);
}
}
@Configuration
protected
static
class
TestConfiguration
{
}
@Test
@Test
public
void
testConnectionFactoryBackoff
()
{
public
void
testConnectionFactoryBackoff
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
=
new
AnnotationConfigApplicationContext
();
...
@@ -69,18 +65,6 @@ public class JmsTemplateAutoConfigurationTests {
...
@@ -69,18 +65,6 @@ public class JmsTemplateAutoConfigurationTests {
.
getBrokerURL
());
.
getBrokerURL
());
}
}
@Configuration
protected
static
class
TestConfiguration2
{
@Bean
ConnectionFactory
connectionFactory
()
{
return
new
ActiveMQConnectionFactory
()
{
{
setBrokerURL
(
"foobar"
);
}
};
}
}
@Test
@Test
public
void
testJmsTemplateBackoff
()
{
public
void
testJmsTemplateBackoff
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
=
new
AnnotationConfigApplicationContext
();
...
@@ -91,17 +75,6 @@ public class JmsTemplateAutoConfigurationTests {
...
@@ -91,17 +75,6 @@ public class JmsTemplateAutoConfigurationTests {
assertEquals
(
999
,
jmsTemplate
.
getPriority
());
assertEquals
(
999
,
jmsTemplate
.
getPriority
());
}
}
@Configuration
protected
static
class
TestConfiguration3
{
@Bean
JmsTemplate
jmsTemplate
(
ConnectionFactory
connectionFactory
)
{
JmsTemplate
jmsTemplate
=
new
JmsTemplate
(
connectionFactory
);
jmsTemplate
.
setPriority
(
999
);
return
jmsTemplate
;
}
}
@Test
@Test
public
void
testJmsTemplateBackoffEverything
()
{
public
void
testJmsTemplateBackoffEverything
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
=
new
AnnotationConfigApplicationContext
();
...
@@ -134,6 +107,33 @@ public class JmsTemplateAutoConfigurationTests {
...
@@ -134,6 +107,33 @@ public class JmsTemplateAutoConfigurationTests {
assertFalse
(
jmsTemplate
.
isPubSubDomain
());
assertFalse
(
jmsTemplate
.
isPubSubDomain
());
}
}
@Configuration
protected
static
class
TestConfiguration
{
}
@Configuration
protected
static
class
TestConfiguration2
{
@Bean
ConnectionFactory
connectionFactory
()
{
return
new
ActiveMQConnectionFactory
()
{
{
setBrokerURL
(
"foobar"
);
}
};
}
}
@Configuration
protected
static
class
TestConfiguration3
{
@Bean
JmsTemplate
jmsTemplate
(
ConnectionFactory
connectionFactory
)
{
JmsTemplate
jmsTemplate
=
new
JmsTemplate
(
connectionFactory
);
jmsTemplate
.
setPriority
(
999
);
return
jmsTemplate
;
}
}
@Configuration
@Configuration
protected
static
class
TestConfiguration4
implements
BeanPostProcessor
{
protected
static
class
TestConfiguration4
implements
BeanPostProcessor
{
@Override
@Override
...
@@ -152,5 +152,4 @@ public class JmsTemplateAutoConfigurationTests {
...
@@ -152,5 +152,4 @@ public class JmsTemplateAutoConfigurationTests {
return
bean
;
return
bean
;
}
}
}
}
}
}
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JdbcCompilerAutoConfiguration.java
View file @
9a529b41
...
@@ -29,6 +29,12 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer;
...
@@ -29,6 +29,12 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer;
*/
*/
public
class
JdbcCompilerAutoConfiguration
extends
CompilerAutoConfiguration
{
public
class
JdbcCompilerAutoConfiguration
extends
CompilerAutoConfiguration
{
@Override
public
boolean
matches
(
ClassNode
classNode
)
{
return
AstUtils
.
hasAtLeastOneFieldOrMethod
(
classNode
,
"JdbcTemplate"
,
"NamedParameterJdbcTemplate"
,
"DataSource"
);
}
@Override
@Override
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
{
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
{
dependencies
.
ifAnyMissingClasses
(
"org.springframework.jdbc.core.JdbcTemplate"
)
dependencies
.
ifAnyMissingClasses
(
"org.springframework.jdbc.core.JdbcTemplate"
)
...
@@ -36,12 +42,6 @@ public class JdbcCompilerAutoConfiguration extends CompilerAutoConfiguration {
...
@@ -36,12 +42,6 @@ public class JdbcCompilerAutoConfiguration extends CompilerAutoConfiguration {
dependencies
.
getProperty
(
"spring-boot.version"
));
dependencies
.
getProperty
(
"spring-boot.version"
));
}
}
@Override
public
boolean
matches
(
ClassNode
classNode
)
{
return
AstUtils
.
hasAtLeastOneFieldOrMethod
(
classNode
,
"JdbcTemplate"
,
"NamedParameterJdbcTemplate"
,
"DataSource"
);
}
@Override
@Override
public
void
applyImports
(
ImportCustomizer
imports
)
{
public
void
applyImports
(
ImportCustomizer
imports
)
{
imports
.
addStarImports
(
"org.springframework.jdbc.core"
,
imports
.
addStarImports
(
"org.springframework.jdbc.core"
,
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java
View file @
9a529b41
...
@@ -36,6 +36,12 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer;
...
@@ -36,6 +36,12 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer;
*/
*/
public
class
SpringMvcCompilerAutoConfiguration
extends
CompilerAutoConfiguration
{
public
class
SpringMvcCompilerAutoConfiguration
extends
CompilerAutoConfiguration
{
@Override
public
boolean
matches
(
ClassNode
classNode
)
{
return
AstUtils
.
hasAtLeastOneAnnotation
(
classNode
,
"Controller"
,
"RestController"
,
"EnableWebMvc"
,
"WebConfiguration"
);
}
@Override
@Override
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
{
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
{
dependencies
dependencies
...
@@ -47,12 +53,6 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio
...
@@ -47,12 +53,6 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio
dependencies
.
getProperty
(
"groovy.version"
));
dependencies
.
getProperty
(
"groovy.version"
));
}
}
@Override
public
boolean
matches
(
ClassNode
classNode
)
{
return
AstUtils
.
hasAtLeastOneAnnotation
(
classNode
,
"Controller"
,
"RestController"
,
"EnableWebMvc"
,
"WebConfiguration"
);
}
@Override
@Override
public
void
applyImports
(
ImportCustomizer
imports
)
{
public
void
applyImports
(
ImportCustomizer
imports
)
{
imports
.
addStarImports
(
"org.springframework.web.bind.annotation"
,
imports
.
addStarImports
(
"org.springframework.web.bind.annotation"
,
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/TransactionManagementCompilerAutoConfiguration.java
View file @
9a529b41
...
@@ -31,6 +31,11 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer;
...
@@ -31,6 +31,11 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer;
public
class
TransactionManagementCompilerAutoConfiguration
extends
public
class
TransactionManagementCompilerAutoConfiguration
extends
CompilerAutoConfiguration
{
CompilerAutoConfiguration
{
@Override
public
boolean
matches
(
ClassNode
classNode
)
{
return
AstUtils
.
hasAtLeastOneAnnotation
(
classNode
,
"EnableTransactionManagement"
);
}
@Override
@Override
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
{
public
void
applyDependencies
(
DependencyCustomizer
dependencies
)
{
dependencies
dependencies
...
@@ -42,11 +47,6 @@ public class TransactionManagementCompilerAutoConfiguration extends
...
@@ -42,11 +47,6 @@ public class TransactionManagementCompilerAutoConfiguration extends
dependencies
.
getProperty
(
"spring-boot.version"
));
dependencies
.
getProperty
(
"spring-boot.version"
));
}
}
@Override
public
boolean
matches
(
ClassNode
classNode
)
{
return
AstUtils
.
hasAtLeastOneAnnotation
(
classNode
,
"EnableTransactionManagement"
);
}
@Override
@Override
public
void
applyImports
(
ImportCustomizer
imports
)
{
public
void
applyImports
(
ImportCustomizer
imports
)
{
imports
.
addStarImports
(
"org.springframework.transaction.annotation"
,
imports
.
addStarImports
(
"org.springframework.transaction.annotation"
,
...
...
spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java
View file @
9a529b41
...
@@ -16,9 +16,6 @@
...
@@ -16,9 +16,6 @@
package
org
.
springframework
.
boot
.
cli
;
package
org
.
springframework
.
boot
.
cli
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.io.File
;
import
java.io.File
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Callable
;
...
@@ -36,6 +33,9 @@ import org.springframework.boot.OutputCapture;
...
@@ -36,6 +33,9 @@ import org.springframework.boot.OutputCapture;
import
org.springframework.boot.cli.command.CleanCommand
;
import
org.springframework.boot.cli.command.CleanCommand
;
import
org.springframework.boot.cli.command.RunCommand
;
import
org.springframework.boot.cli.command.RunCommand
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
/**
* Integration tests to exercise the samples.
* Integration tests to exercise the samples.
*
*
...
...
spring-boot-cli/src/test/resources/logback.xml
View file @
9a529b41
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
<!-- logger name="org.springframework.web" level="DEBUG"/-->
<!-- logger name="org.springframework.jdbc" level="DEBUG"/-->
<!-- logger name="org.springframework.jms" level="DEBUG"/-->
<!-- logger name="org.springframework.jms" level="DEBUG"/-->
</configuration>
</configuration>
spring-boot-samples/spring-boot-sample-aop/src/main/java/org/springframework/boot/sample/aop/monitor/ServiceMonitor.java
View file @
9a529b41
/*
* Copyright 2013 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
sample
.
aop
.
monitor
;
package
org
.
springframework
.
boot
.
sample
.
aop
.
monitor
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.JoinPoint
;
...
...
spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/org/springframework/boot/sample/data/mongo/Customer.java
View file @
9a529b41
/*
* Copyright 2013 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
sample
.
data
.
mongo
;
package
org
.
springframework
.
boot
.
sample
.
data
.
mongo
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.annotation.Id
;
public
class
Customer
{
public
class
Customer
{
@Id
@Id
...
...
spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/org/springframework/boot/sample/data/mongo/CustomerRepository.java
View file @
9a529b41
/*
* Copyright 2013 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
sample
.
data
.
mongo
;
package
org
.
springframework
.
boot
.
sample
.
data
.
mongo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -7,6 +23,7 @@ import org.springframework.data.mongodb.repository.MongoRepository;
...
@@ -7,6 +23,7 @@ import org.springframework.data.mongodb.repository.MongoRepository;
public
interface
CustomerRepository
extends
MongoRepository
<
Customer
,
String
>
{
public
interface
CustomerRepository
extends
MongoRepository
<
Customer
,
String
>
{
public
Customer
findByFirstName
(
String
firstName
);
public
Customer
findByFirstName
(
String
firstName
);
public
List
<
Customer
>
findByLastName
(
String
lastName
);
public
List
<
Customer
>
findByLastName
(
String
lastName
);
}
}
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