Commit 6025f45a authored by Phillip Webb's avatar Phillip Webb

Polish

parent fb13bf90
...@@ -40,14 +40,17 @@ import com.zaxxer.hikari.HikariDataSource; ...@@ -40,14 +40,17 @@ import com.zaxxer.hikari.HikariDataSource;
* *
* @author Dave Syer * @author Dave Syer
* @see DataSourceAutoConfiguration * @see DataSourceAutoConfiguration
* @since 1.1.0
*/ */
@Configuration @Configuration
public class HikariDataSourceConfiguration extends AbstractDataSourceConfiguration { public class HikariDataSourceConfiguration extends AbstractDataSourceConfiguration {
private String dataSourceClassName; private String dataSourceClassName;
private String username; private String username;
private HikariDataSource pool; private HikariDataSource pool;
private Properties hikari = new Properties(); private Properties hikari = new Properties();
@Bean(destroyMethod = "shutdown") @Bean(destroyMethod = "shutdown")
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
package sample.simple; package sample.simple;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -26,6 +23,9 @@ import org.springframework.boot.test.SpringApplicationConfiguration; ...@@ -26,6 +23,9 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/** /**
* Tests for {@link SampleSimpleApplication}. * Tests for {@link SampleSimpleApplication}.
* *
...@@ -40,9 +40,9 @@ public class SpringTestSampleSimpleApplicationTests { ...@@ -40,9 +40,9 @@ public class SpringTestSampleSimpleApplicationTests {
@Test @Test
public void testContextLoads() throws Exception { public void testContextLoads() throws Exception {
assertNotNull(ctx); assertNotNull(this.ctx);
assertTrue(ctx.containsBean("helloWorldService")); assertTrue(this.ctx.containsBean("helloWorldService"));
assertTrue(ctx.containsBean("sampleSimpleApplication")); assertTrue(this.ctx.containsBean("sampleSimpleApplication"));
} }
} }
...@@ -101,19 +101,19 @@ public abstract class ExecutableArchiveLauncher extends Launcher { ...@@ -101,19 +101,19 @@ public abstract class ExecutableArchiveLauncher extends Launcher {
} }
private static ClassLoader getDefaultClassLoader() { private static ClassLoader getDefaultClassLoader() {
ClassLoader cl = null; ClassLoader classloader = null;
try { try {
cl = Thread.currentThread().getContextClassLoader(); classloader = Thread.currentThread().getContextClassLoader();
} }
catch (Throwable ex) { catch (Throwable ex) {
// Cannot access thread context ClassLoader - falling back to system class // Cannot access thread context ClassLoader - falling back to system class
// loader... // loader...
} }
if (cl == null) { if (classloader == null) {
// No thread context class loader -> use class loader of this class. // No thread context class loader -> use class loader of this class.
cl = ExecutableArchiveLauncher.class.getClassLoader(); classloader = ExecutableArchiveLauncher.class.getClassLoader();
} }
return cl; return classloader;
} }
} }
...@@ -459,7 +459,6 @@ public class SpringApplication { ...@@ -459,7 +459,6 @@ public class SpringApplication {
* content from the Environment (banner.location and banner.charset). The defaults are * 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 * 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. * not exist or cannot be printed, a simple default is created.
*
* @see #setShowBanner(boolean) * @see #setShowBanner(boolean)
* @see #printBanner() * @see #printBanner()
*/ */
...@@ -476,9 +475,9 @@ public class SpringApplication { ...@@ -476,9 +475,9 @@ public class SpringApplication {
Charset.forName("UTF-8")))); Charset.forName("UTF-8"))));
return; return;
} }
catch (Exception e) { catch (Exception ex) {
System.out.println("Banner not printable: " + resource + " (" this.log.warn("Banner not printable: " + resource + " (" + ex.getClass()
+ e.getClass() + ": '" + e.getMessage() + "')"); + ": '" + ex.getMessage() + "')", ex);
} }
} }
printBanner(); printBanner();
...@@ -488,6 +487,7 @@ public class SpringApplication { ...@@ -488,6 +487,7 @@ public class SpringApplication {
* Print a simple banner message to the console. Subclasses can override this method * Print a simple banner message to the console. Subclasses can override this method
* to provide additional or alternative banners. * to provide additional or alternative banners.
* @see #setShowBanner(boolean) * @see #setShowBanner(boolean)
* @see #printBanner(Environment)
*/ */
protected void printBanner() { protected void printBanner() {
Banner.write(System.out); Banner.write(System.out);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment