mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
This commit is contained in:
parent
fb13bf9016
commit
6025f45aa0
@ -40,14 +40,17 @@ import com.zaxxer.hikari.HikariDataSource;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @see DataSourceAutoConfiguration
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class HikariDataSourceConfiguration extends AbstractDataSourceConfiguration {
|
||||
|
||||
private String dataSourceClassName;
|
||||
|
||||
private String username;
|
||||
|
||||
private HikariDataSource pool;
|
||||
|
||||
private Properties hikari = new Properties();
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
|
@ -597,7 +597,7 @@ decrement). Metrics for all HTTP requests are automatically recorded, so if you
|
||||
|
||||
Here we can see basic `memory`, `heap`, `class loading`, `processor` and `thread pool`
|
||||
information along with some HTTP metrics. In this instance the `root` (``/'') and `/metrics`
|
||||
URLs have returned `HTTP 200` responses `20` and `3` times respectively. It also appears
|
||||
URLs have returned `HTTP 200` responses `20` and `3` times respectively. It also appears
|
||||
that the `root` URL returned `HTTP 401` (unauthorized) `4` times.
|
||||
|
||||
The `gauge` shows the last response time for a request. So the last request to `root` took
|
||||
|
@ -16,9 +16,6 @@
|
||||
|
||||
package sample.simple;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -26,6 +23,9 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Tests for {@link SampleSimpleApplication}.
|
||||
*
|
||||
@ -40,9 +40,9 @@ public class SpringTestSampleSimpleApplicationTests {
|
||||
|
||||
@Test
|
||||
public void testContextLoads() throws Exception {
|
||||
assertNotNull(ctx);
|
||||
assertTrue(ctx.containsBean("helloWorldService"));
|
||||
assertTrue(ctx.containsBean("sampleSimpleApplication"));
|
||||
assertNotNull(this.ctx);
|
||||
assertTrue(this.ctx.containsBean("helloWorldService"));
|
||||
assertTrue(this.ctx.containsBean("sampleSimpleApplication"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -101,19 +101,19 @@ public abstract class ExecutableArchiveLauncher extends Launcher {
|
||||
}
|
||||
|
||||
private static ClassLoader getDefaultClassLoader() {
|
||||
ClassLoader cl = null;
|
||||
ClassLoader classloader = null;
|
||||
try {
|
||||
cl = Thread.currentThread().getContextClassLoader();
|
||||
classloader = Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
// Cannot access thread context ClassLoader - falling back to system class
|
||||
// loader...
|
||||
}
|
||||
if (cl == null) {
|
||||
if (classloader == null) {
|
||||
// No thread context class loader -> use class loader of this class.
|
||||
cl = ExecutableArchiveLauncher.class.getClassLoader();
|
||||
classloader = ExecutableArchiveLauncher.class.getClassLoader();
|
||||
}
|
||||
return cl;
|
||||
return classloader;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import java.util.jar.Manifest;
|
||||
|
||||
/**
|
||||
* {@link java.net.JarURLConnection} used to support {@link JarFile#getUrl()}.
|
||||
*
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
class JarURLConnection extends java.net.JarURLConnection {
|
||||
|
@ -459,7 +459,6 @@ public class SpringApplication {
|
||||
* content from the Environment (banner.location and banner.charset). The defaults are
|
||||
* banner.location=classpath:banner.txt, banner.charest=UTF-8. If the banner file does
|
||||
* not exist or cannot be printed, a simple default is created.
|
||||
*
|
||||
* @see #setShowBanner(boolean)
|
||||
* @see #printBanner()
|
||||
*/
|
||||
@ -476,9 +475,9 @@ public class SpringApplication {
|
||||
Charset.forName("UTF-8"))));
|
||||
return;
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println("Banner not printable: " + resource + " ("
|
||||
+ e.getClass() + ": '" + e.getMessage() + "')");
|
||||
catch (Exception ex) {
|
||||
this.log.warn("Banner not printable: " + resource + " (" + ex.getClass()
|
||||
+ ": '" + ex.getMessage() + "')", ex);
|
||||
}
|
||||
}
|
||||
printBanner();
|
||||
@ -488,6 +487,7 @@ public class SpringApplication {
|
||||
* Print a simple banner message to the console. Subclasses can override this method
|
||||
* to provide additional or alternative banners.
|
||||
* @see #setShowBanner(boolean)
|
||||
* @see #printBanner(Environment)
|
||||
*/
|
||||
protected void printBanner() {
|
||||
Banner.write(System.out);
|
||||
|
Loading…
Reference in New Issue
Block a user