Polish formatting

This commit is contained in:
Phillip Webb
2016-12-19 10:30:48 -08:00
parent e578ace7d7
commit bd74c3d327
346 changed files with 578 additions and 53 deletions

View File

@@ -30,9 +30,9 @@ import org.springframework.context.annotation.Configuration;
* standard {@code @Configuration} annotation so that configuration can be found
* automatically (for example in tests).
* <p>
* Application should only ever include <em>one</em>
* {@code @SpringBootConfiguration} and most idiomatic Spring Boot applications
* will inherit it from {@code @SpringBootApplication}.
* Application should only ever include <em>one</em> {@code @SpringBootConfiguration} and
* most idiomatic Spring Boot applications will inherit it from
* {@code @SpringBootApplication}.
*
* @author Phillip Webb
* @since 1.4.0

View File

@@ -28,7 +28,6 @@ import org.springframework.core.env.PropertySources;
* Convenience class for manipulating PropertySources.
*
* @author Dave Syer
*
* @see PropertySource
* @see PropertySources
*/

View File

@@ -224,6 +224,7 @@ public final class RelaxedNames implements Iterable<String> {
}
return builder.toString();
}
}
/**

View File

@@ -92,4 +92,5 @@ public class YamlJavaBeanPropertyConstructor extends Constructor {
}
}
}

View File

@@ -77,4 +77,5 @@ public class Compression {
public void setExcludedUserAgents(String[] excludedUserAgents) {
this.excludedUserAgents = excludedUserAgents;
}
}

View File

@@ -702,6 +702,7 @@ public class JettyEmbeddedServletContainerFactory
serverConnector.setPort(port);
return serverConnector;
}
}
/**

View File

@@ -96,6 +96,7 @@ public class ServletContextInitializerConfiguration extends AbstractConfiguratio
// Not available on Jetty 8
}
}
}
}

View File

@@ -157,6 +157,7 @@ abstract class TomcatResources {
}
}
}
}
/**

View File

@@ -482,4 +482,5 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine
}
}
}

View File

@@ -115,6 +115,7 @@ public class PoolingConnectionFactoryBean extends PoolingConnectionFactory
/**
* A {@link XAConnectionFactory} implementation that delegates to the
* {@link ThreadLocal} {@link PoolingConnectionFactoryBean}.
*
* @see PoolingConnectionFactoryBean#setConnectionFactory(XAConnectionFactory)
*/
public static class DirectXAConnectionFactory implements XAConnectionFactory {

View File

@@ -120,4 +120,5 @@ public class LogFile {
}
return null;
}
}

View File

@@ -85,7 +85,6 @@ public final class ColorConverter extends LogEventPatternConverter {
/**
* Creates a new instance of the class. Required by Log4J2.
*
* @param config the configuration
* @param options the options
* @return a new instance, or {@code null} if the options are invalid

View File

@@ -117,6 +117,7 @@ public class LevelRemappingAppender extends AppenderBase<ILoggingEvent> {
this.logger.callAppenders(event);
}
}
}
/**

View File

@@ -37,6 +37,7 @@ import org.springframework.core.env.Environment;
class SpringPropertyAction extends Action {
private static final String SOURCE_ATTRIBUTE = "source";
private static final String DEFAULT_VALUE_ATTRIBUTE = "defaultValue";
private final Environment environment;

View File

@@ -463,7 +463,6 @@ public class RestTemplateBuilder {
/**
* Sets the connect timeout in milliseconds on the underlying
* {@link ClientHttpRequestFactory}.
*
* @param connectTimeout the connect timeout in milliseconds
* @return a new builder instance.
*/
@@ -479,7 +478,6 @@ public class RestTemplateBuilder {
/**
* Sets the read timeout in milliseconds on the underlying
* {@link ClientHttpRequestFactory}.
*
* @param readTimeout the read timeout in milliseconds
* @return a new builder instance.
*/

View File

@@ -107,7 +107,9 @@ public class SpringProfileDocumentMatcher implements DocumentMatcher {
* Profile match types.
*/
enum ProfileType {
POSITIVE, NEGATIVE
}
/**

View File

@@ -30,6 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ApplicationPid}.
*
* @author Phillip Webb
*/
public class ApplicationPidTests {

View File

@@ -87,8 +87,10 @@ public class OverrideSourcesTests {
}
protected static class Service {
@Autowired
private TestBean bean;
}
protected static class TestBean {
@@ -100,4 +102,5 @@ public class OverrideSourcesTests {
}
}
}

View File

@@ -177,4 +177,5 @@ public class ReproTests {
public static class Config {
}
}

View File

@@ -293,10 +293,12 @@ public class SpringApplicationTests {
final AtomicReference<SpringApplication> reference = new AtomicReference<SpringApplication>();
class ApplicationReadyEventListener
implements ApplicationListener<ApplicationReadyEvent> {
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
reference.set(event.getSpringApplication());
}
}
application.addListeners(new ApplicationReadyEventListener());
this.context = application.run("--foo=bar");
@@ -309,10 +311,12 @@ public class SpringApplicationTests {
application.setWebEnvironment(false);
final AtomicReference<ApplicationContext> reference = new AtomicReference<ApplicationContext>();
class InitializerListener implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
reference.set(event.getApplicationContext());
}
}
application.setListeners(Arrays.asList(new InitializerListener()));
this.context = application.run("--foo=bar");
@@ -328,10 +332,12 @@ public class SpringApplicationTests {
final List<ApplicationEvent> events = new ArrayList<ApplicationEvent>();
class ApplicationRunningEventListener
implements ApplicationListener<ApplicationEvent> {
@Override
public void onApplicationEvent(ApplicationEvent event) {
events.add((event));
}
}
application.addListeners(new ApplicationRunningEventListener());
this.context = application.run();
@@ -1064,6 +1070,7 @@ public class SpringApplicationTests {
public void fail() {
throw new RefreshFailureException();
}
}
static class ExitStatusException extends RuntimeException

View File

@@ -233,6 +233,7 @@ public class BindingPreparationTests {
}
public static class TargetWithNestedMap {
private Map<String, Object> nested;
public Map<String, Object> getNested() {
@@ -242,9 +243,11 @@ public class BindingPreparationTests {
public void setNested(Map<String, Object> nested) {
this.nested = nested;
}
}
public static class TargetWithNestedMapOfListOfString {
private Map<String, List<String>> nested;
public Map<String, List<String>> getNested() {
@@ -254,9 +257,11 @@ public class BindingPreparationTests {
public void setNested(Map<String, List<String>> nested) {
this.nested = nested;
}
}
public static class TargetWithNestedListOfMaps {
private List<Map<String, String>> nested;
public List<Map<String, String>> getNested() {
@@ -266,9 +271,11 @@ public class BindingPreparationTests {
public void setNested(List<Map<String, String>> nested) {
this.nested = nested;
}
}
public static class TargetWithNestedListOfLists {
private List<List<String>> nested;
public List<List<String>> getNested() {
@@ -278,9 +285,11 @@ public class BindingPreparationTests {
public void setNested(List<List<String>> nested) {
this.nested = nested;
}
}
public static class TargetWithNestedListOfBeansWithList {
private List<TargetWithList> nested;
public List<TargetWithList> getNested() {
@@ -290,9 +299,11 @@ public class BindingPreparationTests {
public void setNested(List<TargetWithList> nested) {
this.nested = nested;
}
}
public static class TargetWithList {
private List<VanillaTarget> list;
public List<VanillaTarget> getList() {
@@ -306,6 +317,7 @@ public class BindingPreparationTests {
}
public static class TargetWithNestedMapOfBean {
private Map<String, VanillaTarget> nested;
public Map<String, VanillaTarget> getNested() {
@@ -315,6 +327,7 @@ public class BindingPreparationTests {
public void setNested(Map<String, VanillaTarget> nested) {
this.nested = nested;
}
}
public static class VanillaTarget {

View File

@@ -113,6 +113,7 @@ public class PropertiesConfigurationFactoryMapTests {
// Foo needs to be public and to have setters for all properties
public static class Foo {
private Map<String, Object> map = new HashMap<String, Object>();
public Map<String, Object> getMap() {
@@ -122,6 +123,7 @@ public class PropertiesConfigurationFactoryMapTests {
public void setMap(Map<String, Object> map) {
this.map = map;
}
}
}

View File

@@ -228,6 +228,7 @@ public class PropertiesConfigurationFactoryTests {
// Foo needs to be public and to have setters for all properties
public static class Foo {
@NotNull
private String name;

View File

@@ -96,10 +96,12 @@ public class PropertySourcesBindingTests {
@PropertySources({ @PropertySource("classpath:/override.properties"),
@PropertySource("classpath:/some.properties") })
public static class SomeConfig {
}
@ConfigurationProperties
public static class Wrapper {
private String foo;
private String bar;
@@ -139,6 +141,7 @@ public class PropertySourcesBindingTests {
public void setTheName(String theName) {
this.theName = theName;
}
}
}

View File

@@ -852,6 +852,7 @@ public class RelaxedDataBinderTests {
public void setNested(Map<Bingo, Object> nested) {
this.nested = nested;
}
}
public static class TargetWithNestedMapOfListOfString {
@@ -1101,7 +1102,9 @@ public class RelaxedDataBinderTests {
}
enum Bingo {
THIS, or, THAT, THE_OTHER, THAT_OTHER
}
public static class ValidatedTarget {

View File

@@ -100,13 +100,18 @@ public class YamlConfigurationFactoryTests {
}
private static class Foo {
@NotNull
public String name;
public String bar;
}
private static class Jee {
public Map<Object, Object> mymap;
}
}

View File

@@ -358,5 +358,7 @@ public class SpringApplicationBuilderTests {
public ApplicationContext getParent() {
return this.applicationContext.getParent();
}
}
}

View File

@@ -132,4 +132,5 @@ public class CloudFoundryVcapEnvironmentPostProcessorTests {
private String getProperty(String key) {
return this.context.getEnvironment().getProperty(key);
}
}

View File

@@ -33,7 +33,9 @@ import org.springframework.test.context.support.TestPropertySourceUtils;
public class FileEncodingApplicationListenerTests {
private final FileEncodingApplicationListener initializer = new FileEncodingApplicationListener();
private final ConfigurableEnvironment environment = new StandardEnvironment();
private final ApplicationEnvironmentPreparedEvent event = new ApplicationEnvironmentPreparedEvent(
new SpringApplication(), new String[0], this.environment);

View File

@@ -93,6 +93,7 @@ public class AnsiOutputApplicationListenerTests {
@Configuration
public static class Config {
}
}

View File

@@ -83,12 +83,14 @@ public class DelegatingApplicationListenerTests {
@Order(Ordered.HIGHEST_PRECEDENCE)
private static class MockInitA implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) event
.getApplicationContext();
applicationContext.getBeanFactory().registerSingleton("a", "a");
}
}
@Order(Ordered.LOWEST_PRECEDENCE)
@@ -102,6 +104,7 @@ public class DelegatingApplicationListenerTests {
.isEqualTo("a");
applicationContext.getBeanFactory().registerSingleton("b", "b");
}
}
}

View File

@@ -22,4 +22,5 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan
public class InDefaultPackageConfiguration {
}

View File

@@ -23,4 +23,5 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackageClasses = ExampleBean.class)
public class InDefaultPackageWithBasePackageClassesConfiguration {
}

View File

@@ -22,4 +22,5 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackages = "org.springframework.boot.context.configwarnings.nested")
public class InDefaultPackageWithBasePackagesConfiguration {
}

View File

@@ -22,4 +22,5 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@MetaComponentScan
public class InDefaultPackageWithMetaAnnotationConfiguration {
}

View File

@@ -22,4 +22,5 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan("org.springframework.boot.context.configwarnings.nested")
public class InDefaultPackageWithValueConfiguration {
}

View File

@@ -20,4 +20,5 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class InDefaultPackageWithoutScanConfiguration {
}

View File

@@ -22,4 +22,5 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan
public class InOrgSpringPackageConfiguration {
}

View File

@@ -22,4 +22,5 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan
public class InRealPackageConfiguration {
}

View File

@@ -210,4 +210,5 @@ public class AnnotationConfigEmbeddedWebApplicationContextTests {
}
}
}

View File

@@ -121,28 +121,34 @@ public class EmbeddedServletContainerMvcIntegrationTests {
@Configuration
@Import(Config.class)
public static class TomcatConfig {
@Bean
public EmbeddedServletContainerFactory containerFactory() {
return new TomcatEmbeddedServletContainerFactory(0);
}
}
@Configuration
@Import(Config.class)
public static class JettyConfig {
@Bean
public EmbeddedServletContainerFactory containerFactory() {
return new JettyEmbeddedServletContainerFactory(0);
}
}
@Configuration
@Import(Config.class)
public static class UndertowConfig {
@Bean
public EmbeddedServletContainerFactory containerFactory() {
return new UndertowEmbeddedServletContainerFactory(0);
}
}
@Configuration
@@ -161,6 +167,7 @@ public class EmbeddedServletContainerMvcIntegrationTests {
public HelloWorldController helloWorldController() {
return new HelloWorldController();
}
}
@Configuration
@@ -201,6 +208,7 @@ public class EmbeddedServletContainerMvcIntegrationTests {
public HelloWorldController helloWorldController() {
return new HelloWorldController();
}
}
@Controller

View File

@@ -47,4 +47,5 @@ public class ExampleFilter implements Filter {
chain.doFilter(request, response);
response.getWriter().write("]");
}
}

View File

@@ -200,6 +200,7 @@ public class MockEmbeddedServletContainerFactory
}
private static class EmptyEnumeration<E> implements Enumeration<E> {
static final EmptyEnumeration<Object> EMPTY_ENUMERATION = new EmptyEnumeration<Object>();
@Override
@@ -211,6 +212,7 @@ public class MockEmbeddedServletContainerFactory
public E nextElement() {
throw new NoSuchElementException();
}
}
}
@@ -233,6 +235,7 @@ public class MockEmbeddedServletContainerFactory
public Servlet getServlet() {
return this.servlet;
}
}
public static class RegisteredFilter {
@@ -253,5 +256,7 @@ public class MockEmbeddedServletContainerFactory
public Filter getFilter() {
return this.filter;
}
}
}

View File

@@ -87,4 +87,5 @@ public class XmlEmbeddedWebApplicationContextTests {
Servlet servlet = this.context.getBean(Servlet.class);
verify(containerFactory.getServletContext()).addServlet("servlet", servlet);
}
}

View File

@@ -522,6 +522,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
public void setFoo(String foo) {
this.foo = foo;
}
}
public static class CustomPropertyValidator implements Validator {
@@ -600,7 +601,9 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
}
enum FooEnum {
FOO, BAZ, BAR
}
@Configuration

View File

@@ -755,6 +755,7 @@ public class EnableConfigurationPropertiesTests {
}
// No getter - you should be able to bind to a write-only bean
}
// No annotation
@@ -782,6 +783,7 @@ public class EnableConfigurationPropertiesTests {
}
// No getter - you should be able to bind to a write-only bean
}
@EnableConfigurationProperties

View File

@@ -94,6 +94,7 @@ public class FailureAnalyzersTests {
public FailureAnalysis analyze(Throwable failure) {
return null;
}
}
interface BeanFactoryAwareFailureAnalyzer extends BeanFactoryAware, FailureAnalyzer {

View File

@@ -82,6 +82,7 @@ public class BeanNotOfRequiredTypeFailureAnalyzerTests {
public AsyncBean asyncBean() {
return new AsyncBean();
}
}
@Configuration

View File

@@ -73,8 +73,7 @@ public class DatabaseDriverTests {
.isEqualTo(DatabaseDriver.UNKNOWN);
assertThat(DatabaseDriver.fromProductName("Apache Derby"))
.isEqualTo(DatabaseDriver.DERBY);
assertThat(DatabaseDriver.fromProductName("H2"))
.isEqualTo(DatabaseDriver.H2);
assertThat(DatabaseDriver.fromProductName("H2")).isEqualTo(DatabaseDriver.H2);
assertThat(DatabaseDriver.fromProductName("HSQL Database Engine"))
.isEqualTo(DatabaseDriver.HSQLDB);
assertThat(DatabaseDriver.fromProductName("SQLite"))
@@ -122,8 +121,9 @@ public class DatabaseDriverTests {
.isEqualTo(DatabaseDriver.ORACLE);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:postgresql://127.0.0.1:5432/sample"))
.isEqualTo(DatabaseDriver.POSTGRESQL);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:jtds:sqlserver://127.0.0.1:1433/sample"))
.isEqualTo(DatabaseDriver.JTDS);
assertThat(
DatabaseDriver.fromJdbcUrl("jdbc:jtds:sqlserver://127.0.0.1:1433/sample"))
.isEqualTo(DatabaseDriver.JTDS);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:sqlserver://127.0.0.1:1433"))
.isEqualTo(DatabaseDriver.SQLSERVER);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:firebirdsql://localhost/sample"))
@@ -134,8 +134,9 @@ public class DatabaseDriverTests {
.isEqualTo(DatabaseDriver.DB2_AS400);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:teradata://localhost/SAMPLE"))
.isEqualTo(DatabaseDriver.TERADATA);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-sqli://localhost:1533/sample"))
.isEqualTo(DatabaseDriver.INFORMIX);
assertThat(
DatabaseDriver.fromJdbcUrl("jdbc:informix-sqli://localhost:1533/sample"))
.isEqualTo(DatabaseDriver.INFORMIX);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-direct://sample"))
.isEqualTo(DatabaseDriver.INFORMIX);
}

View File

@@ -37,7 +37,9 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ColorConverterTests {
private ColorConverter converter;
private LoggingEvent event;
private final String in = "in";
@BeforeClass
@@ -132,4 +134,5 @@ public class ColorConverterTests {
String out = this.converter.transform(this.event, this.in);
assertThat(out).isEqualTo("\033[32min\033[0;39m");
}
}

View File

@@ -108,4 +108,5 @@ public class LevelRemappingAppenderTests {
}
}
}

View File

@@ -107,12 +107,14 @@ public class EntityScanTests {
@EntityScan("com.mycorp.entity")
@SuppressWarnings("deprecation")
static class ValueConfig extends BaseConfig {
}
@Configuration
@EntityScan("com.mycorp.entity")
@SuppressWarnings("deprecation")
static class MissingEntityManager {
}
@Configuration
@@ -144,6 +146,7 @@ public class EntityScanTests {
};
}
}
private static class TestLocalContainerEntityManagerFactoryBean

View File

@@ -156,6 +156,7 @@ public class FilteredClassPathRunner extends BlockJUnit4ClassRunner {
}
return false;
}
}
/**

View File

@@ -44,4 +44,5 @@ public class MockFilter implements Filter {
@Override
public void destroy() {
}
}

View File

@@ -126,10 +126,12 @@ public class SpringBootServletInitializerTests {
SpringApplicationBuilder application) {
return application.sources(Config.class);
}
}
@Configuration
public class WithConfigurationAnnotation extends MockSpringBootServletInitializer {
}
public class WithConfiguredSource extends MockSpringBootServletInitializer {