Commit 1bcd3de7 authored by Phillip Webb's avatar Phillip Webb

Polish

parent 0f9c7059
...@@ -200,7 +200,7 @@ webapp or service: ...@@ -200,7 +200,7 @@ webapp or service:
<artifactId>spring-boot-starter-jetty</artifactId> <artifactId>spring-boot-starter-jetty</artifactId>
</dependency </dependency
</dependencies> </dependencies>
## Terminate SSL in Tomcat ## Terminate SSL in Tomcat
...@@ -818,7 +818,7 @@ change the behaviour: ...@@ -818,7 +818,7 @@ change the behaviour:
classpath resource or a URL). A separate `Environment` property classpath resource or a URL). A separate `Environment` property
source is set up for this document and it can be overridden by source is set up for this document and it can be overridden by
system properties, environment variables or the command line. system properties, environment variables or the command line.
No matter what you set in the environment, Spring Boot will always No matter what you set in the environment, Spring Boot will always
load `application.properties` as described above. If YAML is used then load `application.properties` as described above. If YAML is used then
files with the ".yml" extension are also added to the list by default. files with the ".yml" extension are also added to the list by default.
...@@ -942,4 +942,4 @@ it with ...@@ -942,4 +942,4 @@ it with
after which you can run the application with after which you can run the application with
$ java -jar target/*.jar $ java -jar target/*.jar
...@@ -55,6 +55,7 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T> { ...@@ -55,6 +55,7 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T> {
this.id = id; this.id = id;
} }
@Override
public boolean isEnabled() { public boolean isEnabled() {
return this.enabled; return this.enabled;
} }
......
...@@ -186,14 +186,17 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc ...@@ -186,14 +186,17 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc
// SmartLifeCycle implementation // SmartLifeCycle implementation
@Override
public final int getPhase() { public final int getPhase() {
return this.phase; return this.phase;
} }
@Override
public final boolean isAutoStartup() { public final boolean isAutoStartup() {
return this.autoStartup; return this.autoStartup;
} }
@Override
public final boolean isRunning() { public final boolean isRunning() {
this.lifecycleLock.lock(); this.lifecycleLock.lock();
try { try {
...@@ -204,6 +207,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc ...@@ -204,6 +207,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc
} }
} }
@Override
public final void start() { public final void start() {
this.lifecycleLock.lock(); this.lifecycleLock.lock();
try { try {
...@@ -217,6 +221,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc ...@@ -217,6 +221,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc
} }
} }
@Override
public final void stop() { public final void stop() {
this.lifecycleLock.lock(); this.lifecycleLock.lock();
try { try {
...@@ -229,6 +234,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc ...@@ -229,6 +234,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc
} }
} }
@Override
public final void stop(Runnable callback) { public final void stop(Runnable callback) {
this.lifecycleLock.lock(); this.lifecycleLock.lock();
try { try {
......
...@@ -68,6 +68,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, ...@@ -68,6 +68,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
this.controller.afterPropertiesSet(); this.controller.afterPropertiesSet();
} }
@Override
public void setServletContext(ServletContext servletContext) { public void setServletContext(ServletContext servletContext) {
this.controller.setServletContext(servletContext); this.controller.setServletContext(servletContext);
} }
...@@ -76,6 +77,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, ...@@ -76,6 +77,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
this.controller.setInitParameters(initParameters); this.controller.setInitParameters(initParameters);
} }
@Override
public final void setApplicationContext(ApplicationContext context) public final void setApplicationContext(ApplicationContext context)
throws BeansException { throws BeansException {
this.controller.setApplicationContext(context); this.controller.setApplicationContext(context);
......
...@@ -34,6 +34,8 @@ import static org.mockito.Mockito.verify; ...@@ -34,6 +34,8 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
/** /**
* Tests for {@link SimpleHealthIndicator}.
*
* @author Dave Syer * @author Dave Syer
*/ */
public class SimpleHealthIndicatorTests { public class SimpleHealthIndicatorTests {
......
...@@ -73,7 +73,8 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware, Environm ...@@ -73,7 +73,8 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware, Environm
@Bean @Bean
@ConditionalOnMissingBean(EntityManagerFactoryInfo.class) @ConditionalOnMissingBean(EntityManagerFactoryInfo.class)
public LocalContainerEntityManagerFactoryBean entityManagerFactory(JpaVendorAdapter jpaVendorAdapter) { public LocalContainerEntityManagerFactoryBean entityManagerFactory(
JpaVendorAdapter jpaVendorAdapter) {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter); entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter);
entityManagerFactoryBean.setDataSource(getDataSource()); entityManagerFactoryBean.setDataSource(getDataSource());
......
...@@ -137,10 +137,8 @@ public abstract class AbstractJpaAutoConfigurationTests { ...@@ -137,10 +137,8 @@ public abstract class AbstractJpaAutoConfigurationTests {
@Test @Test
public void usesManuallyDefinedEntityManagerFactoryBeanIfAvailable() { public void usesManuallyDefinedEntityManagerFactoryBeanIfAvailable() {
setupTestConfiguration(TestConfigurationWithEntityManagerFactory.class); setupTestConfiguration(TestConfigurationWithEntityManagerFactory.class);
this.context.refresh(); this.context.refresh();
LocalContainerEntityManagerFactoryBean factoryBean = this.context LocalContainerEntityManagerFactoryBean factoryBean = this.context
.getBean(LocalContainerEntityManagerFactoryBean.class); .getBean(LocalContainerEntityManagerFactoryBean.class);
Map<String, Object> map = factoryBean.getJpaPropertyMap(); Map<String, Object> map = factoryBean.getJpaPropertyMap();
...@@ -149,10 +147,8 @@ public abstract class AbstractJpaAutoConfigurationTests { ...@@ -149,10 +147,8 @@ public abstract class AbstractJpaAutoConfigurationTests {
@Test @Test
public void usesManuallyDefinedTransactionManagerBeanIfAvailable() { public void usesManuallyDefinedTransactionManagerBeanIfAvailable() {
setupTestConfiguration(TestConfigurationWithTransactionManager.class); setupTestConfiguration(TestConfigurationWithTransactionManager.class);
this.context.refresh(); this.context.refresh();
PlatformTransactionManager txManager = this.context PlatformTransactionManager txManager = this.context
.getBean(PlatformTransactionManager.class); .getBean(PlatformTransactionManager.class);
assertThat(txManager, instanceOf(CustomJpaTransactionManager.class)); assertThat(txManager, instanceOf(CustomJpaTransactionManager.class));
......
...@@ -8,7 +8,7 @@ class SpringIntegrationExample implements CommandLineRunner { ...@@ -8,7 +8,7 @@ class SpringIntegrationExample implements CommandLineRunner {
DirectChannel input() { DirectChannel input() {
new DirectChannel(); new DirectChannel();
} }
@Override @Override
void run(String... args) { void run(String... args) {
print new MessagingTemplate(input()).convertSendAndReceive("World") print new MessagingTemplate(input()).convertSendAndReceive("World")
...@@ -23,4 +23,4 @@ class HelloTransformer { ...@@ -23,4 +23,4 @@ class HelloTransformer {
"Hello, ${payload}" "Hello, ${payload}"
} }
} }
\ No newline at end of file
/*
* 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.cli.command; package org.springframework.boot.cli.command;
import java.io.IOException; import java.io.IOException;
......
/*
* Copyright 2012-2013 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.cli.command; package org.springframework.boot.cli.command;
import org.springframework.boot.cli.command.AbstractCommand;
/** /**
* @author Dave Syer * @author Dave Syer
...@@ -10,7 +25,8 @@ public class PromptCommand extends AbstractCommand { ...@@ -10,7 +25,8 @@ public class PromptCommand extends AbstractCommand {
private final ShellCommand runCmd; private final ShellCommand runCmd;
public PromptCommand(ShellCommand runCmd) { public PromptCommand(ShellCommand runCmd) {
super("prompt", "Change the prompt used with the current 'shell' command. Execute with no arguments to return to the previous value."); super("prompt", "Change the prompt used with the current 'shell' command. "
+ "Execute with no arguments to return to the previous value.");
this.runCmd = runCmd; this.runCmd = runCmd;
} }
...@@ -18,10 +34,11 @@ public class PromptCommand extends AbstractCommand { ...@@ -18,10 +34,11 @@ public class PromptCommand extends AbstractCommand {
public void run(String... strings) throws Exception { public void run(String... strings) throws Exception {
if (strings.length > 0) { if (strings.length > 0) {
for (String string : strings) { for (String string : strings) {
runCmd.pushPrompt(string + " "); this.runCmd.pushPrompt(string + " ");
} }
} else { }
runCmd.popPrompt(); else {
this.runCmd.popPrompt();
} }
} }
......
/*
* Copyright 2012-2013 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.cli.command; package org.springframework.boot.cli.command;
import java.io.IOException; import java.io.IOException;
...@@ -12,7 +28,8 @@ public class Shell { ...@@ -12,7 +28,8 @@ public class Shell {
public static void main(String... args) throws IOException { public static void main(String... args) throws IOException {
if (args.length == 0) { if (args.length == 0) {
SpringCli.main("shell"); // right into the REPL by default SpringCli.main("shell"); // right into the REPL by default
} else { }
else {
SpringCli.main(args); SpringCli.main(args);
} }
} }
......
/*
* Copyright 2012-2013 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.cli.command; package org.springframework.boot.cli.command;
import java.io.IOException; import java.io.IOException;
...@@ -26,8 +42,11 @@ import org.springframework.util.StringUtils; ...@@ -26,8 +42,11 @@ import org.springframework.util.StringUtils;
public class ShellCommand extends AbstractCommand { public class ShellCommand extends AbstractCommand {
private String defaultPrompt = "$ "; private String defaultPrompt = "$ ";
private SpringCli springCli; private SpringCli springCli;
private String prompt = this.defaultPrompt; private String prompt = this.defaultPrompt;
private Stack<String> prompts = new Stack<String>(); private Stack<String> prompts = new Stack<String>();
public ShellCommand(SpringCli springCli) { public ShellCommand(SpringCli springCli) {
...@@ -186,8 +205,8 @@ public class ShellCommand extends AbstractCommand { ...@@ -186,8 +205,8 @@ public class ShellCommand extends AbstractCommand {
String version = ShellCommand.class.getPackage().getImplementationVersion(); String version = ShellCommand.class.getPackage().getImplementationVersion();
version = (version == null ? "" : " (v" + version + ")"); version = (version == null ? "" : " (v" + version + ")");
System.out.println("Spring Boot CLI" + version); System.out.println("Spring Boot CLI" + version);
System.out System.out.println("Hit TAB to complete. Type 'help' and hit "
.println("Hit TAB to complete. Type 'help' and hit RETURN for help, and 'quit' to exit."); + "RETURN for help, and 'quit' to exit.");
} }
public void pushPrompt(String prompt) { public void pushPrompt(String prompt) {
......
/*
* Copyright 2012-2013 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.cli.command; package org.springframework.boot.cli.command;
import org.springframework.boot.cli.command.AbstractCommand;
import org.springframework.boot.cli.command.RunCommand;
/** /**
* @author Jon Brisbin * @author Jon Brisbin
...@@ -11,13 +25,14 @@ public class StopCommand extends AbstractCommand { ...@@ -11,13 +25,14 @@ public class StopCommand extends AbstractCommand {
private final RunCommand runCmd; private final RunCommand runCmd;
public StopCommand(RunCommand runCmd) { public StopCommand(RunCommand runCmd) {
super("stop", "Stop the currently-running application started with the 'run' command."); super("stop",
"Stop the currently-running application started with the 'run' command.");
this.runCmd = runCmd; this.runCmd = runCmd;
} }
@Override @Override
public void run(String... strings) throws Exception { public void run(String... strings) throws Exception {
runCmd.stop(); this.runCmd.stop();
} }
} }
...@@ -47,6 +47,7 @@ public final class JreProxySelector implements ProxySelector { ...@@ -47,6 +47,7 @@ public final class JreProxySelector implements ProxySelector {
public JreProxySelector() { public JreProxySelector() {
} }
@Override
public Proxy getProxy(RemoteRepository repository) { public Proxy getProxy(RemoteRepository repository) {
List<java.net.Proxy> proxies = null; List<java.net.Proxy> proxies = null;
try { try {
...@@ -95,6 +96,7 @@ public final class JreProxySelector implements ProxySelector { ...@@ -95,6 +96,7 @@ public final class JreProxySelector implements ProxySelector {
public static final Authentication INSTANCE = new JreProxyAuthentication(); public static final Authentication INSTANCE = new JreProxyAuthentication();
@Override
public void fill(AuthenticationContext context, String key, public void fill(AuthenticationContext context, String key,
Map<String, String> data) { Map<String, String> data) {
Proxy proxy = context.getProxy(); Proxy proxy = context.getProxy();
...@@ -136,6 +138,7 @@ public final class JreProxySelector implements ProxySelector { ...@@ -136,6 +138,7 @@ public final class JreProxySelector implements ProxySelector {
} }
} }
@Override
public void digest(AuthenticationDigest digest) { public void digest(AuthenticationDigest digest) {
// we don't know anything about the JRE's current authenticator, assume the // we don't know anything about the JRE's current authenticator, assume the
// worst (i.e. interactive) // worst (i.e. interactive)
......
...@@ -59,7 +59,7 @@ public class SampleActuatorNoWebApplicationTests { ...@@ -59,7 +59,7 @@ public class SampleActuatorNoWebApplicationTests {
context.close(); context.close();
} }
} }
@Test @Test
public void endpointsExist() throws Exception { public void endpointsExist() throws Exception {
assertNotNull(context.getBean(MetricsEndpoint.class)); assertNotNull(context.getBean(MetricsEndpoint.class));
......
...@@ -53,7 +53,8 @@ public class SampleSecureApplication extends WebMvcConfigurerAdapter { ...@@ -53,7 +53,8 @@ public class SampleSecureApplication extends WebMvcConfigurerAdapter {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// Set user password to "password" for demo purposes only // Set user password to "password" for demo purposes only
new SpringApplicationBuilder(SampleSecureApplication.class).properties( new SpringApplicationBuilder(SampleSecureApplication.class).properties(
"security.basic.enabled=false", "security.user.password=password").run(args); "security.basic.enabled=false", "security.user.password=password").run(
args);
} }
@Override @Override
......
...@@ -57,7 +57,7 @@ public class SampleSecureApplicationTests { ...@@ -57,7 +57,7 @@ public class SampleSecureApplicationTests {
new Callable<ConfigurableApplicationContext>() { new Callable<ConfigurableApplicationContext>() {
@Override @Override
public ConfigurableApplicationContext call() throws Exception { public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication return SpringApplication
.run(SampleSecureApplication.class); .run(SampleSecureApplication.class);
} }
}); });
......
...@@ -32,14 +32,14 @@ import org.springframework.context.annotation.Configuration; ...@@ -32,14 +32,14 @@ import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
@EnableAutoConfiguration @EnableAutoConfiguration
public class SampleServletApplication { public class SampleServletApplication {
@SuppressWarnings("serial") @SuppressWarnings("serial")
@Bean @Bean
public Servlet dispatcherServlet() { public Servlet dispatcherServlet() {
return new GenericServlet() { return new GenericServlet() {
@Override @Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, public void service(ServletRequest req, ServletResponse res)
IOException { throws ServletException, IOException {
res.setContentType("text/plain"); res.setContentType("text/plain");
res.getWriter().append("Hello World"); res.getWriter().append("Hello World");
} }
......
...@@ -67,8 +67,8 @@ public class SampleServletApplicationTests { ...@@ -67,8 +67,8 @@ public class SampleServletApplicationTests {
@Test @Test
public void testHome() throws Exception { public void testHome() throws Exception {
ResponseEntity<String> entity = getRestTemplate("user", getPassword()).getForEntity( ResponseEntity<String> entity = getRestTemplate("user", getPassword())
"http://localhost:8080", String.class); .getForEntity("http://localhost:8080", String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals(HttpStatus.OK, entity.getStatusCode());
assertEquals("Hello World", entity.getBody()); assertEquals("Hello World", entity.getBody());
} }
......
...@@ -56,7 +56,8 @@ public class NonAutoConfigurationSampleTomcatApplicationTests { ...@@ -56,7 +56,8 @@ public class NonAutoConfigurationSampleTomcatApplicationTests {
@Configuration @Configuration
@Import({ EmbeddedServletContainerAutoConfiguration.class, @Import({ EmbeddedServletContainerAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class }) PropertyPlaceholderAutoConfiguration.class })
@ComponentScan(basePackageClasses = { SampleController.class, HelloWorldService.class }) @ComponentScan(basePackageClasses = { SampleController.class, HelloWorldService.class })
public static class NonAutoConfigurationSampleTomcatApplication { public static class NonAutoConfigurationSampleTomcatApplication {
......
...@@ -14,9 +14,9 @@ public class WelcomeController { ...@@ -14,9 +14,9 @@ public class WelcomeController {
private String message = "Hello World"; private String message = "Hello World";
@RequestMapping("/") @RequestMapping("/")
public String welcome(Map<String,Object> model) { public String welcome(Map<String, Object> model) {
model.put("time", new Date()); model.put("time", new Date());
model.put("message", message ); model.put("message", message);
return "welcome"; return "welcome";
} }
......
...@@ -43,8 +43,7 @@ public class SpringBootPlugin implements Plugin<Project> { ...@@ -43,8 +43,7 @@ public class SpringBootPlugin implements Plugin<Project> {
// register BootRepackage so that we can use // register BootRepackage so that we can use
// task foo(type: BootRepackage) {} // task foo(type: BootRepackage) {}
project.getExtensions().getExtraProperties() project.getExtensions().getExtraProperties().set("BootRepackage", Repackage.class);
.set("BootRepackage", Repackage.class);
Repackage packageTask = addRepackageTask(project); Repackage packageTask = addRepackageTask(project);
ensureTaskRunsOnAssembly(project, packageTask); ensureTaskRunsOnAssembly(project, packageTask);
addRunJarTask(project); addRunJarTask(project);
......
package org.springframework.boot.gradle.task; package org.springframework.boot.gradle.task;
import java.io.File; import java.io.File;
...@@ -20,6 +21,7 @@ class ProjectLibraries implements Libraries { ...@@ -20,6 +21,7 @@ class ProjectLibraries implements Libraries {
private final Project project; private final Project project;
private String providedConfigurationName = "providedRuntime"; private String providedConfigurationName = "providedRuntime";
private String customConfigurationName = null; private String customConfigurationName = null;
/** /**
...@@ -47,18 +49,16 @@ class ProjectLibraries implements Libraries { ...@@ -47,18 +49,16 @@ class ProjectLibraries implements Libraries {
@Override @Override
public void doWithLibraries(LibraryCallback callback) throws IOException { public void doWithLibraries(LibraryCallback callback) throws IOException {
FileCollection custom = this.customConfigurationName != null ? this.project FileCollection custom = this.customConfigurationName != null ? this.project.getConfigurations().findByName(
.getConfigurations().findByName(this.customConfigurationName) : null; this.customConfigurationName)
: null;
if (custom != null) { if (custom != null) {
libraries(LibraryScope.CUSTOM, custom, callback); libraries(LibraryScope.CUSTOM, custom, callback);
} } else {
else { FileCollection compile = this.project.getConfigurations().getByName("compile");
FileCollection compile = this.project.getConfigurations()
.getByName("compile");
FileCollection runtime = this.project.getConfigurations() FileCollection runtime = this.project.getConfigurations().getByName("runtime");
.getByName("runtime");
runtime = runtime.minus(compile); runtime = runtime.minus(compile);
FileCollection provided = this.project.getConfigurations().findByName( FileCollection provided = this.project.getConfigurations().findByName(
......
...@@ -57,8 +57,7 @@ public class Repackage extends DefaultTask { ...@@ -57,8 +57,7 @@ public class Repackage extends DefaultTask {
} }
if (this.customConfiguration != null) { if (this.customConfiguration != null) {
libraries.setCustomConfigurationName(this.customConfiguration); libraries.setCustomConfigurationName(this.customConfiguration);
} } else if (extension.getCustomConfiguration() != null) {
else if (extension.getCustomConfiguration() != null) {
libraries.setCustomConfigurationName(extension.getCustomConfiguration()); libraries.setCustomConfigurationName(extension.getCustomConfiguration());
} }
project.getTasks().withType(Jar.class, new Action<Jar>() { project.getTasks().withType(Jar.class, new Action<Jar>() {
......
...@@ -39,7 +39,7 @@ import org.springframework.boot.loader.AsciiBytes; ...@@ -39,7 +39,7 @@ import org.springframework.boot.loader.AsciiBytes;
/** /**
* {@link Archive} implementation backed by an exploded archive directory. * {@link Archive} implementation backed by an exploded archive directory.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
public class ExplodedArchive extends Archive { public class ExplodedArchive extends Archive {
...@@ -72,7 +72,8 @@ public class ExplodedArchive extends Archive { ...@@ -72,7 +72,8 @@ public class ExplodedArchive extends Archive {
private void buildEntries(File file) { private void buildEntries(File file) {
if (!file.equals(this.root)) { if (!file.equals(this.root)) {
String name = file.toURI().getPath().substring(root.toURI().getPath().length()); String name = file.toURI().getPath()
.substring(root.toURI().getPath().length());
FileEntry entry = new FileEntry(new AsciiBytes(name), file); FileEntry entry = new FileEntry(new AsciiBytes(name), file);
this.entries.put(entry.getName(), entry); this.entries.put(entry.getName(), entry);
} }
...@@ -88,7 +89,7 @@ public class ExplodedArchive extends Archive { ...@@ -88,7 +89,7 @@ public class ExplodedArchive extends Archive {
@Override @Override
public URL getUrl() throws MalformedURLException { public URL getUrl() throws MalformedURLException {
FilteredURLStreamHandler handler = new FilteredURLStreamHandler(); FilteredURLStreamHandler handler = new FilteredURLStreamHandler();
return new URL("file", "", -1, this.root.toURI().getPath(), handler); return new URL("file", "", -1, this.root.toURI().getPath(), handler);
} }
@Override @Override
......
...@@ -121,8 +121,8 @@ public class ExplodedArchiveTests { ...@@ -121,8 +121,8 @@ public class ExplodedArchiveTests {
Archive nested = this.archive.getNestedArchive(entry); Archive nested = this.archive.getNestedArchive(entry);
Map<String, Entry> nestedEntries = getEntriesMap(nested); Map<String, Entry> nestedEntries = getEntriesMap(nested);
assertThat(nestedEntries.size(), equalTo(1)); assertThat(nestedEntries.size(), equalTo(1));
assertThat(nested.getUrl().toString(), assertThat(nested.getUrl().toString(), equalTo("file:"
equalTo("file:" + this.rootFolder.toURI().getPath() + "d/")); + this.rootFolder.toURI().getPath() + "d/"));
} }
@Test @Test
......
...@@ -76,24 +76,29 @@ public class SimpleJsonParser implements JsonParser { ...@@ -76,24 +76,29 @@ public class SimpleJsonParser implements JsonParser {
if (json.startsWith("[")) { if (json.startsWith("[")) {
return parseListInternal(json); return parseListInternal(json);
} }
if (json.startsWith("{")) { if (json.startsWith("{")) {
return parseMapInternal(json); return parseMapInternal(json);
} }
if (json.startsWith("\"")) { if (json.startsWith("\"")) {
return trimTrailingCharacter(trimLeadingCharacter(json, '"'), '"'); return trimTrailingCharacter(trimLeadingCharacter(json, '"'), '"');
} }
try { try {
return Long.valueOf(json); return Long.valueOf(json);
} }
catch (NumberFormatException e) { catch (NumberFormatException e) {
// ignore // ignore
} }
try { try {
return Double.valueOf(json); return Double.valueOf(json);
} }
catch (NumberFormatException e) { catch (NumberFormatException e) {
// ignore // ignore
} }
return json; return json;
} }
......
...@@ -45,6 +45,7 @@ public interface EmbeddedServletContainer { ...@@ -45,6 +45,7 @@ public interface EmbeddedServletContainer {
// Do nothing // Do nothing
} }
@Override
public int getPort() { public int getPort() {
return 0; return 0;
} }
......
...@@ -330,7 +330,8 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc ...@@ -330,7 +330,8 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
if (resource != null && resource.exists()) { if (resource != null && resource.exists()) {
for (PropertySourceLoader loader : loaders) { for (PropertySourceLoader loader : loaders) {
if (loader.supports(resource)) { if (loader.supports(resource)) {
PropertySource<?> propertySource = loader.load(resource.getDescription(), resource); PropertySource<?> propertySource = loader.load(
resource.getDescription(), resource);
propertySources.addFirst(propertySource); propertySources.addFirst(propertySource);
} }
} }
......
...@@ -77,11 +77,10 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem { ...@@ -77,11 +77,10 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem {
Assert.notNull(configLocation, "ConfigLocation must not be null"); Assert.notNull(configLocation, "ConfigLocation must not be null");
String resolvedLocation = SystemPropertyUtils.resolvePlaceholders(configLocation); String resolvedLocation = SystemPropertyUtils.resolvePlaceholders(configLocation);
ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory(); ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
Assert.isInstanceOf( Assert.isInstanceOf(LoggerContext.class, factory,
LoggerContext.class, "LoggerFactory is not a Logback LoggerContext but "
factory, + "Logback is on the classpath. Either remove Logback "
"LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (" + "or the competing implementation (" + factory.getClass() + ")");
+ factory.getClass() + ")");
LoggerContext context = (LoggerContext) factory; LoggerContext context = (LoggerContext) factory;
context.stop(); context.stop();
try { try {
......
...@@ -179,6 +179,7 @@ public class MockEmbeddedServletContainerFactory extends ...@@ -179,6 +179,7 @@ public class MockEmbeddedServletContainerFactory extends
return this.registeredFilters; return this.registeredFilters;
} }
@Override
public int getPort() { public int getPort() {
return this.port; return this.port;
} }
......
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