From 22e397cda29bbfe89c0da01341d5b3fb7514ed11 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sat, 8 Mar 2014 21:38:09 -0800 Subject: [PATCH] Polish --- .../EndpointAutoConfiguration.java | 7 ++++ .../JolokiaAutoConfiguration.java | 2 +- .../MetricRepositoryAutoConfiguration.java | 2 +- .../autoconfigure/jms/ActiveMQProperties.java | 11 +++--- .../jms/JmsTemplateAutoConfiguration.java | 21 ++---------- .../jms/JmsTemplateProperties.java | 34 +++++++++++++++++++ .../sample/ui/InMemoryMessageRespository.java | 1 + 7 files changed, 52 insertions(+), 26 deletions(-) create mode 100644 spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateProperties.java diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java index cb56202b5d..f2f3744260 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java @@ -187,6 +187,7 @@ public class EndpointAutoConfiguration { @Autowired private final ConfigurableEnvironment environment = new StandardEnvironment(); + @Value("${spring.git.properties:classpath:git.properties}") private Resource gitProperties; @@ -213,7 +214,9 @@ public class EndpointAutoConfiguration { } public static class GitInfo { + private String branch; + private final Commit commit = new Commit(); public String getBranch() { @@ -229,7 +232,9 @@ public class EndpointAutoConfiguration { } public static class Commit { + private String id; + private String time; public String getId() { @@ -248,7 +253,9 @@ public class EndpointAutoConfiguration { public void setTime(String time) { this.time = time; } + } + } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java index c446666233..de182015cb 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java @@ -44,7 +44,7 @@ import org.springframework.context.annotation.Configuration; * *

* Additional configuration parameters for Jolokia can be provided by specifying - * jolokia.config. ... properties. See the jolokia.config.* properties. See the http://jolokia.org web site for more information on * supported configuration parameters. * diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java index 89f21e9b3f..71569526c6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java @@ -75,7 +75,7 @@ import com.codahale.metrics.MetricRegistry; * By default all metric updates go to all {@link MetricWriter} instances in the * application context. To change this behaviour define your own metric writer bean called * "primaryMetricWriter", mark it @Primary, and this one will receive all - * updates from the default counter and gauge services. ALternatively you can provide your + * updates from the default counter and gauge services. Alternatively you can provide your * own counter and gauge services and wire them to whichever writer you choose. *

* diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQProperties.java index a2c1df3292..15afdeff9b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQProperties.java @@ -20,27 +20,28 @@ import org.springframework.boot.context.properties.ConfigurationProperties; /** * Configuration properties for ActiveMQ + * * @author Greg Turnquist */ @ConfigurationProperties(name = "spring.activemq") public class ActiveMQProperties { - private String brokerURL = "tcp://localhost:61616"; + private String brokerUrl = "tcp://localhost:61616"; private boolean inMemory = true; private boolean pooled = false; // Will override brokerURL if inMemory is set to true - public String getBrokerURL() { + public String getBrokerUrl() { if (this.inMemory) { return "vm://localhost"; } - return this.brokerURL; + return this.brokerUrl; } - public void setBrokerURL(String brokerURL) { - this.brokerURL = brokerURL; + public void setBrokerUrl(String brokerUrl) { + this.brokerUrl = brokerUrl; } public boolean isInMemory() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java index 8c6c117c3a..d59949bf73 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java @@ -24,8 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.jms.JmsTemplateAutoConfiguration.JmsTemplateProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -55,21 +53,6 @@ public class JmsTemplateAutoConfiguration { return jmsTemplate; } - @ConfigurationProperties(name = "spring.jms") - public static class JmsTemplateProperties { - - private boolean pubSubDomain = true; - - public boolean isPubSubDomain() { - return this.pubSubDomain; - } - - public void setPubSubDomain(boolean pubSubDomain) { - this.pubSubDomain = pubSubDomain; - } - - } - @Configuration @ConditionalOnClass(ActiveMQConnectionFactory.class) @ConditionalOnMissingBean(ConnectionFactory.class) @@ -84,10 +67,10 @@ public class JmsTemplateAutoConfiguration { if (this.config.isPooled()) { PooledConnectionFactory pool = new PooledConnectionFactory(); pool.setConnectionFactory(new ActiveMQConnectionFactory(this.config - .getBrokerURL())); + .getBrokerUrl())); return pool; } - return new ActiveMQConnectionFactory(this.config.getBrokerURL()); + return new ActiveMQConnectionFactory(this.config.getBrokerUrl()); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateProperties.java new file mode 100644 index 0000000000..a9235ea7c6 --- /dev/null +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateProperties.java @@ -0,0 +1,34 @@ +/* + * Copyright 2012-2014 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.autoconfigure.jms; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(name = "spring.jms") +public class JmsTemplateProperties { + + private boolean pubSubDomain = true; + + public boolean isPubSubDomain() { + return this.pubSubDomain; + } + + public void setPubSubDomain(boolean pubSubDomain) { + this.pubSubDomain = pubSubDomain; + } + +} \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/InMemoryMessageRespository.java b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/InMemoryMessageRespository.java index b112448c92..76f97d5311 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/InMemoryMessageRespository.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/ui/InMemoryMessageRespository.java @@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicLong; public class InMemoryMessageRespository implements MessageRepository { private static AtomicLong counter = new AtomicLong(); + private final ConcurrentMap messages = new ConcurrentHashMap(); @Override