Source format and clean-up

pull/123/head
Phillip Webb 11 years ago
parent 883fd9162f
commit 64f32893bb

@ -28,11 +28,11 @@ import org.springframework.boot.actuate.web.BasicErrorController;
import org.springframework.boot.actuate.web.ErrorController;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration.DefaultTemplateResolverConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
@ -103,7 +103,8 @@ public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustom
context.getClassLoader())) {
if (DefaultTemplateResolverConfiguration.templateExists(
context.getEnvironment(), context.getResourceLoader(), "error")) {
return ConditionOutcome.noMatch("Thymeleaf template found for error view");
return ConditionOutcome
.noMatch("Thymeleaf template found for error view");
}
}
// FIXME: add matcher for JSP view if Jasper detected
@ -128,6 +129,7 @@ public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustom
this.context.addPropertyAccessor(new MapAccessor());
this.helper = new PropertyPlaceholderHelper("${", "}");
this.resolver = new PlaceholderResolver() {
@Override
public String resolvePlaceholder(String name) {
Expression expression = SpelView.this.parser.parseExpression(name);
Object value = expression.getValue(SpelView.this.context);
@ -136,10 +138,12 @@ public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustom
};
}
@Override
public String getContentType() {
return "text/html";
}
@Override
public void render(Map<String, ?> model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
if (response.getContentType() == null) {

@ -72,6 +72,7 @@ public class SimpleHealthIndicator implements HealthIndicator<Map<String, Object
return map;
}
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}

@ -69,7 +69,8 @@ class OnWebApplicationCondition extends SpringBootCondition {
}
if (context.getEnvironment() instanceof StandardServletEnvironment) {
return ConditionOutcome.match("found web application StandardServletEnvironment");
return ConditionOutcome
.match("found web application StandardServletEnvironment");
}
return ConditionOutcome.noMatch("not a web application");

@ -281,7 +281,8 @@ public class DataSourceAutoConfiguration implements EnvironmentAware {
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
if (anyMatches(context, metadata, this.tomcatCondition, this.dbcpCondition)) {
return ConditionOutcome.noMatch("existing non-embedded database detected");
return ConditionOutcome
.noMatch("existing non-embedded database detected");
}
EmbeddedDatabaseType type = EmbeddedDatabaseConnection.get(
context.getClassLoader()).getType();
@ -311,7 +312,8 @@ public class DataSourceAutoConfiguration implements EnvironmentAware {
if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
context.getBeanFactory(), DataSource.class, true, false).length > 0) {
return ConditionOutcome.match("Existing bean configured database detected");
return ConditionOutcome
.match("Existing bean configured database detected");
}
return ConditionOutcome.noMatch("no existing bean configured database");

@ -48,7 +48,7 @@ import static org.mockito.Mockito.mock;
/**
* Tests for {@link AutoConfigurationReportLoggingInitializer}.
*
*
* @author Phillip Webb
*/
public class AutoConfigurationReportLoggingInitializerTests {

@ -34,7 +34,7 @@ import static org.junit.Assert.assertNotNull;
/**
* Tests for {@link JpaRepositoriesAutoConfiguration}.
*
*
* @author Dave Syer
*/
public class JpaRepositoriesAutoConfigurationTests {
@ -46,7 +46,8 @@ public class JpaRepositoriesAutoConfigurationTests {
this.context = new AnnotationConfigApplicationContext();
this.context.register(TestConfiguration.class,
ComponentScanDetectorConfiguration.class,
EmbeddedDataSourceConfiguration.class, HibernateJpaAutoConfiguration.class,
EmbeddedDataSourceConfiguration.class,
HibernateJpaAutoConfiguration.class,
JpaRepositoriesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();

@ -55,7 +55,10 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate);
assertNotNull(connectionFactory);
assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory);
assertEquals(((ActiveMQConnectionFactory)jmsTemplate.getConnectionFactory()).getBrokerURL(), "vm://localhost");
assertEquals(
((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory())
.getBrokerURL(),
"vm://localhost");
}
@Test
@ -109,7 +112,7 @@ public class JmsTemplateAutoConfigurationTests {
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
assertFalse(jmsTemplate.isPubSubDomain());
}
@Test
public void testJmsTemplateOverridden() {
this.context = new AnnotationConfigApplicationContext();
@ -139,7 +142,9 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate);
assertNotNull(connectionFactory);
assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory);
assertEquals(((ActiveMQConnectionFactory)jmsTemplate.getConnectionFactory()).getBrokerURL(),
assertEquals(
((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory())
.getBrokerURL(),
"tcp://localhost:61616");
}
@ -157,7 +162,9 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate);
assertNotNull(connectionFactory);
assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory);
assertEquals(((ActiveMQConnectionFactory)jmsTemplate.getConnectionFactory()).getBrokerURL(),
assertEquals(
((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory())
.getBrokerURL(),
"tcp://remote-host:10000");
}
@ -174,7 +181,8 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate);
assertNotNull(pool);
assertEquals(jmsTemplate.getConnectionFactory(), pool);
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool.getConnectionFactory();
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool
.getConnectionFactory();
assertEquals("vm://localhost", factory.getBrokerURL());
}
@ -192,7 +200,8 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate);
assertNotNull(pool);
assertEquals(jmsTemplate.getConnectionFactory(), pool);
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool.getConnectionFactory();
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool
.getConnectionFactory();
assertEquals("tcp://localhost:61616", factory.getBrokerURL());
}
@ -202,7 +211,8 @@ public class JmsTemplateAutoConfigurationTests {
this.context
.register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
TestUtils.addEnviroment(this.context, "spring.activemq.pooled:true",
"spring.activemq.inMemory:false", "spring.activemq.brokerURL:tcp://remote-host:10000");
"spring.activemq.inMemory:false",
"spring.activemq.brokerURL:tcp://remote-host:10000");
this.context.refresh();
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
PooledConnectionFactory pool = this.context
@ -210,7 +220,8 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate);
assertNotNull(pool);
assertEquals(jmsTemplate.getConnectionFactory(), pool);
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool.getConnectionFactory();
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool
.getConnectionFactory();
assertEquals("tcp://remote-host:10000", factory.getBrokerURL());
}

@ -39,7 +39,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
/**
* Tests for {@link DeviceResolverAutoConfiguration}.
*
*
* @author Roy Clarkson
*/
public class DeviceResolverAutoConfigurationTests {

@ -133,6 +133,7 @@ public class OptionHandler {
@Override
public String format(Map<String, ? extends OptionDescriptor> options) {
Comparator<OptionDescriptor> comparator = new Comparator<OptionDescriptor>() {
@Override
public int compare(OptionDescriptor first, OptionDescriptor second) {
return first.options().iterator().next()
.compareTo(second.options().iterator().next());

@ -58,8 +58,8 @@ public class SampleActuatorUiApplicationPortTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
.run(SampleActuatorUiApplication.class, args);
return SpringApplication.run(
SampleActuatorUiApplication.class, args);
}
});
context = future.get(60, TimeUnit.SECONDS);

@ -58,7 +58,7 @@ public class SampleActuatorUiApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(SampleActuatorUiApplication.class);
}
});
@ -112,8 +112,10 @@ public class SampleActuatorUiApplicationTests {
.contains("<html>"));
assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody()
.contains("<body>"));
assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody()
.contains("Please contact the operator with the above information"));
assertTrue(
"Wrong body:\n" + entity.getBody(),
entity.getBody().contains(
"Please contact the operator with the above information"));
}
private RestTemplate getRestTemplate() {

@ -59,8 +59,7 @@ public class EndpointsPropertiesSampleActuatorApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
.run(configuration, args);
return SpringApplication.run(configuration, args);
}
});
this.context = future.get(60, TimeUnit.SECONDS);

@ -67,8 +67,8 @@ public class ManagementAddressSampleActuatorApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
.run(SampleActuatorApplication.class, args);
return SpringApplication.run(
SampleActuatorApplication.class, args);
}
});
context = future.get(60, TimeUnit.SECONDS);

@ -57,8 +57,8 @@ public class ManagementSampleActuatorApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
.run(SampleActuatorApplication.class, args);
return SpringApplication.run(
SampleActuatorApplication.class, args);
}
});
context = future.get(60, TimeUnit.SECONDS);

@ -65,8 +65,8 @@ public class NoManagementSampleActuatorApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
.run(SampleActuatorApplication.class, args);
return SpringApplication.run(
SampleActuatorApplication.class, args);
}
});
context = future.get(60, TimeUnit.SECONDS);

@ -69,7 +69,7 @@ public class SampleActuatorApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(SampleActuatorApplication.class);
}
});
@ -145,8 +145,7 @@ public class SampleActuatorApplicationTests {
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, entity.getStatusCode());
String body = entity.getBody();
assertNotNull(body);
assertTrue("Wrong body: " + body,
body.contains("\"error\":"));
assertTrue("Wrong body: " + body, body.contains("\"error\":"));
}
@Test
@ -171,7 +170,7 @@ public class SampleActuatorApplicationTests {
.getForEntity("http://localhost:8080/trace", List.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
@SuppressWarnings("unchecked")
List<Map<String, Object>> list = (List<Map<String, Object>>) entity.getBody();
List<Map<String, Object>> list = entity.getBody();
Map<String, Object> trace = list.get(list.size() - 1);
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) ((Map<String, Object>) ((Map<String, Object>) trace

@ -62,7 +62,7 @@ public class ShutdownSampleActuatorApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(SampleActuatorApplication.class);
}
});

@ -41,7 +41,7 @@ import org.springframework.web.client.RestTemplate;
/**
* Integration tests for unsecured service endpoints (even with Spring Security on
* classpath).
*
*
* @author Dave Syer
*/
public class UnsecureManagementSampleActuatorApplicationTests {
@ -55,9 +55,9 @@ public class UnsecureManagementSampleActuatorApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
.run(SampleActuatorApplication.class,
"--security.management.enabled=false");
return SpringApplication.run(
SampleActuatorApplication.class,
"--security.management.enabled=false");
}
});
context = future.get(60, TimeUnit.SECONDS);
@ -87,7 +87,8 @@ public class UnsecureManagementSampleActuatorApplicationTests {
public void testMetrics() throws Exception {
try {
testHomeIsSecure(); // makes sure some requests have been made
} catch (AssertionError ex) {
}
catch (AssertionError ex) {
// ignore;
}
@SuppressWarnings("rawtypes")

@ -54,9 +54,9 @@ public class UnsecureSampleActuatorApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
.run(SampleActuatorApplication.class,
"--security.basic.enabled=false");
return SpringApplication.run(
SampleActuatorApplication.class,
"--security.basic.enabled=false");
}
});
context = future.get(60, TimeUnit.SECONDS);

@ -31,7 +31,7 @@ public class SampleController {
@RequestMapping("/")
@ResponseBody
@Transactional(readOnly = true)
@Transactional(readOnly = true)
public String helloWorld() {
return this.cityService.getCity("Bath", "UK").getName();
}

@ -23,9 +23,10 @@ import org.springframework.web.context.WebApplicationContext;
* @author Oliver Gierke
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SampleDataJpaApplication.class, loader=SpringApplicationContextLoader.class)
@ContextConfiguration(classes = SampleDataJpaApplication.class, loader = SpringApplicationContextLoader.class)
@WebAppConfiguration
@ActiveProfiles("scratch") // Separate profile for web tests to avoid clashing databases
@ActiveProfiles("scratch")
// Separate profile for web tests to avoid clashing databases
public class SampleDataJpaApplicationTests {
@Autowired

@ -36,7 +36,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Oliver Gierke
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SampleDataJpaApplication.class, loader=SpringApplicationContextLoader.class)
@ContextConfiguration(classes = SampleDataJpaApplication.class, loader = SpringApplicationContextLoader.class)
public class CityRepositoryIntegrationTests {
@Autowired

@ -44,7 +44,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Oliver Gierke
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SampleDataJpaApplication.class, loader=SpringApplicationContextLoader.class)
@ContextConfiguration(classes = SampleDataJpaApplication.class, loader = SpringApplicationContextLoader.class)
public class HotelRepositoryIntegrationTests {
@Autowired

@ -20,25 +20,24 @@ import org.springframework.data.annotation.Id;
public class Customer {
@Id
private String id;
@Id
private String id;
private String firstName;
private String lastName;
private String firstName;
private String lastName;
public Customer() {}
public Customer() {
}
public Customer(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public Customer(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
@Override
public String toString() {
return String.format(
"Customer[id=%s, firstName='%s', lastName='%s']",
id, firstName, lastName);
}
@Override
public String toString() {
return String.format("Customer[id=%s, firstName='%s', lastName='%s']", id,
firstName, lastName);
}
}

@ -22,8 +22,8 @@ import org.springframework.data.mongodb.repository.MongoRepository;
public interface CustomerRepository extends MongoRepository<Customer, String> {
public Customer findByFirstName(String firstName);
public Customer findByFirstName(String firstName);
public List<Customer> findByLastName(String lastName);
public List<Customer> findByLastName(String lastName);
}

@ -27,7 +27,7 @@ import org.springframework.core.NestedCheckedException;
/**
* Tests for {@link SampleMongoApplication}.
*
*
* @author Dave Syer
*/
public class SampleMongoApplicationTests {
@ -39,13 +39,15 @@ public class SampleMongoApplicationTests {
public void testDefaultSettings() throws Exception {
try {
SampleMongoApplication.main(new String[0]);
} catch (IllegalStateException ex) {
}
catch (IllegalStateException ex) {
if (serverNotRunning(ex)) {
return;
}
}
String output = this.outputCapture.toString();
assertTrue("Wrong output: " + output, output.contains("firstName='Alice', lastName='Smith'"));
assertTrue("Wrong output: " + output,
output.contains("firstName='Alice', lastName='Smith'"));
}
private boolean serverNotRunning(IllegalStateException e) {

@ -46,8 +46,7 @@ public class SampleIntegrationApplicationTests {
@BeforeClass
public static void start() throws Exception {
context = (ConfigurableApplicationContext) SpringApplication
.run(SampleIntegrationApplication.class);
context = SpringApplication.run(SampleIntegrationApplication.class);
}
@AfterClass

@ -51,7 +51,7 @@ public class SampleJettyApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(SampleJettyApplication.class);
}
});

@ -28,7 +28,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Dave Syer
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SampleSimpleApplication.class, loader=SpringApplicationContextLoader.class)
@ContextConfiguration(classes = SampleSimpleApplication.class, loader = SpringApplicationContextLoader.class)
public class SpringTestSampleSimpleApplicationTests {
@Test

@ -73,7 +73,7 @@ public class NonAutoConfigurationSampleTomcatApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(NonAutoConfigurationSampleTomcatApplication.class);
}
});

@ -51,7 +51,7 @@ public class SampleTomcatApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(SampleTomcatApplication.class);
}
});

@ -52,7 +52,7 @@ public class SampleTraditionalApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(SampleTraditionalApplication.class);
}
});

@ -21,7 +21,7 @@ import static org.junit.Assert.*;
/**
* Basic integration tests for JSP application.
*
*
* @author Phillip Webb
*/
public class SampleWebJspApplicationTests {
@ -35,7 +35,7 @@ public class SampleWebJspApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(SampleWebJspApplication.class);
}
});
@ -54,8 +54,8 @@ public class SampleWebJspApplicationTests {
ResponseEntity<String> entity = getRestTemplate().getForEntity(
"http://localhost:8080", String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertTrue("Wrong body:\n" + entity.getBody(), entity
.getBody().contains("/resources/text.txt"));
assertTrue("Wrong body:\n" + entity.getBody(),
entity.getBody().contains("/resources/text.txt"));
}
private RestTemplate getRestTemplate() {

@ -23,7 +23,7 @@ import static org.junit.Assert.assertTrue;
/**
* Basic integration tests for demo application.
*
*
* @author Dave Syer
*/
public class SampleWebStaticApplicationTests {
@ -37,7 +37,7 @@ public class SampleWebStaticApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(SampleWebStaticApplication.class);
}
});

@ -26,7 +26,7 @@ import static org.junit.Assert.assertTrue;
/**
* Basic integration tests for demo application.
*
*
* @author Dave Syer
*/
public class SampleWebUiApplicationTests {
@ -40,7 +40,7 @@ public class SampleWebUiApplicationTests {
new Callable<ConfigurableApplicationContext>() {
@Override
public ConfigurableApplicationContext call() throws Exception {
return (ConfigurableApplicationContext) SpringApplication
return SpringApplication
.run(SampleWebUiApplication.class);
}
});

@ -37,8 +37,8 @@ public class SampleWebSocketsApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SampleWebSocketsApplication.class);
}
return application.sources(SampleWebSocketsApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(SampleWebSocketsApplication.class, args);

@ -26,7 +26,7 @@ import org.springframework.boot.gradle.task.RunJar;
/**
* Gradle 'Spring Boot' {@link Plugin}.
*
*
* @author Phillip Webb
*/
public class SpringBootPlugin implements Plugin<Project> {
@ -53,12 +53,14 @@ public class SpringBootPlugin implements Plugin<Project> {
}
private Repackage addRepackageTask(Project project) {
Repackage packageTask = project.getTasks().create(REPACKAGE_TASK_NAME, Repackage.class);
Repackage packageTask = project.getTasks().create(REPACKAGE_TASK_NAME,
Repackage.class);
packageTask.setDescription("Repackage existing JAR and WAR "
+ "archives so that they can be executed from the command " + "line using 'java -jar'");
+ "archives so that they can be executed from the command "
+ "line using 'java -jar'");
packageTask.setGroup(BasePlugin.BUILD_GROUP);
packageTask.dependsOn(project.getConfigurations().getByName(Dependency.ARCHIVES_CONFIGURATION)
.getAllArtifacts().getBuildDependencies());
packageTask.dependsOn(project.getConfigurations().getByName(
Dependency.ARCHIVES_CONFIGURATION).getAllArtifacts().getBuildDependencies());
return packageTask;
}

@ -1,3 +1,4 @@
package org.springframework.boot.gradle.task;
import java.io.File;
@ -23,6 +24,7 @@ class ProjectLibraries implements Libraries {
/**
* Create a new {@link ProjectLibraries} instance of the specified {@link Project}.
*
* @param project the gradle project
*/
public ProjectLibraries(Project project) {
@ -31,6 +33,7 @@ class ProjectLibraries implements Libraries {
/**
* Set the name of the provided configuration. Defaults to 'providedRuntime'.
*
* @param providedConfigurationName the providedConfigurationName to set
*/
public void setProvidedConfigurationName(String providedConfigurationName) {

@ -29,7 +29,7 @@ import org.springframework.boot.loader.tools.Repackager;
/**
* Repackage task.
*
*
* @author Phillip Webb
*/
public class Repackage extends DefaultTask {
@ -44,6 +44,7 @@ public class Repackage extends DefaultTask {
libraries.setProvidedConfigurationName(extension.getProvidedConfiguration());
}
project.getTasks().withType(Jar.class, new Action<Jar>() {
@Override
public void execute(Jar archive) {
if ("".equals(archive.getClassifier())) {

@ -29,7 +29,7 @@ import org.gradle.process.internal.ExecAction;
/**
* Run Jar task. Run the built jar file from Gradle.
*
*
* @author Dave Noel
*/
public class RunJar extends DefaultTask {
@ -40,6 +40,7 @@ public class RunJar extends DefaultTask {
public void runJar() {
Project project = getProject();
project.getTasks().withType(Jar.class, new Action<Jar>() {
@Override
public void execute(Jar archive) {
file = archive.getArchivePath();

@ -200,6 +200,7 @@ class JarWriter {
this.close = close;
}
@Override
public void write(OutputStream outputStream) throws IOException {
byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead = -1;

@ -157,6 +157,7 @@ public class LaunchedURLClassLoader extends URLClassLoader {
private void definePackageForFindClass(final String name, final String packageName) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws ClassNotFoundException {
String path = name.replace('.', '/').concat(".class");
for (URL url : getURLs()) {

@ -142,6 +142,7 @@ public abstract class AbstractEmbeddedServletContainerFactory implements
/**
* Returns the port that the embedded servlet container should listen on.
*/
@Override
public int getPort() {
return this.port;
}
@ -158,10 +159,12 @@ public abstract class AbstractEmbeddedServletContainerFactory implements
return this.address;
}
@Override
public void setSessionTimeout(int sessionTimeout) {
this.sessionTimeout = sessionTimeout;
}
@Override
public void setSessionTimeout(int sessionTimeout, TimeUnit timeUnit) {
Assert.notNull(timeUnit, "TimeUnit must not be null");
this.sessionTimeout = (int) timeUnit.toSeconds(sessionTimeout);

@ -35,6 +35,7 @@ public interface EmbeddedServletContainer {
*/
public static final EmbeddedServletContainer NONE = new EmbeddedServletContainer() {
@Override
public void start() throws EmbeddedServletContainerException {
// Do nothing
};

@ -21,8 +21,7 @@ public class LiquibaseServiceLocatorInitializer implements
ApplicationContextInitializer<ConfigurableApplicationContext>,
SpringApplicationInitializer {
static final Log logger = LogFactory
.getLog(LiquibaseServiceLocatorInitializer.class);
static final Log logger = LogFactory.getLog(LiquibaseServiceLocatorInitializer.class);
@Override
public void initialize(SpringApplication springApplication, String[] args) {
@ -39,12 +38,12 @@ public class LiquibaseServiceLocatorInitializer implements
* Inner class to prevent class not found issues
*/
private static class LiquibasePresent {
public void replaceServiceLocator() {
ServiceLocator.setInstance(new CustomResolverServiceLocator(
new SpringPackageScanClassResolver()));
}
}
}

@ -16,7 +16,6 @@
package org.springframework.boot.config;
/**
* Tests for {@link JsonParser}.
*

Loading…
Cancel
Save