Browse Source

Final polish before 1.0.0.RC1

pull/252/head
Phillip Webb 12 years ago
parent
commit
ac54d7fe3c
  1. 3
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java
  2. 6
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java
  3. 3
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java
  4. 3
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TraceEndpoint.java
  5. 4
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java
  6. 3
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java
  7. 24
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointMvcAdapter.java
  8. 6
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java
  9. 8
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java
  10. 19
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ManagementErrorEndpoint.java
  11. 8
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpoint.java
  12. 18
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoint.java
  13. 6
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java
  14. 6
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java
  15. 4
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/VanillaHealthIndicator.java
  16. 9
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java
  17. 3
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java
  18. 2
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java
  19. 18
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisUtils.java
  20. 16
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java
  21. 17
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriter.java
  22. 6
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterService.java
  23. 6
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeService.java
  24. 12
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ManagementServerProperties.java
  25. 3
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/ErrorController.java
  26. 3
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java
  27. 6
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java
  28. 14
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisServer.java
  29. 1
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationReportLoggingInitializer.java
  30. 3
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java
  31. 15
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java
  32. 5
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchDatabaseInitializer.java
  33. 24
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java
  34. 5
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java
  35. 22
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
  36. 10
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java
  37. 3
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfiguration.java
  38. 3
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfiguration.java
  39. 7
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java
  40. 8
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java
  41. 69
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java
  42. 2
      spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java
  43. 7
      spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java
  44. 2
      spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiter.java
  45. 4
      spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/RunProcessCommand.java
  46. 3
      spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java
  47. 3
      spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java
  48. 8
      spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/JreProxySelector.java
  49. 4
      spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/ManagedDependenciesFactory.java
  50. 3
      spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositoryConfiguration.java
  51. 5
      spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/transformation/GroovyBeansTransformation.java
  52. 9
      spring-boot-cli/src/main/java/org/springframework/boot/groovy/EnableDeviceResolver.java
  53. 8
      spring-boot-cli/src/main/java/org/springframework/boot/groovy/EnableIntegrationPatterns.java
  54. 9
      spring-boot-cli/src/main/java/org/springframework/boot/groovy/EnableJmsMessaging.java
  55. 4
      spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java
  56. 4
      spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java
  57. 12
      spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPluginExtension.groovy
  58. 19
      spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/ProjectLibraries.java
  59. 4
      spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/RunApp.java
  60. 4
      spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java
  61. 5
      spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java
  62. 18
      spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java
  63. 6
      spring-boot/src/main/java/org/springframework/boot/config/SimpleJsonParser.java
  64. 4
      spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java
  65. 6
      spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java
  66. 23
      spring-boot/src/main/java/org/springframework/boot/test/package-info.java
  67. 21
      spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java

3
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java

@ -1,5 +1,5 @@ @@ -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.
@ -53,6 +53,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl @@ -53,6 +53,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
* Configuration triggered from {@link EndpointWebMvcAutoConfiguration} when a new
* {@link EmbeddedServletContainer} running on a different port is required.
*
* @author Dave Syer
* @see EndpointWebMvcAutoConfiguration
*/
@Configuration

6
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java

@ -1,5 +1,5 @@ @@ -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.
@ -48,11 +48,9 @@ import org.springframework.messaging.support.ExecutorSubscribableChannel; @@ -48,11 +48,9 @@ import org.springframework.messaging.support.ExecutorSubscribableChannel;
import com.codahale.metrics.MetricRegistry;
/**
* <p>
* {@link EnableAutoConfiguration Auto-configuration} for metrics services. Creates
* user-facing {@link GaugeService} and {@link CounterService} instances, and also back
* end repositories to catch the data pumped into them.
* </p>
* end repositories to catch the data pumped into them. </p>
* <p>
* An {@link InMemoryMetricRepository} is always created unless another
* {@link MetricRepository} is already provided by the user. In general, even if metric

3
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java

@ -1,5 +1,5 @@ @@ -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.
@ -21,7 +21,6 @@ import javax.validation.constraints.Pattern; @@ -21,7 +21,6 @@ import javax.validation.constraints.Pattern;
/**
* Abstract base for {@link Endpoint} implementations.
* <p>
*
* @author Phillip Webb
* @author Christian Dupuis

3
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TraceEndpoint.java

@ -1,5 +1,5 @@ @@ -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.
@ -35,7 +35,6 @@ public class TraceEndpoint extends AbstractEndpoint<List<Trace>> { @@ -35,7 +35,6 @@ public class TraceEndpoint extends AbstractEndpoint<List<Trace>> {
/**
* Create a new {@link TraceEndpoint} instance.
*
* @param repository the trace repository
*/
public TraceEndpoint(TraceRepository repository) {

4
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-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.
@ -184,8 +184,6 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc @@ -184,8 +184,6 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc
return builder.toString();
}
// SmartLifeCycle implementation
@Override
public final int getPhase() {
return this.phase;

3
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java

@ -1,5 +1,5 @@ @@ -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.
@ -46,7 +46,6 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl @@ -46,7 +46,6 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
* @author Phillip Webb
* @author Christian Dupuis
* @author Dave Syer
*
*/
public class EndpointHandlerMapping extends RequestMappingHandlerMapping implements
ApplicationContextAware {

24
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/GenericMvcEndpoint.java → spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointMvcAdapter.java

@ -1,5 +1,5 @@ @@ -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.
@ -17,18 +17,26 @@ @@ -17,18 +17,26 @@
package org.springframework.boot.actuate.endpoint.mvc;
import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Adapter class to expose {@link Endpoint}s as {@link MvcEndpoint}s.
*
* @author Dave Syer
*/
public class GenericMvcEndpoint implements MvcEndpoint {
public class EndpointMvcAdapter implements MvcEndpoint {
private Endpoint<?> delegate;
private final Endpoint<?> delegate;
public GenericMvcEndpoint(Endpoint<?> delegate) {
/**
* Create a new {@link EndpointMvcAdapter}.
* @param delegate the underlying {@link Endpoint} to adapt.
*/
public EndpointMvcAdapter(Endpoint<?> delegate) {
Assert.notNull(delegate, "Delegate must not be null");
this.delegate = delegate;
}
@ -49,11 +57,9 @@ public class GenericMvcEndpoint implements MvcEndpoint { @@ -49,11 +57,9 @@ public class GenericMvcEndpoint implements MvcEndpoint {
}
@Override
public Class<?> getEndpointType() {
@SuppressWarnings("unchecked")
Class<? extends Endpoint<?>> type = (Class<? extends Endpoint<?>>) this.delegate
.getClass();
return type;
@SuppressWarnings("rawtypes")
public Class<? extends Endpoint> getEndpointType() {
return this.delegate.getClass();
}
}

6
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java

@ -1,5 +1,5 @@ @@ -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.
@ -27,9 +27,11 @@ import org.springframework.web.bind.annotation.ResponseBody; @@ -27,9 +27,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
* Adapter to expose {@link EnvironmentEndpoint} as an {@link MvcEndpoint}.
*
* @author Dave Syer
*/
public class EnvironmentMvcEndpoint extends GenericMvcEndpoint implements
public class EnvironmentMvcEndpoint extends EndpointMvcAdapter implements
EnvironmentAware {
private Environment environment;

8
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-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.
@ -38,8 +38,7 @@ import org.springframework.web.servlet.ModelAndView; @@ -38,8 +38,7 @@ import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.ServletWrappingController;
/**
* {@link Endpoint} implementation to register the Jolokia infrastructure with the Boot
* management subsystem.
* {@link MvcEndpoint} to expose Jolokia.
*
* @author Christian Dupuis
*/
@ -110,7 +109,8 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, @@ -110,7 +109,8 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
}
@Override
public Class<?> getEndpointType() {
@SuppressWarnings("rawtypes")
public Class<? extends Endpoint> getEndpointType() {
return null;
}

19
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ManagementErrorEndpoint.java

@ -1,5 +1,5 @@ @@ -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.
@ -18,17 +18,19 @@ package org.springframework.boot.actuate.endpoint.mvc; @@ -18,17 +18,19 @@ package org.springframework.boot.actuate.endpoint.mvc;
import java.util.Map;
import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.actuate.web.ErrorController;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
/**
* Special endpoint for handling "/error" path when the management servlet is in a child
* context. The regular {@link ErrorController} should be available there but because of
* the way the handler mappings are set up it will not be detected.
* Special {@link MvcEndpoint} for handling "/error" path when the management servlet is
* in a child context. The regular {@link ErrorController} should be available there but
* because of the way the handler mappings are set up it will not be detected.
*
* @author Dave Syer
*/
@ -36,9 +38,11 @@ import org.springframework.web.context.request.RequestContextHolder; @@ -36,9 +38,11 @@ import org.springframework.web.context.request.RequestContextHolder;
public class ManagementErrorEndpoint implements MvcEndpoint {
private final ErrorController controller;
private String path;
private final String path;
public ManagementErrorEndpoint(String path, ErrorController controller) {
Assert.notNull(controller, "Controller must not be null");
this.path = path;
this.controller = controller;
}
@ -61,7 +65,8 @@ public class ManagementErrorEndpoint implements MvcEndpoint { @@ -61,7 +65,8 @@ public class ManagementErrorEndpoint implements MvcEndpoint {
}
@Override
public Class<?> getEndpointType() {
@SuppressWarnings("rawtypes")
public Class<? extends Endpoint> getEndpointType() {
return null;
}
}
}

8
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpoint.java

@ -1,5 +1,5 @@ @@ -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.
@ -25,11 +25,13 @@ import org.springframework.web.bind.annotation.ResponseBody; @@ -25,11 +25,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
* Adapter to expose {@link MetricsEndpoint} as an {@link MvcEndpoint}.
*
* @author Dave Syer
*/
public class MetricsMvcEndpoint extends GenericMvcEndpoint {
public class MetricsMvcEndpoint extends EndpointMvcAdapter {
private MetricsEndpoint delegate;
private final MetricsEndpoint delegate;
public MetricsMvcEndpoint(MetricsEndpoint delegate) {
super(delegate);

18
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoint.java

@ -1,5 +1,5 @@ @@ -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.
@ -29,10 +29,22 @@ import org.springframework.boot.actuate.endpoint.Endpoint; @@ -29,10 +29,22 @@ import org.springframework.boot.actuate.endpoint.Endpoint;
*/
public interface MvcEndpoint {
/**
* Return the MVC path of the endpoint.
*/
String getPath();
/**
* Return if the endpoint exposes sensitive information.
*/
boolean isSensitive();
Class<?> getEndpointType();
/**
* Return the type of {@link Endpoint} exposed, or {@code null} if this
* {@link MvcEndpoint} exposes information that cannot be represented as a traditional
* {@link Endpoint}.
*/
@SuppressWarnings("rawtypes")
Class<? extends Endpoint> getEndpointType();
}
}

6
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java

@ -1,5 +1,5 @@ @@ -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.
@ -60,7 +60,7 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean { @@ -60,7 +60,7 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean {
Endpoint.class).values();
for (Endpoint<?> endpoint : delegates) {
if (isGenericEndpoint(endpoint.getClass())) {
this.endpoints.add(new GenericMvcEndpoint(endpoint));
this.endpoints.add(new EndpointMvcAdapter(endpoint));
}
}
}
@ -85,4 +85,4 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean { @@ -85,4 +85,4 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean {
&& !MvcEndpoint.class.isAssignableFrom(type);
}
}
}

6
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java

@ -1,5 +1,5 @@ @@ -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.
@ -22,9 +22,11 @@ import org.springframework.web.bind.annotation.RequestMethod; @@ -22,9 +22,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Adapter to expose {@link ShutdownEndpoint} as an {@link MvcEndpoint}.
*
* @author Dave Syer
*/
public class ShutdownMvcEndpoint extends GenericMvcEndpoint {
public class ShutdownMvcEndpoint extends EndpointMvcAdapter {
public ShutdownMvcEndpoint(ShutdownEndpoint delegate) {
super(delegate);

4
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/VanillaHealthIndicator.java

@ -1,5 +1,5 @@ @@ -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.
@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.boot.actuate.health;
/**
* Default implementation of {@link HealthIndicator} that simply returns "ok".
* Default implementation of {@link HealthIndicator} that simply returns {@literal "ok"}.
*
* @author Dave Syer
*/

9
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java

@ -1,5 +1,5 @@ @@ -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.
@ -49,7 +49,6 @@ public abstract class AbstractMetricExporter implements Exporter { @@ -49,7 +49,6 @@ public abstract class AbstractMetricExporter implements Exporter {
/**
* The earliest time for which data will be exported.
*
* @param earliestTimestamp the timestamp to set
*/
public void setEarliestTimestamp(Date earliestTimestamp) {
@ -58,7 +57,6 @@ public abstract class AbstractMetricExporter implements Exporter { @@ -58,7 +57,6 @@ public abstract class AbstractMetricExporter implements Exporter {
/**
* Ignore timestamps (export all metrics).
*
* @param ignoreTimestamps the flag to set
*/
public void setIgnoreTimestamps(boolean ignoreTimestamps) {
@ -96,7 +94,6 @@ public abstract class AbstractMetricExporter implements Exporter { @@ -96,7 +94,6 @@ public abstract class AbstractMetricExporter implements Exporter {
* prefixes). If the metrics to be exported partition into groups identified by a
* String, subclasses should override this method. Otherwise the default should be
* fine (iteration over all metrics).
*
* @return groups of metrics to iterate over (default singleton empty string)
*/
protected Iterable<String> groups() {
@ -105,7 +102,6 @@ public abstract class AbstractMetricExporter implements Exporter { @@ -105,7 +102,6 @@ public abstract class AbstractMetricExporter implements Exporter {
/**
* Write the values associated with a group.
*
* @param group the group to write
* @param values the values to write
*/
@ -113,10 +109,9 @@ public abstract class AbstractMetricExporter implements Exporter { @@ -113,10 +109,9 @@ public abstract class AbstractMetricExporter implements Exporter {
/**
* Get the next group of metrics to write.
*
* @param group the group name to write
* @return some metrics to write
*/
protected abstract Iterable<Metric<?>> next(String group);
}
}

3
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java

@ -1,5 +1,5 @@ @@ -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.
@ -37,6 +37,7 @@ public class InMemoryMetricRepository implements MetricRepository, MultiMetricRe @@ -37,6 +37,7 @@ public class InMemoryMetricRepository implements MetricRepository, MultiMetricRe
PrefixMetricReader {
private SimpleInMemoryRepository<Metric<?>> metrics = new SimpleInMemoryRepository<Metric<?>>();
private Collection<String> groups = new HashSet<String>();
@Override

2
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java

@ -43,6 +43,7 @@ public class RedisMultiMetricRepository implements MultiMetricRepository { @@ -43,6 +43,7 @@ public class RedisMultiMetricRepository implements MultiMetricRepository {
private static final String DEFAULT_METRICS_PREFIX = "spring.groups.";
private String prefix = DEFAULT_METRICS_PREFIX;
private String keys = this.prefix + "keys";
private BoundZSetOperations<String, String> zSetOperations;
@ -57,7 +58,6 @@ public class RedisMultiMetricRepository implements MultiMetricRepository { @@ -57,7 +58,6 @@ public class RedisMultiMetricRepository implements MultiMetricRepository {
/**
* The prefix for all metrics keys.
*
* @param prefix the prefix to set for all metrics keys
*/
public void setPrefix(String prefix) {

18
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisUtils.java

@ -1,3 +1,19 @@ @@ -1,3 +1,19 @@
/*
* 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.actuate.metrics.repository.redis;
import org.springframework.data.redis.connection.RedisConnectionFactory;
@ -8,6 +24,8 @@ import org.springframework.data.redis.serializer.GenericToStringSerializer; @@ -8,6 +24,8 @@ import org.springframework.data.redis.serializer.GenericToStringSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* General Utils for working with Redis.
*
* @author Luke Taylor
*/
class RedisUtils {

16
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java

@ -1,3 +1,19 @@ @@ -1,3 +1,19 @@
/*
* 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.actuate.metrics.rich;
import org.springframework.util.Assert;

17
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriter.java

@ -1,5 +1,5 @@ @@ -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.
@ -30,6 +30,7 @@ import com.codahale.metrics.Timer; @@ -30,6 +30,7 @@ import com.codahale.metrics.Timer;
/**
* A {@link MetricWriter} that send data to a Codahale {@link MetricRegistry} based on a
* naming convention:
*
* <ul>
* <li>Updates to {@link #increment(Delta)} with names in "meter.*" are treated as
* {@link Meter} events</li>
@ -49,7 +50,8 @@ public class CodahaleMetricWriter implements MetricWriter { @@ -49,7 +50,8 @@ public class CodahaleMetricWriter implements MetricWriter {
private final MetricRegistry registry;
/**
* @param registry
* Create a new {@link CodahaleMetricWriter} instance.
* @param registry the underlying metric registry
*/
public CodahaleMetricWriter(MetricRegistry registry) {
this.registry = registry;
@ -94,17 +96,20 @@ public class CodahaleMetricWriter implements MetricWriter { @@ -94,17 +96,20 @@ public class CodahaleMetricWriter implements MetricWriter {
this.registry.remove(metricName);
}
/**
* Simple {@link Gauge} implementation to {@literal double} value.
*/
private static class SimpleGauge implements Gauge<Double> {
private final double gauge;
private final double value;
private SimpleGauge(double gauge) {
this.gauge = gauge;
private SimpleGauge(double value) {
this.value = value;
}
@Override
public Double getValue() {
return this.gauge;
return this.value;
}
}

6
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterService.java

@ -1,5 +1,5 @@ @@ -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.
@ -54,9 +54,7 @@ public class DefaultCounterService implements CounterService { @@ -54,9 +54,7 @@ public class DefaultCounterService implements CounterService {
if (metricName.startsWith("counter") || metricName.startsWith("meter")) {
return metricName;
}
else {
return "counter." + metricName;
}
return "counter." + metricName;
}
}

6
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeService.java

@ -1,5 +1,5 @@ @@ -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.
@ -46,9 +46,7 @@ public class DefaultGaugeService implements GaugeService { @@ -46,9 +46,7 @@ public class DefaultGaugeService implements GaugeService {
|| metricName.startsWith("timer")) {
return metricName;
}
else {
return "gauge." + metricName;
}
return "gauge." + metricName;
}
}

12
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ManagementServerProperties.java

@ -1,5 +1,5 @@ @@ -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.
@ -81,6 +81,9 @@ public class ManagementServerProperties implements SecurityPrequisite { @@ -81,6 +81,9 @@ public class ManagementServerProperties implements SecurityPrequisite {
return this.security;
}
/**
* Security configuration.
*/
public static class Security {
private boolean enabled = true;
@ -116,11 +119,8 @@ public class ManagementServerProperties implements SecurityPrequisite { @@ -116,11 +119,8 @@ public class ManagementServerProperties implements SecurityPrequisite {
}
private static Security maybeCreateSecurity() {
if (ClassUtils
.isPresent("org.springframework.security.core.Authentication", null)) {
return new Security();
}
return null;
return (ClassUtils.isPresent("org.springframework.security.core.Authentication",
null) ? new Security() : null);
}
}

3
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/ErrorController.java

@ -1,5 +1,5 @@ @@ -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.
@ -36,7 +36,6 @@ public interface ErrorController { @@ -36,7 +36,6 @@ public interface ErrorController {
/**
* Extract a useful model of the error from the request attributes.
*
* @param attributes the request attributes
* @param trace flag to indicate that stack trace information should be included
* @return a model containing error messages and codes etc.

3
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java

@ -260,7 +260,8 @@ public class EndpointWebMvcAutoConfigurationTests { @@ -260,7 +260,8 @@ public class EndpointWebMvcAutoConfigurationTests {
}
@Override
public Class<?> getEndpointType() {
@SuppressWarnings("rawtypes")
public Class<? extends Endpoint> getEndpointType() {
return Endpoint.class;
}

6
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -146,7 +146,7 @@ public class EndpointHandlerMappingTests { @@ -146,7 +146,7 @@ public class EndpointHandlerMappingTests {
}
private static class TestMvcEndpoint extends GenericMvcEndpoint {
private static class TestMvcEndpoint extends EndpointMvcAdapter {
public TestMvcEndpoint(TestEndpoint delegate) {
super(delegate);
@ -154,7 +154,7 @@ public class EndpointHandlerMappingTests { @@ -154,7 +154,7 @@ public class EndpointHandlerMappingTests {
}
private static class TestActionEndpoint extends GenericMvcEndpoint {
private static class TestActionEndpoint extends EndpointMvcAdapter {
public TestActionEndpoint(TestEndpoint delegate) {
super(delegate);

14
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisServer.java

@ -1,5 +1,5 @@ @@ -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.
@ -54,10 +54,9 @@ public class RedisServer implements TestRule { @@ -54,10 +54,9 @@ public class RedisServer implements TestRule {
try {
this.resource = obtainResource();
}
catch (Exception e) {
catch (Exception ex) {
maybeCleanup();
return failOrSkip(e);
return failOrSkip(ex);
}
return new Statement() {
@ -82,17 +81,18 @@ public class RedisServer implements TestRule { @@ -82,17 +81,18 @@ public class RedisServer implements TestRule {
};
}
private Statement failOrSkip(Exception e) {
private Statement failOrSkip(Exception exception) {
String serversRequired = System.getenv(EXTERNAL_SERVERS_REQUIRED);
if ("true".equalsIgnoreCase(serversRequired)) {
logger.error(this.resourceDescription + " IS REQUIRED BUT NOT AVAILABLE", e);
logger.error(this.resourceDescription + " IS REQUIRED BUT NOT AVAILABLE",
exception);
fail(this.resourceDescription + " IS NOT AVAILABLE");
// Never reached, here to satisfy method signature
return null;
}
else {
logger.error(this.resourceDescription + " IS NOT AVAILABLE, SKIPPING TESTS",
e);
exception);
return new Statement() {
@Override

1
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationReportLoggingInitializer.java

@ -40,7 +40,6 @@ import org.springframework.util.StringUtils; @@ -40,7 +40,6 @@ import org.springframework.util.StringUtils;
* the {@link AutoConfigurationReport} to the log. Reports are logged at the
* {@link LogLevel#DEBUG DEBUG} level unless there was a problem, in which case they are
* the {@link LogLevel#INFO INFO} level is used.
*
* <p>
* This initializer is not intended to be shared across multiple application context
* instances.

3
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java

@ -39,20 +39,17 @@ import org.springframework.core.io.support.SpringFactoriesLoader; @@ -39,20 +39,17 @@ import org.springframework.core.io.support.SpringFactoriesLoader;
* have {@code tomat-embedded.jar} on your classpath you are likely to want a
* {@link TomcatEmbeddedServletContainerFactory} (unless you have defined your own
* {@link EmbeddedServletContainerFactory} bean).
*
* <p>
* Auto-configuration tries to be as intelligent as possible and will back-away as you
* define more of your own configuration. You can always manually {@link #exclude()} any
* configuration that you never want to apply. Auto-configuration is always applied after
* user-defined beans have been registered.
*
* <p>
* The package of the class that is annotated with {@code @EnableAutoConfiguration} has
* specific significance and is often used as a 'default'. For example, it will be used
* when scanning for {@code @Entity} classes. It is generally recommended that you place
* {@code @EnableAutoConfiguration} in a root package so that all sub-packages and classes
* can be searched.
*
* <p>
* Auto-configuration classes are regular Spring {@link Configuration} beans. They are
* located using the {@link SpringFactoriesLoader} mechanism (keyed against this class).

15
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java

@ -33,6 +33,8 @@ import org.springframework.stereotype.Component; @@ -33,6 +33,8 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.PlatformTransactionManager;
/**
* Basic {@link BatchConfigurer} implementation.
*
* @author Dave Syer
*/
@Component
@ -41,15 +43,28 @@ public class BasicBatchConfigurer implements BatchConfigurer { @@ -41,15 +43,28 @@ public class BasicBatchConfigurer implements BatchConfigurer {
private static Log logger = LogFactory.getLog(BasicBatchConfigurer.class);
private DataSource dataSource;
private EntityManagerFactory entityManagerFactory;
private PlatformTransactionManager transactionManager;
private JobRepository jobRepository;
private JobLauncher jobLauncher;
/**
* Create a new {@link BasicBatchConfigurer} instance.
* @param dataSource the underlying data source
*/
public BasicBatchConfigurer(DataSource dataSource) {
this(dataSource, null);
}
/**
* Create a new {@link BasicBatchConfigurer} instance.
* @param dataSource the underlying data source
* @param entityManagerFactory the entity manager factory (or {@code null})
*/
public BasicBatchConfigurer(DataSource dataSource,
EntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;

5
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchDatabaseInitializer.java

@ -1,5 +1,5 @@ @@ -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.
@ -38,7 +38,8 @@ import org.springframework.stereotype.Component; @@ -38,7 +38,8 @@ import org.springframework.stereotype.Component;
@Component
public class BatchDatabaseInitializer implements EnvironmentAware {
private static final String DEFAULT_SCHEMA_LOCATION = "classpath:org/springframework/batch/core/schema-@@platform@@.sql";
private static final String DEFAULT_SCHEMA_LOCATION = "classpath:org/springframework/"
+ "batch/core/schema-@@platform@@.sql";
@Autowired
private DataSource dataSource;

24
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java

@ -1,5 +1,5 @@ @@ -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.
@ -198,16 +198,26 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit @@ -198,16 +198,26 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
if (this.types.isEmpty() && this.names.isEmpty()) {
addDeducedBeanType(context, metadata, this.types);
}
Assert.isTrue(
!this.types.isEmpty() || !this.names.isEmpty()
|| !this.annotations.isEmpty(),
"@"
+ ClassUtils.getShortName(annotationType)
+ " annotations must specify at least one bean (type, name or annotation)");
Assert.isTrue(hasAtLeastOne(this.types, this.names, this.annotations),
annotationName(annotationType) + " annotations must "
+ "specify at least one bean (type, name or annotation)");
this.strategy = (SearchStrategy) metadata.getAnnotationAttributes(
annotationType.getName()).get("search");
}
private boolean hasAtLeastOne(List<?>... lists) {
for (List<?> list : lists) {
if (!list.isEmpty()) {
return true;
}
}
return false;
}
private String annotationName(Class<?> annotationType) {
return "@" + ClassUtils.getShortName(annotationType);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private void collect(MultiValueMap<String, Object> attributes, String key,
List<String> destination) {

5
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java

@ -1,5 +1,5 @@ @@ -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.
@ -34,7 +34,8 @@ import org.springframework.web.context.support.StandardServletEnvironment; @@ -34,7 +34,8 @@ import org.springframework.web.context.support.StandardServletEnvironment;
*/
class OnWebApplicationCondition extends SpringBootCondition {
private static final String WEB_CONTEXT_CLASS = "org.springframework.web.context.support.GenericWebApplicationContext";
private static final String WEB_CONTEXT_CLASS = "org.springframework.web.context."
+ "support.GenericWebApplicationContext";
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,

22
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java

@ -1,5 +1,5 @@ @@ -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.
@ -31,9 +31,9 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -31,9 +31,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
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.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.ApplicationContext;
@ -177,6 +177,9 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { @@ -177,6 +177,9 @@ public class DataSourceAutoConfiguration implements EnvironmentAware {
}
/**
* Base {@link Condition} for non-embedded database checks.
*/
static abstract class NonEmbeddedDatabaseCondition extends SpringBootCondition {
protected abstract String getDataSourceClassName();
@ -243,6 +246,10 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { @@ -243,6 +246,10 @@ public class DataSourceAutoConfiguration implements EnvironmentAware {
}
}
/**
* {@link Condition} to detect when a commons-dbcp {@code BasicDataSource} backed
* database is used.
*/
static class BasicDatabaseCondition extends NonEmbeddedDatabaseCondition {
private Condition tomcatCondition = new TomcatDatabaseCondition();
@ -256,12 +263,15 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { @@ -256,12 +263,15 @@ public class DataSourceAutoConfiguration implements EnvironmentAware {
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
if (matches(context, metadata, this.tomcatCondition)) {
return ConditionOutcome.noMatch("tomcat DataSource");
return ConditionOutcome.noMatch("Tomcat DataSource");
}
return super.getMatchOutcome(context, metadata);
}
}
/**
* {@link Condition} to detect when a Tomcat DataSource backed database is used.
*/
static class TomcatDatabaseCondition extends NonEmbeddedDatabaseCondition {
@Override
@ -271,6 +281,9 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { @@ -271,6 +281,9 @@ public class DataSourceAutoConfiguration implements EnvironmentAware {
}
/**
* {@link Condition} to detect when an embedded database is used.
*/
static class EmbeddedDatabaseCondition extends SpringBootCondition {
private SpringBootCondition tomcatCondition = new TomcatDatabaseCondition();
@ -293,6 +306,9 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { @@ -293,6 +306,9 @@ public class DataSourceAutoConfiguration implements EnvironmentAware {
}
}
/**
* {@link Condition} to detect when a database is configured.
*/
static class DatabaseCondition extends SpringBootCondition {
private SpringBootCondition tomcatCondition = new TomcatDatabaseCondition();

10
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java

@ -80,16 +80,14 @@ public class JmsTemplateAutoConfiguration { @@ -80,16 +80,14 @@ public class JmsTemplateAutoConfiguration {
private ActiveMQConnectionFactoryProperties config;
@Bean
ConnectionFactory jmsConnectionFactory() {
public ConnectionFactory jmsConnectionFactory() {
if (this.config.isPooled()) {
PooledConnectionFactory pool = new PooledConnectionFactory();
pool.setConnectionFactory(new ActiveMQConnectionFactory(this.config
.getBrokerURL()));
return pool;
}
else {
return new ActiveMQConnectionFactory(this.config.getBrokerURL());
}
return new ActiveMQConnectionFactory(this.config.getBrokerURL());
}
}
@ -108,9 +106,7 @@ public class JmsTemplateAutoConfiguration { @@ -108,9 +106,7 @@ public class JmsTemplateAutoConfiguration {
if (this.inMemory) {
return "vm://localhost";
}
else {
return this.brokerURL;
}
return this.brokerURL;
}
public void setBrokerURL(String brokerURL) {

3
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfiguration.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 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.
@ -27,7 +27,6 @@ import org.springframework.jmx.export.MBeanExporter; @@ -27,7 +27,6 @@ import org.springframework.jmx.export.MBeanExporter;
/**
* {@link EnableAutoConfiguration Auto-configuration} to enable/disable Spring's
* {@link EnableMBeanExport} mechanism based on configuration properties.
*
* <p>
* To disable auto export of annotation beans set <code>spring.jmx.enabled: false</code>.
*

3
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfiguration.java

@ -1,5 +1,5 @@ @@ -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.
@ -48,7 +48,6 @@ public class ReactorAutoConfiguration { @@ -48,7 +48,6 @@ public class ReactorAutoConfiguration {
@ConditionalOnMissingBean(Environment.class)
@EnableReactor
protected static class ReactorConfiguration {
}
}

7
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java

@ -33,6 +33,11 @@ import org.springframework.security.config.annotation.ObjectPostProcessor; @@ -33,6 +33,11 @@ import org.springframework.security.config.annotation.ObjectPostProcessor;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.authentication.configurers.provisioning.InMemoryUserDetailsManagerConfigurer;
/**
* Configuration for a Spring Security in-memory {@link AuthenticationManager}.
*
* @author Dave Syer
*/
@Configuration
@ConditionalOnBean(ObjectPostProcessor.class)
@ConditionalOnMissingBean(AuthenticationManager.class)
@ -69,4 +74,4 @@ public class AuthenticationManagerConfiguration { @@ -69,4 +74,4 @@ public class AuthenticationManagerConfiguration {
}
}
}

8
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
package org.springframework.boot.autoconfigure.security;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@ -24,6 +25,11 @@ import org.springframework.context.annotation.Configuration; @@ -24,6 +25,11 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.security.authentication.AuthenticationManager;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Security.
*
* @author Dave Syer
*/
@Configuration
@ConditionalOnClass(AuthenticationManager.class)
@EnableConfigurationProperties
@ -37,4 +43,4 @@ public class SecurityAutoConfiguration { @@ -37,4 +43,4 @@ public class SecurityAutoConfiguration {
return new SecurityProperties();
}
}
}

69
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java

@ -87,7 +87,6 @@ import org.springframework.web.servlet.support.RequestDataValueProcessor; @@ -87,7 +87,6 @@ import org.springframework.web.servlet.support.RequestDataValueProcessor;
@ConditionalOnClass({ EnableWebSecurity.class })
@ConditionalOnMissingBean(WebSecurityConfiguration.class)
@ConditionalOnWebApplication
// @ConditionalOnMissingBean(annotation = EnableWebSecurity.class)
public class SpringBootWebSecurityConfiguration {
private static List<String> DEFAULT_IGNORED = Arrays.asList("/css/**", "/js/**",
@ -107,6 +106,39 @@ public class SpringBootWebSecurityConfiguration { @@ -107,6 +106,39 @@ public class SpringBootWebSecurityConfiguration {
return new IgnoredPathsWebSecurityConfigurerAdapter();
}
public static void configureHeaders(HeadersConfigurer<?> configurer,
SecurityProperties.Headers headers) throws Exception {
if (headers.getHsts() != Headers.HSTS.none) {
boolean includeSubdomains = headers.getHsts() == Headers.HSTS.all;
HstsHeaderWriter writer = new HstsHeaderWriter(includeSubdomains);
writer.setRequestMatcher(AnyRequestMatcher.INSTANCE);
configurer.addHeaderWriter(writer);
}
if (headers.isContentType()) {
configurer.contentTypeOptions();
}
if (headers.isXss()) {
configurer.xssProtection();
}
if (headers.isCache()) {
configurer.cacheControl();
}
if (headers.isFrame()) {
configurer.frameOptions();
}
}
public static List<String> getIgnored(SecurityProperties security) {
List<String> ignored = new ArrayList<String>(security.getIgnored());
if (ignored.isEmpty()) {
ignored.addAll(DEFAULT_IGNORED);
}
else if (ignored.contains("none")) {
ignored.remove("none");
}
return ignored;
}
// Get the ignored paths in early
@Order(Ordered.HIGHEST_PRECEDENCE)
private static class IgnoredPathsWebSecurityConfigurerAdapter implements
@ -135,10 +167,12 @@ public class SpringBootWebSecurityConfiguration { @@ -135,10 +167,12 @@ public class SpringBootWebSecurityConfiguration {
@ConditionalOnExpression("${security.basic.enabled:true}")
@Configuration
protected static class WebMvcSecurityConfigurationConditions {
@Configuration
@EnableWebMvcSecurity
protected static class DefaultWebMvcSecurityConfiguration {
}
}
// Pull in a plain @EnableWebSecurity if Spring MVC is not available
@ -223,37 +257,4 @@ public class SpringBootWebSecurityConfiguration { @@ -223,37 +257,4 @@ public class SpringBootWebSecurityConfiguration {
}
public static void configureHeaders(HeadersConfigurer<?> configurer,
SecurityProperties.Headers headers) throws Exception {
if (headers.getHsts() != Headers.HSTS.none) {
boolean includeSubdomains = headers.getHsts() == Headers.HSTS.all;
HstsHeaderWriter writer = new HstsHeaderWriter(includeSubdomains);
writer.setRequestMatcher(AnyRequestMatcher.INSTANCE);
configurer.addHeaderWriter(writer);
}
if (headers.isContentType()) {
configurer.contentTypeOptions();
}
if (headers.isXss()) {
configurer.xssProtection();
}
if (headers.isCache()) {
configurer.cacheControl();
}
if (headers.isFrame()) {
configurer.frameOptions();
}
}
public static List<String> getIgnored(SecurityProperties security) {
List<String> ignored = new ArrayList<String>(security.getIgnored());
if (ignored.isEmpty()) {
ignored.addAll(DEFAULT_IGNORED);
}
else if (ignored.contains("none")) {
ignored.remove("none");
}
return ignored;
}
}

2
spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java

@ -106,7 +106,7 @@ public final class CommandLineInvoker { @@ -106,7 +106,7 @@ public final class CommandLineInvoker {
lines.add(line);
}
}
catch (IOException e) {
catch (IOException ex) {
throw new RuntimeException("Failed to read standard output");
}
return lines;

7
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java

@ -112,11 +112,14 @@ public class CommandCompleter extends StringsCompleter { @@ -112,11 +112,14 @@ public class CommandCompleter extends StringsCompleter {
}
this.console.drawLine();
}
catch (IOException e) {
Log.error(e.getMessage() + " (" + e.getClass().getName() + ")");
catch (IOException ex) {
Log.error(ex.getMessage() + " (" + ex.getClass().getName() + ")");
}
}
/**
* Encapsulated options and usage help.
*/
private static class OptionHelpLine {
private final String options;

2
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiter.java

@ -20,7 +20,7 @@ import jline.console.completer.ArgumentCompleter.ArgumentList; @@ -20,7 +20,7 @@ import jline.console.completer.ArgumentCompleter.ArgumentList;
import jline.console.completer.ArgumentCompleter.WhitespaceArgumentDelimiter;
/**
* Escape ware variant of {@link WhitespaceArgumentDelimiter}.
* Escape aware variant of {@link WhitespaceArgumentDelimiter}.
*
* @author Phillip Webb
*/

4
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/RunProcessCommand.java

@ -103,7 +103,7 @@ class RunProcessCommand extends AbstractCommand { @@ -103,7 +103,7 @@ class RunProcessCommand extends AbstractCommand {
}
reader.close();
}
catch (Exception e) {
catch (Exception ex) {
}
};
}.start();
@ -135,7 +135,7 @@ class RunProcessCommand extends AbstractCommand { @@ -135,7 +135,7 @@ class RunProcessCommand extends AbstractCommand {
this.process = null;
return true;
}
catch (InterruptedException e) {
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}

3
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java

@ -64,8 +64,7 @@ import org.springframework.boot.cli.util.ResourceUtils; @@ -64,8 +64,7 @@ import org.springframework.boot.cli.util.ResourceUtils;
*
* <li>Generated class files can also be loaded using
* {@link ClassLoader#getResource(String)}</li>
*
* <ul>
* </ul>
*
* @author Phillip Webb
* @author Dave Syer

3
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java

@ -1,5 +1,5 @@ @@ -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.
@ -61,7 +61,6 @@ public final class RepositoryConfigurationFactory { @@ -61,7 +61,6 @@ public final class RepositoryConfigurationFactory {
/**
* Add the default local M2 cache directory as a remote repository. Only do this if
* the local cache location has been changed from the default.
*
* @param repositoryConfiguration
*/
public static void addDefaultCacheAsRespository(

8
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/JreProxySelector.java

@ -1,5 +1,5 @@ @@ -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.
@ -54,7 +54,7 @@ public final class JreProxySelector implements ProxySelector { @@ -54,7 +54,7 @@ public final class JreProxySelector implements ProxySelector {
URI uri = new URI(repository.getUrl()).parseServerAuthority();
proxies = java.net.ProxySelector.getDefault().select(uri);
}
catch (Exception e) {
catch (Exception ex) {
// URL invalid or not accepted by selector or no selector at all, simply use
// no proxy
}
@ -113,7 +113,7 @@ public final class JreProxySelector implements ProxySelector { @@ -113,7 +113,7 @@ public final class JreProxySelector implements ProxySelector {
try {
url = new URL(context.getRepository().getUrl());
}
catch (Exception e) {
catch (Exception ex) {
url = null;
}
@ -133,7 +133,7 @@ public final class JreProxySelector implements ProxySelector { @@ -133,7 +133,7 @@ public final class JreProxySelector implements ProxySelector {
System.getProperty("http.proxyPassword"));
}
}
catch (SecurityException e) {
catch (SecurityException ex) {
// oh well, let's hope the proxy can do without auth
}
}

4
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/ManagedDependenciesFactory.java

@ -28,5 +28,9 @@ import org.eclipse.aether.graph.Dependency; @@ -28,5 +28,9 @@ import org.eclipse.aether.graph.Dependency;
*/
public interface ManagedDependenciesFactory {
/**
* Returns the managed dependencies.
*/
List<Dependency> getManagedDependencies();
}

3
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositoryConfiguration.java

@ -34,8 +34,7 @@ public final class RepositoryConfiguration { @@ -34,8 +34,7 @@ public final class RepositoryConfiguration {
private final boolean snapshotsEnabled;
/**
* Creates a new {@code RepositoryConfiguration}.
*
* Creates a new {@code RepositoryConfiguration} instance.
* @param name The name of the repository
* @param uri The uri of the repository
* @param snapshotsEnabled {@code true} if the repository should enable access to

5
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/transformation/GroovyBeansTransformation.java

@ -1,5 +1,5 @@ @@ -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.
@ -101,7 +101,6 @@ public class GroovyBeansTransformation implements ASTTransformation { @@ -101,7 +101,6 @@ public class GroovyBeansTransformation implements ASTTransformation {
/**
* Extract a top-level <code>beans{}</code> closure from inside this block if
* there is one. Removes it from the block at the same time.
*
* @param block a block statement (class definition)
* @return a beans Closure if one can be found, null otherwise
*/
@ -128,9 +127,7 @@ public class GroovyBeansTransformation implements ASTTransformation { @@ -128,9 +127,7 @@ public class GroovyBeansTransformation implements ASTTransformation {
}
}
}
return null;
}
}
}

9
spring-boot-cli/src/main/java/org/springframework/boot/groovy/EnableDeviceResolver.java

@ -1,5 +1,5 @@ @@ -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.
@ -22,9 +22,14 @@ import java.lang.annotation.Retention; @@ -22,9 +22,14 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.boot.cli.compiler.autoconfigure.SpringMobileCompilerAutoConfiguration;
/**
* Pseudo annotation used to trigger {@link SpringMobileCompilerAutoConfiguration}.
*/
@Target(ElementType.TYPE)
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface EnableDeviceResolver {
}
}

8
spring-boot-cli/src/main/java/org/springframework/boot/groovy/EnableIntegrationPatterns.java

@ -1,5 +1,5 @@ @@ -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.
@ -22,9 +22,13 @@ import java.lang.annotation.Retention; @@ -22,9 +22,13 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.boot.cli.compiler.autoconfigure.SpringIntegrationCompilerAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
/**
* Pseudo annotation used to trigger {@link SpringIntegrationCompilerAutoConfiguration}.
*/
@Target(ElementType.TYPE)
@Documented
@Retention(RetentionPolicy.RUNTIME)
@ -32,4 +36,4 @@ import org.springframework.context.annotation.ImportResource; @@ -32,4 +36,4 @@ import org.springframework.context.annotation.ImportResource;
@ImportResource("classpath:/org/springframework/boot/groovy/integration.xml")
public @interface EnableIntegrationPatterns {
}
}

9
spring-boot-cli/src/main/java/org/springframework/boot/groovy/EnableJmsMessaging.java

@ -1,5 +1,5 @@ @@ -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.
@ -22,9 +22,14 @@ import java.lang.annotation.Retention; @@ -22,9 +22,14 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.boot.cli.compiler.autoconfigure.JmsCompilerAutoConfiguration;
/**
* Pseudo annotation used to trigger {@link JmsCompilerAutoConfiguration}.
*/
@Target(ElementType.TYPE)
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface EnableJmsMessaging {
}
}

4
spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java

@ -1,5 +1,5 @@ @@ -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.
@ -28,6 +28,8 @@ import java.util.Map; @@ -28,6 +28,8 @@ import java.util.Map;
import org.codehaus.groovy.control.CompilationFailedException;
/**
* Helpful utilties for working with Groovy {@link Template}s.
*
* @author Dave Syer
*/
public abstract class GroovyTemplate {

4
spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java

@ -50,9 +50,9 @@ public class SampleMongoApplicationTests { @@ -50,9 +50,9 @@ public class SampleMongoApplicationTests {
output.contains("firstName='Alice', lastName='Smith'"));
}
private boolean serverNotRunning(IllegalStateException e) {
private boolean serverNotRunning(IllegalStateException ex) {
@SuppressWarnings("serial")
NestedCheckedException nested = new NestedCheckedException("failed", e) {
NestedCheckedException nested = new NestedCheckedException("failed", ex) {
};
if (nested.contains(IOException.class)) {
Throwable root = nested.getRootCause();

12
spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPluginExtension.groovy

@ -1,5 +1,5 @@ @@ -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.
@ -19,11 +19,12 @@ package org.springframework.boot.gradle @@ -19,11 +19,12 @@ package org.springframework.boot.gradle
import org.springframework.boot.loader.tools.Layout
import org.springframework.boot.loader.tools.Layouts
/**
* Gradle DSL Extension for 'Spring Boot'. Most of the time Spring Boot can guess the
* settings in this extension, but occasionally you might need to explicitly set one
* or two of them. E.g.
*
*
* <pre>
* apply plugin: "spring-boot"
* springBoot {
@ -53,7 +54,7 @@ public class SpringBootPluginExtension { @@ -53,7 +54,7 @@ public class SpringBootPluginExtension {
String mainClass
/**
* The name of the ivy configuration name to treat as 'provided' (when packaging
* The name of the ivy configuration name to treat as 'provided' (when packaging
* those dependencies in a separate path). If not specified 'providedRuntime' will
* be used.
*/
@ -73,15 +74,14 @@ public class SpringBootPluginExtension { @@ -73,15 +74,14 @@ public class SpringBootPluginExtension {
* The layout of the archive if it can't be derived from the file extension.
* Valid values are JAR, WAR, ZIP, DIR (for exploded zip file). ZIP and DIR
* are actually synonymous, and should be used if there is no MANIFEST.MF
* available, or if you want the MANIFEST.MF 'Main-Class' to be
* PropertiesLauncher. Gradle will coerce literal String values to the
* available, or if you want the MANIFEST.MF 'Main-Class' to be
* PropertiesLauncher. Gradle will coerce literal String values to the
* correct type.
*/
LayoutType layout;
/**
* Convenience method for use in a custom task.
*
* @return the Layout to use or null if not explicitly set
*/
Layout convertLayout() {

19
spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/ProjectLibraries.java

@ -1,3 +1,18 @@ @@ -1,3 +1,18 @@
/*
* 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.gradle.task;
@ -13,7 +28,7 @@ import org.springframework.boot.loader.tools.LibraryScope; @@ -13,7 +28,7 @@ import org.springframework.boot.loader.tools.LibraryScope;
/**
* Expose Gradle {@link Configuration}s as {@link Libraries}.
*
*
* @author Phillip Webb
*/
class ProjectLibraries implements Libraries {
@ -26,7 +41,6 @@ class ProjectLibraries implements Libraries { @@ -26,7 +41,6 @@ class ProjectLibraries implements Libraries {
/**
* Create a new {@link ProjectLibraries} instance of the specified {@link Project}.
*
* @param project the gradle project
*/
public ProjectLibraries(Project project) {
@ -35,7 +49,6 @@ class ProjectLibraries implements Libraries { @@ -35,7 +49,6 @@ 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) {

4
spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/RunApp.java

@ -95,8 +95,8 @@ public class RunApp extends DefaultTask { @@ -95,8 +95,8 @@ public class RunApp extends DefaultTask {
getLogger().info("Looking for main in: " + main.getOutput().getClassesDir());
try {
return MainClassFinder.findMainClass(main.getOutput().getClassesDir());
} catch (IOException e) {
throw new IllegalStateException("Cannot find main class", e);
} catch (IOException ex) {
throw new IllegalStateException("Cannot find main class", ex);
}
}

4
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java

@ -51,7 +51,6 @@ import org.springframework.boot.loader.util.SystemPropertyUtils; @@ -51,7 +51,6 @@ import org.springframework.boot.loader.util.SystemPropertyUtils;
* {@link Launcher} for archives with user-configured classpath and main class via a
* properties file. This model is often more flexible and more amenable to creating
* well-behaved OS-level services than a model based on executable jars.
*
* <p>
* Looks in various places for a properties file to extract loader settings, defaulting to
* <code>application.properties</code> either on the current classpath or in the current
@ -62,7 +61,6 @@ import org.springframework.boot.loader.util.SystemPropertyUtils; @@ -62,7 +61,6 @@ import org.springframework.boot.loader.util.SystemPropertyUtils;
* <code>file:</code> or any valid URL). Once that file is located turns it into
* Properties and extracts optional values (which can also be provided overridden as
* System properties in case the file doesn't exist):
*
* <ul>
* <li><code>loader.path</code>: a comma-separated list of directories to append to the
* classpath (containing file resources and/or nested archives in *.jar or *.zip).
@ -345,7 +343,7 @@ public class PropertiesLauncher extends Launcher { @@ -345,7 +343,7 @@ public class PropertiesLauncher extends Launcher {
try {
return loaderClass.getConstructor(ClassLoader.class).newInstance(parent);
}
catch (NoSuchMethodException e) {
catch (NoSuchMethodException ex) {
// Ignore and try with URLs
}

5
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java

@ -1,5 +1,5 @@ @@ -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.
@ -28,11 +28,14 @@ import java.util.jar.Manifest; @@ -28,11 +28,14 @@ import java.util.jar.Manifest;
import org.springframework.boot.loader.AsciiBytes;
/**
* Decorator to apply an {@link Archive.EntryFilter} to an existing {@link Archive}.
*
* @author Dave Syer
*/
public class FilteredArchive extends Archive {
private Archive parent;
private EntryFilter filter;
public FilteredArchive(Archive parent, EntryFilter filter) {

18
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java

@ -1,5 +1,5 @@ @@ -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.
@ -22,14 +22,11 @@ import java.util.Set; @@ -22,14 +22,11 @@ import java.util.Set;
/**
* Helper class for resolving placeholders in texts. Usually applied to file paths.
*
* <p>
* A text may contain {@code $ ...} placeholders, to be resolved as system properties:
* e.g. {@code $ user.dir} . Default values can be supplied using the ":" separator
* between key and value.
*
* <p>
*
* Adapted from Spring.
*
* @author Juergen Hoeller
@ -40,13 +37,19 @@ import java.util.Set; @@ -40,13 +37,19 @@ import java.util.Set;
*/
public abstract class SystemPropertyUtils {
/** Prefix for system property placeholders: "${" */
/**
* Prefix for system property placeholders: "${"
*/
public static final String PLACEHOLDER_PREFIX = "${";
/** Suffix for system property placeholders: "}" */
/**
* Suffix for system property placeholders: "}"
*/
public static final String PLACEHOLDER_SUFFIX = "}";
/** Value separator for system property placeholders: ":" */
/**
* Value separator for system property placeholders: ":"
*/
public static final String VALUE_SEPARATOR = ":";
private static final String SIMPLE_PREFIX = PLACEHOLDER_PREFIX.substring(1);
@ -166,7 +169,6 @@ public abstract class SystemPropertyUtils { @@ -166,7 +169,6 @@ public abstract class SystemPropertyUtils {
* Search the System properties and environment variables for a value with the
* provided key. Environment variables in <code>UPPER_CASE</code> style are allowed
* where System properties would normally be <code>lower.case</code>.
*
* @param key the key to resolve
* @param text optional extra context for an error message if the key resolution fails
* (e.g. if System properties are not accessible)

6
spring-boot/src/main/java/org/springframework/boot/config/SimpleJsonParser.java

@ -1,5 +1,5 @@ @@ -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.
@ -88,14 +88,14 @@ public class SimpleJsonParser implements JsonParser { @@ -88,14 +88,14 @@ public class SimpleJsonParser implements JsonParser {
try {
return Long.valueOf(json);
}
catch (NumberFormatException e) {
catch (NumberFormatException ex) {
// ignore
}
try {
return Double.valueOf(json);
}
catch (NumberFormatException e) {
catch (NumberFormatException ex) {
// ignore
}

4
spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java

@ -109,8 +109,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { @@ -109,8 +109,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
ReflectionUtils.findMethod(connector.getClass(), "getLocalPort"),
connector)).toString();
}
catch (Exception e) {
return "could not determine port ( " + e.getMessage() + ")";
catch (Exception ex) {
return "could not determine port ( " + ex.getMessage() + ")";
}
}

6
spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java

@ -1,7 +1,5 @@ @@ -1,7 +1,5 @@
package org.springframework.boot.context.embedded.tomcat;
/*
* 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,6 +14,8 @@ package org.springframework.boot.context.embedded.tomcat; @@ -16,6 +14,8 @@ package org.springframework.boot.context.embedded.tomcat;
* limitations under the License.
*/
package org.springframework.boot.context.embedded.tomcat;
import org.apache.catalina.loader.WebappClassLoader;
/**

23
spring-boot/src/main/java/org/springframework/boot/test/package-info.java

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
/*
* 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.
*/
/**
* Classes and utilities that are useful when unit-testing Spring Boot applications.
* This package is only intended for use in 'src/test' and should not be used in your
* 'src/main' code.
*/
package org.springframework.boot.test;

21
spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java

@ -394,12 +394,14 @@ public class EnableConfigurationPropertiesTests { @@ -394,12 +394,14 @@ public class EnableConfigurationPropertiesTests {
@Configuration
protected static class DefaultConfiguration {
@Bean
public TestProperties testProperties() {
TestProperties test = new TestProperties();
test.setName("bar");
return test;
}
}
@Configuration
@ -410,10 +412,12 @@ public class EnableConfigurationPropertiesTests { @@ -410,10 +412,12 @@ public class EnableConfigurationPropertiesTests {
@EnableConfigurationProperties
@Configuration
public static class ExampleConfig {
@Bean
public External external() {
return new External();
}
}
@EnableConfigurationProperties(External.class)
@ -461,6 +465,7 @@ public class EnableConfigurationPropertiesTests { @@ -461,6 +465,7 @@ public class EnableConfigurationPropertiesTests {
@ConfigurationProperties(name = "spring_test_external")
public static class SystemEnvVar {
public String getVal() {
return this.val;
}
@ -475,6 +480,7 @@ public class EnableConfigurationPropertiesTests { @@ -475,6 +480,7 @@ public class EnableConfigurationPropertiesTests {
@Component
protected static class TestConsumer {
@Autowired
private TestProperties properties;
@ -495,7 +501,9 @@ public class EnableConfigurationPropertiesTests { @@ -495,7 +501,9 @@ public class EnableConfigurationPropertiesTests {
@ConfigurationProperties
protected static class NestedProperties {
private String name;
private Nested nested = new Nested();
public void setName(String name) {
@ -507,6 +515,7 @@ public class EnableConfigurationPropertiesTests { @@ -507,6 +515,7 @@ public class EnableConfigurationPropertiesTests {
}
protected static class Nested {
private String name;
public void setName(String name) {
@ -514,15 +523,18 @@ public class EnableConfigurationPropertiesTests { @@ -514,15 +523,18 @@ public class EnableConfigurationPropertiesTests {
}
}
}
@ConfigurationProperties
protected static class BaseProperties {
private String name;
public void setName(String name) {
this.name = name;
}
}
protected static class DerivedProperties extends BaseProperties {
@ -530,8 +542,11 @@ public class EnableConfigurationPropertiesTests { @@ -530,8 +542,11 @@ public class EnableConfigurationPropertiesTests {
@ConfigurationProperties
protected static class TestProperties {
private String name;
private int[] array;
private List<Integer> list = new ArrayList<Integer>();
// No getter - you should be able to bind to a write-only bean
@ -551,6 +566,7 @@ public class EnableConfigurationPropertiesTests { @@ -551,6 +566,7 @@ public class EnableConfigurationPropertiesTests {
public List<Integer> getList() {
return this.list;
}
}
@ConfigurationProperties(ignoreUnknownFields = false)
@ -559,12 +575,10 @@ public class EnableConfigurationPropertiesTests { @@ -559,12 +575,10 @@ public class EnableConfigurationPropertiesTests {
@ConfigurationProperties(name = "spring.foo")
protected static class EmbeddedTestProperties extends TestProperties {
}
@ConfigurationProperties(ignoreUnknownFields = false, ignoreNestedProperties = true)
protected static class IgnoreNestedTestProperties extends TestProperties {
}
@ConfigurationProperties
@ -600,6 +614,7 @@ public class EnableConfigurationPropertiesTests { @@ -600,6 +614,7 @@ public class EnableConfigurationPropertiesTests {
}
protected static class MoreProperties {
private String name;
public void setName(String name) {
@ -611,6 +626,7 @@ public class EnableConfigurationPropertiesTests { @@ -611,6 +626,7 @@ public class EnableConfigurationPropertiesTests {
@ConfigurationProperties(path = "${binding.location:classpath:name.yml}")
protected static class ResourceBindingProperties {
private String name;
public void setName(String name) {
@ -623,6 +639,7 @@ public class EnableConfigurationPropertiesTests { @@ -623,6 +639,7 @@ public class EnableConfigurationPropertiesTests {
@EnableConfigurationProperties
@ConfigurationProperties(path = "${binding.location:classpath:map.yml}")
protected static class ResourceBindingPropertiesWithMap {
private Map<String, String> mymap;
public void setMymap(Map<String, String> mymap) {

Loading…
Cancel
Save