diff --git a/spring-boot-cli/samples/book.groovy b/spring-boot-cli/samples/book.groovy index ca50f38075..0d3192b66f 100644 --- a/spring-boot-cli/samples/book.groovy +++ b/spring-boot-cli/samples/book.groovy @@ -1,4 +1,4 @@ class Book { - String author - String title -} \ No newline at end of file + String author + String title +} diff --git a/spring-boot-cli/samples/book_and_tests.groovy b/spring-boot-cli/samples/book_and_tests.groovy index 7283392946..8424fe5344 100644 --- a/spring-boot-cli/samples/book_and_tests.groovy +++ b/spring-boot-cli/samples/book_and_tests.groovy @@ -1,12 +1,12 @@ class Book { - String author - String title + String author + String title } class BookTests { - @Test - void testBooks() { - Book book = new Book(author: "Tom Clancy", title: "Threat Vector") - assertEquals("Tom Clancy", book.author) - } -} \ No newline at end of file + @Test + void testBooks() { + Book book = new Book(author: "Tom Clancy", title: "Threat Vector") + assertEquals("Tom Clancy", book.author) + } +} diff --git a/spring-boot-cli/samples/failures.groovy b/spring-boot-cli/samples/failures.groovy index 8f9f60909e..ffb7bfc421 100644 --- a/spring-boot-cli/samples/failures.groovy +++ b/spring-boot-cli/samples/failures.groovy @@ -33,5 +33,4 @@ class FailingSpockTest extends Specification { //throw new RuntimeException("This should fail!") true == false } - -} \ No newline at end of file +} diff --git a/spring-boot-cli/samples/jms.groovy b/spring-boot-cli/samples/jms.groovy index 998bbc450b..7e681413ec 100644 --- a/spring-boot-cli/samples/jms.groovy +++ b/spring-boot-cli/samples/jms.groovy @@ -34,15 +34,13 @@ class JmsExample implements CommandLineRunner { jmsTemplate.send("spring-boot", messageCreator) latch.await() } - } @Log class Receiver { CountDownLatch latch - - def receive(String message) { - log.info "Received ${message}" - latch.countDown() - } + def receive(String message) { + log.info "Received ${message}" + latch.countDown() + } } diff --git a/spring-boot-cli/samples/job.groovy b/spring-boot-cli/samples/job.groovy index d6a49ec859..10199893b5 100644 --- a/spring-boot-cli/samples/job.groovy +++ b/spring-boot-cli/samples/job.groovy @@ -13,12 +13,12 @@ class JobConfig { @Bean protected Tasklet tasklet() { - return new Tasklet() { - @Override - RepeatStatus execute(StepContribution contribution, ChunkContext context) { - return RepeatStatus.FINISHED - } - } + return new Tasklet() { + @Override + RepeatStatus execute(StepContribution contribution, ChunkContext context) { + return RepeatStatus.FINISHED + } + } } @Bean @@ -31,5 +31,3 @@ class JobConfig { return steps.get("step1").tasklet(tasklet()).build() } } - - diff --git a/spring-boot-cli/samples/rabbit.groovy b/spring-boot-cli/samples/rabbit.groovy index 2a307074ae..87ac1c2a38 100644 --- a/spring-boot-cli/samples/rabbit.groovy +++ b/spring-boot-cli/samples/rabbit.groovy @@ -7,58 +7,57 @@ import java.util.concurrent.CountDownLatch @EnableRabbitMessaging class RabbitExample implements CommandLineRunner { - private CountDownLatch latch = new CountDownLatch(1) + private CountDownLatch latch = new CountDownLatch(1) - @Autowired - RabbitTemplate rabbitTemplate + @Autowired + RabbitTemplate rabbitTemplate - private String queueName = "spring-boot" + private String queueName = "spring-boot" - @Bean - Queue queue() { - new Queue(queueName, false) - } + @Bean + Queue queue() { + new Queue(queueName, false) + } - @Bean - TopicExchange exchange() { - new TopicExchange("spring-boot-exchange") - } + @Bean + TopicExchange exchange() { + new TopicExchange("spring-boot-exchange") + } - /** - * The queue and topic exchange cannot be inlined inside this method and have - * dynamic creation with Spring AMQP work properly. - */ - @Bean - Binding binding(Queue queue, TopicExchange exchange) { - BindingBuilder - .bind(queue) - .to(exchange) - .with("spring-boot") - } + /** + * The queue and topic exchange cannot be inlined inside this method and have + * dynamic creation with Spring AMQP work properly. + */ + @Bean + Binding binding(Queue queue, TopicExchange exchange) { + BindingBuilder + .bind(queue) + .to(exchange) + .with("spring-boot") + } - @Bean - SimpleMessageListenerContainer container(CachingConnectionFactory connectionFactory) { - return new SimpleMessageListenerContainer( - connectionFactory: connectionFactory, - queueNames: [queueName], - messageListener: new MessageListenerAdapter(new Receiver(latch:latch), "receive") - ) - } - - void run(String... args) { - log.info "Sending RabbitMQ message..." - rabbitTemplate.convertAndSend(queueName, "Greetings from Spring Boot via RabbitMQ") - latch.await() - } + @Bean + SimpleMessageListenerContainer container(CachingConnectionFactory connectionFactory) { + return new SimpleMessageListenerContainer( + connectionFactory: connectionFactory, + queueNames: [queueName], + messageListener: new MessageListenerAdapter(new Receiver(latch:latch), "receive") + ) + } + void run(String... args) { + log.info "Sending RabbitMQ message..." + rabbitTemplate.convertAndSend(queueName, "Greetings from Spring Boot via RabbitMQ") + latch.await() + } } @Log class Receiver { - CountDownLatch latch + CountDownLatch latch - def receive(String message) { - log.info "Received ${message}" - latch.countDown() - } + def receive(String message) { + log.info "Received ${message}" + latch.countDown() + } } diff --git a/spring-boot-cli/samples/reactor.groovy b/spring-boot-cli/samples/reactor.groovy index d64c75dfca..49a4585b3a 100644 --- a/spring-boot-cli/samples/reactor.groovy +++ b/spring-boot-cli/samples/reactor.groovy @@ -5,12 +5,12 @@ import java.util.concurrent.CountDownLatch; @EnableReactor @Log class Runner implements CommandLineRunner { - + @Autowired Reactor reactor - + private CountDownLatch latch = new CountDownLatch(1) - + @PostConstruct void init() { log.info "Registering consumer" @@ -21,12 +21,10 @@ class Runner implements CommandLineRunner { log.info "Notified Phil" latch.await() } - + @Selector(reactor="reactor", value="hello") void receive(String data) { log.info "Hello ${data}" latch.countDown() - } + } } - - diff --git a/spring-boot-cli/samples/runner.groovy b/spring-boot-cli/samples/runner.groovy index a5598ac968..0fc79fa310 100644 --- a/spring-boot-cli/samples/runner.groovy +++ b/spring-boot-cli/samples/runner.groovy @@ -6,5 +6,3 @@ class Runner implements CommandLineRunner { print "Hello World!" } } - - diff --git a/spring-boot-cli/samples/spock.groovy b/spring-boot-cli/samples/spock.groovy index 360649bf61..1bfcdb8814 100644 --- a/spring-boot-cli/samples/spock.groovy +++ b/spring-boot-cli/samples/spock.groovy @@ -1,12 +1,12 @@ class HelloSpock extends Specification { - def "length of Spock's and his friends' names"() { - expect: - name.size() == length + def "length of Spock's and his friends' names"() { + expect: + name.size() == length - where: - name | length - "Spock" | 5 - "Kirk" | 4 - "Scotty" | 6 - } -} \ No newline at end of file + where: + name | length + "Spock" | 5 + "Kirk" | 4 + "Scotty" | 6 + } +} diff --git a/spring-boot-cli/samples/template.groovy b/spring-boot-cli/samples/template.groovy index 8ed16759c6..0bfc873e32 100644 --- a/spring-boot-cli/samples/template.groovy +++ b/spring-boot-cli/samples/template.groovy @@ -21,5 +21,3 @@ class MyService { return "World" } } - - diff --git a/spring-boot-cli/samples/test.groovy b/spring-boot-cli/samples/test.groovy index cdd00a5999..a08b866885 100644 --- a/spring-boot-cli/samples/test.groovy +++ b/spring-boot-cli/samples/test.groovy @@ -1,7 +1,7 @@ class BookTests { - @Test - void testBooks() { - Book book = new Book(author: "Tom Clancy", title: "Threat Vector") - assertEquals("Tom Clancy", book.author) - } -} \ No newline at end of file + @Test + void testBooks() { + Book book = new Book(author: "Tom Clancy", title: "Threat Vector") + assertEquals("Tom Clancy", book.author) + } +} diff --git a/spring-boot-cli/samples/tx.groovy b/spring-boot-cli/samples/tx.groovy index 09e2c59d32..0627294671 100644 --- a/spring-boot-cli/samples/tx.groovy +++ b/spring-boot-cli/samples/tx.groovy @@ -6,13 +6,12 @@ package org.test @EnableTransactionManagement class Example implements CommandLineRunner { - @Autowired - JdbcTemplate jdbcTemplate - - @Transactional - void run(String... args) { - println "Foo count=" + jdbcTemplate.queryForObject("SELECT COUNT(*) from FOO", Integer) - } + @Autowired + JdbcTemplate jdbcTemplate + @Transactional + void run(String... args) { + println "Foo count=" + jdbcTemplate.queryForObject("SELECT COUNT(*) from FOO", Integer) + } } diff --git a/spring-boot-cli/samples/web.groovy b/spring-boot-cli/samples/web.groovy index 50535186f4..b7f2df2698 100644 --- a/spring-boot-cli/samples/web.groovy +++ b/spring-boot-cli/samples/web.groovy @@ -19,5 +19,3 @@ class MyService { return "World!"; } } - - diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java index c14179b411..0253a8ee88 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java @@ -63,12 +63,19 @@ import org.springframework.core.io.ResourceLoader; public class SpringApplicationBuilder { private SpringApplication application; + private ConfigurableApplicationContext context; + private SpringApplicationBuilder parent; + private AtomicBoolean running = new AtomicBoolean(false); + private Set sources = new LinkedHashSet(); + private Map defaultProperties = new LinkedHashMap(); + private ConfigurableEnvironment environment; + private Set additionalProfiles = new LinkedHashSet(); private Set> initializers = new LinkedHashSet>();