mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Polish
This commit is contained in:
parent
63de33ef3e
commit
3193913899
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* 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.
|
||||
@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure;
|
||||
|
||||
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
|
||||
import static org.springframework.util.StringUtils.trimAllWhitespace;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.bind.RelaxedPropertyResolver;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
@ -31,9 +28,12 @@ import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
|
||||
import static org.springframework.util.StringUtils.trimAllWhitespace;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
@ -53,7 +53,8 @@ public class MessageSourceAutoConfiguration implements EnvironmentAware {
|
||||
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
|
||||
String basename = this.environment.getProperty("basename", "messages");
|
||||
if (StringUtils.hasText(basename)) {
|
||||
messageSource.setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(basename)));
|
||||
messageSource
|
||||
.setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(basename)));
|
||||
}
|
||||
String encoding = this.environment.getProperty("encoding", "utf-8");
|
||||
messageSource.setDefaultEncoding(encoding);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* 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.
|
||||
@ -16,17 +16,17 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.EnvironmentTestUtils;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests for {@link MessageSourceAutoConfiguration}.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class MessageSourceAutoConfigurationTests {
|
||||
|
@ -1,5 +1,5 @@
|
||||
= Spring Boot Reference Guide
|
||||
Phillip Webb; Dave Syer; Josh Long;
|
||||
Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll;
|
||||
:doctype: book
|
||||
:toc:
|
||||
:toclevels: 4
|
||||
|
@ -468,7 +468,7 @@ download and install http://www.putty.org/[PuTTY].
|
||||
----
|
||||
|
||||
Type `help` for a list of commands. Spring boot provides `metrics`, `beans`, `autoconfig`
|
||||
and `endpoint` commands.
|
||||
and `endpoint` commands.
|
||||
|
||||
|
||||
|
||||
|
@ -24,8 +24,8 @@ class endpoint {
|
||||
|
||||
// Don't require passed argument to end with 'Endpoint'
|
||||
if (!name.endsWith("Endpoint")) {
|
||||
name = name + "Endpoint"
|
||||
}
|
||||
name = name + "Endpoint"
|
||||
}
|
||||
|
||||
context.attributes['spring.beanfactory'].getBeansOfType(Endpoint.class).each { n, endpoint ->
|
||||
if (n.equals(name) && endpoint.isEnabled()) {
|
||||
|
@ -1,20 +1,20 @@
|
||||
welcome = { ->
|
||||
if (!crash.context.attributes['spring.environment'].getProperty("spring.main.show_banner", Boolean.class, Boolean.TRUE)) {
|
||||
return ""
|
||||
}
|
||||
if (!crash.context.attributes['spring.environment'].getProperty("spring.main.show_banner", Boolean.class, Boolean.TRUE)) {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Resolve hostname
|
||||
def hostName;
|
||||
try {
|
||||
hostName = java.net.InetAddress.getLocalHost().getHostName();
|
||||
} catch (java.net.UnknownHostException ignore) {
|
||||
hostName = "localhost";
|
||||
}
|
||||
// Resolve hostname
|
||||
def hostName;
|
||||
try {
|
||||
hostName = java.net.InetAddress.getLocalHost().getHostName();
|
||||
} catch (java.net.UnknownHostException ignore) {
|
||||
hostName = "localhost";
|
||||
}
|
||||
|
||||
// Get Spring Boot version from context
|
||||
def version = crash.context.attributes.get("spring.boot.version")
|
||||
Get Spring Boot version from context
|
||||
def version = crash.context.attributes.get("spring.boot.version")
|
||||
|
||||
return """\
|
||||
return """\
|
||||
. ____ _ __ _ _
|
||||
/\\\\ / ___'_ __ _ _(_)_ __ __ _ \\ \\ \\ \\
|
||||
( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\
|
||||
@ -26,5 +26,5 @@ welcome = { ->
|
||||
}
|
||||
|
||||
prompt = { ->
|
||||
return "> ";
|
||||
return "> ";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user