mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
Polish
This commit is contained in:
parent
7f8316708a
commit
22e397cda2
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* <p>
|
||||
* Additional configuration parameters for Jolokia can be provided by specifying
|
||||
* <code>jolokia.config. ...</code> properties. See the <a
|
||||
* <code>jolokia.config.*</code> properties. See the <a
|
||||
* href="http://jolokia.org">http://jolokia.org</a> web site for more information on
|
||||
* supported configuration parameters.
|
||||
*
|
||||
|
@ -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 <code>@Primary</code>, 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.
|
||||
* </p>
|
||||
*
|
||||
|
@ -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() {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
public class InMemoryMessageRespository implements MessageRepository {
|
||||
|
||||
private static AtomicLong counter = new AtomicLong();
|
||||
|
||||
private final ConcurrentMap<Long, Message> messages = new ConcurrentHashMap<Long, Message>();
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user