From c9fb9916b83133bd7e6dee9bdd7b27d175f495ab Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 7 Oct 2015 23:37:10 -0700 Subject: [PATCH] Reformat code using Eclipse Mars --- .../hypermedia/EndpointDocumentation.java | 14 +- .../autoconfigure/CrshAutoConfiguration.java | 41 ++-- .../EndpointMBeanExportAutoConfiguration.java | 3 +- .../EndpointWebMvcAutoConfiguration.java | 61 +++--- ...dpointWebMvcChildContextConfiguration.java | 8 +- ...ermediaManagementContextConfiguration.java | 25 +-- ...tWebMvcManagementContextConfiguration.java | 4 +- .../HealthIndicatorAutoConfiguration.java | 10 +- .../JolokiaAutoConfiguration.java | 4 +- ...ntContextConfigurationsImportSelector.java | 8 +- ...anagementWebSecurityAutoConfiguration.java | 33 ++-- .../MetricExportAutoConfiguration.java | 5 +- .../MetricsDropwizardAutoConfiguration.java | 9 +- .../actuate/autoconfigure/MetricsFilter.java | 6 +- .../OnEnabledHealthIndicatorCondition.java | 4 +- .../PublicMetricsAutoConfiguration.java | 4 +- .../AbstractJmxCacheStatisticsProvider.java | 7 +- .../ConcurrentMapCacheStatisticsProvider.java | 4 +- .../cache/GuavaCacheStatisticsProvider.java | 3 +- .../HazelcastCacheStatisticsProvider.java | 4 +- .../InfinispanCacheStatisticsProvider.java | 11 +- .../cache/JCacheCacheStatisticsProvider.java | 8 +- .../condition/OnEnabledEndpointCondition.java | 8 +- .../actuate/endpoint/CachePublicMetrics.java | 8 +- ...ConfigurationPropertiesReportEndpoint.java | 24 +-- .../boot/actuate/endpoint/Sanitizer.java | 3 +- .../actuate/endpoint/jmx/EndpointMBean.java | 3 +- .../endpoint/jmx/EndpointMBeanExporter.java | 12 +- .../mvc/AbstractEndpointMvcAdapter.java | 4 +- .../mvc/ActuatorHalBrowserEndpoint.java | 7 +- .../endpoint/mvc/ActuatorHalJsonEndpoint.java | 4 +- .../actuate/endpoint/mvc/MvcEndpoints.java | 9 +- .../health/CassandraHealthIndicator.java | 4 +- .../health/DataSourceHealthIndicator.java | 8 +- .../health/ElasticsearchHealthIndicator.java | 4 +- .../aggregate/AggregateMetricReader.java | 11 +- .../metrics/buffer/BufferMetricReader.java | 3 +- .../export/AbstractMetricExporter.java | 4 +- .../metrics/export/MetricExporters.java | 3 +- .../SpringIntegrationMetricReader.java | 27 +-- .../opentsdb/OpenTsdbMetricWriter.java | 8 +- .../repository/InMemoryMetricRepository.java | 4 +- .../metrics/statsd/StatsdMetricWriter.java | 4 +- .../system/ApplicationPidFileWriter.java | 16 +- ...CacheStatisticsAutoConfigurationTests.java | 41 ++-- .../EndpointMvcIntegrationTests.java | 8 +- .../EndpointWebMvcAutoConfigurationTests.java | 42 +++-- ...HealthIndicatorAutoConfigurationTests.java | 36 ++-- ...althMvcEndpointAutoConfigurationTests.java | 8 +- .../JolokiaAutoConfigurationTests.java | 9 +- ...ContextPathHypermediaIntegrationTests.java | 16 +- ...mentWebSecurityAutoConfigurationTests.java | 38 ++-- .../MetricExportAutoConfigurationTests.java | 8 +- ...etricRepositoryAutoConfigurationTests.java | 4 +- .../PublicMetricsAutoConfigurationTests.java | 19 +- ...ContextPathHypermediaIntegrationTests.java | 3 +- .../ServerPortHypermediaIntegrationTests.java | 3 +- .../SpringApplicationHierarchyTests.java | 8 +- .../VanillaHypermediaIntegrationTests.java | 12 +- .../endpoint/EnvironmentEndpointTests.java | 20 +- .../jmx/EndpointMBeanExporterTests.java | 107 +++++------ .../mvc/EnvironmentMvcEndpointTests.java | 4 +- .../endpoint/mvc/HealthMvcEndpointTests.java | 44 ++--- .../mvc/MvcEndpointCorsIntegrationTests.java | 82 ++++---- .../mvc/MvcEndpointIntegrationTests.java | 12 +- .../endpoint/mvc/MvcEndpointsTests.java | 8 +- .../ElasticsearchHealthIndicatorTests.java | 31 +-- .../health/JmsHealthIndicatorTests.java | 8 +- .../buffer/BufferMetricReaderTests.java | 3 +- .../buffer/DefaultGaugeServiceSpeedTests.java | 4 +- .../DropwizardMetricServicesTests.java | 3 +- .../RedisMultiMetricRepositoryTests.java | 33 ++-- .../statsd/StatsdMetricWriterTests.java | 5 +- .../system/ApplicationPidFileWriterTests.java | 22 ++- ...ractDependsOnBeanFactoryPostProcessor.java | 9 +- ...EnableAutoConfigurationImportSelector.java | 7 +- .../MessageSourceAutoConfiguration.java | 25 +-- ...gApplicationAdminJmxAutoConfiguration.java | 4 +- .../batch/BatchAutoConfiguration.java | 6 +- .../cache/CacheAutoConfiguration.java | 11 +- .../autoconfigure/cache/CacheCondition.java | 4 +- .../cache/CacheConfigurations.java | 5 +- .../cache/JCacheCacheConfiguration.java | 12 +- .../condition/AbstractNestedCondition.java | 4 +- .../condition/AllNestedConditions.java | 9 +- .../condition/OnBeanCondition.java | 38 ++-- .../condition/OnResourceCondition.java | 6 +- .../condition/ResourceCondition.java | 8 +- ...draRepositoriesAutoConfigureRegistrar.java | 4 +- .../ElasticsearchAutoConfiguration.java | 1 + ...yManagerFactoryDependsOnPostProcessor.java | 4 +- ...ientDependsOnBeanFactoryPostProcessor.java | 4 +- .../mongo/MongoDataAutoConfiguration.java | 4 +- .../data/redis/RedisAutoConfiguration.java | 16 +- .../flyway/FlywayAutoConfiguration.java | 4 +- .../h2/H2ConsoleAutoConfiguration.java | 4 +- ...ediaHttpMessageConverterConfiguration.java | 10 +- .../HazelcastConfigResourceCondition.java | 4 +- .../jackson/JacksonAutoConfiguration.java | 28 +-- .../jdbc/DataSourceProperties.java | 13 +- .../jdbc/EmbeddedDatabaseConnection.java | 3 +- .../DataSourcePoolMetadataProviders.java | 4 +- .../boot/autoconfigure/jms/JmsProperties.java | 5 +- ...ArtemisConnectionFactoryConfiguration.java | 4 +- .../ArtemisConnectionFactoryFactory.java | 12 +- ...temisXAConnectionFactoryConfiguration.java | 8 +- .../jooq/JooqAutoConfiguration.java | 7 +- .../jooq/JooqExceptionTranslator.java | 4 +- ...ConfigurationReportLoggingInitializer.java | 30 +-- .../mail/JndiSessionConfiguration.java | 5 +- .../EmbeddedMongoAutoConfiguration.java | 23 +-- .../orm/jpa/EntityManagerFactoryBuilder.java | 8 +- .../AuthenticationManagerConfiguration.java | 3 +- .../security/SecurityProperties.java | 3 +- ...Auth2AuthorizationServerConfiguration.java | 12 +- .../OAuth2RestOperationsConfiguration.java | 3 +- .../client/OAuth2SsoCustomConfiguration.java | 24 +-- .../client/OAuth2SsoDefaultConfiguration.java | 19 +- .../oauth2/client/SsoSecurityConfigurer.java | 8 +- .../OAuth2MethodSecurityConfiguration.java | 14 +- .../OAuth2ResourceServerConfiguration.java | 16 +- .../resource/ResourceServerProperties.java | 4 +- ...ourceServerTokenServicesConfiguration.java | 33 ++-- .../resource/SpringSocialTokenServices.java | 4 +- ...ImportAutoConfigurationImportSelector.java | 3 +- .../web/BasicErrorController.java | 3 +- .../DispatcherServletAutoConfiguration.java | 19 +- .../web/ErrorMvcAutoConfiguration.java | 4 +- ...sonHttpMessageConvertersConfiguration.java | 4 +- .../web/OnEnabledResourceChainCondition.java | 4 +- .../autoconfigure/web/ResourceProperties.java | 1 + .../autoconfigure/web/ServerProperties.java | 18 +- .../ServerPropertiesAutoConfiguration.java | 8 +- .../web/WebMvcAutoConfiguration.java | 11 +- .../WebSocketMessagingAutoConfiguration.java | 7 +- ...eAutoConfigurationImportSelectorTests.java | 38 ++-- ...icationAdminJmxAutoConfigurationTests.java | 17 +- .../cache/CacheAutoConfigurationTests.java | 78 ++++---- .../cache/support/MockCachingProvider.java | 4 +- .../ConditionalOnSingleCandidateTests.java | 8 +- .../condition/ResourceConditionTests.java | 4 +- .../CassandraDataAutoConfigurationTests.java | 3 +- ...draRepositoriesAutoConfigurationTests.java | 3 +- .../redis/RedisAutoConfigurationTests.java | 19 +- .../flyway/FlywayAutoConfigurationTests.java | 6 +- .../GroovyTemplateAutoConfigurationTests.java | 11 +- ...soleAutoConfigurationIntegrationTests.java | 4 +- .../HypermediaAutoConfigurationTests.java | 11 +- .../JacksonAutoConfigurationTests.java | 89 +++++---- .../DataSourceAutoConfigurationTests.java | 4 +- ...nsactionManagerAutoConfigurationTests.java | 4 +- .../jms/JmsAutoConfigurationTests.java | 4 +- .../ArtemisAutoConfigurationTests.java | 9 +- .../jooq/JooqAutoConfigurationTests.java | 45 ++--- ...gurationReportLoggingInitializerTests.java | 4 +- .../MailSenderAutoConfigurationTests.java | 8 +- ...ingViewResolverAutoConfigurationTests.java | 14 +- .../DeviceResolverAutoConfigurationTests.java | 4 +- .../SitePreferenceAutoConfigurationTests.java | 12 +- .../mongo/MongoPropertiesTests.java | 6 +- .../EmbeddedMongoAutoConfigurationTests.java | 17 +- .../AbstractJpaAutoConfigurationTests.java | 10 +- .../HibernateJpaAutoConfigurationTests.java | 29 +-- .../SecurityAutoConfigurationTests.java | 51 +++-- ...ringBootWebSecurityConfigurationTests.java | 47 +++-- .../oauth2/OAuth2AutoConfigurationTests.java | 52 ++--- .../ResourceServerPropertiesTests.java | 4 +- ...ServerTokenServicesConfigurationTests.java | 4 +- .../resource/UserInfoTokenServicesTests.java | 18 +- .../sso/MinimalSecureWebConfiguration.java | 8 +- .../SendGridAutoConfigurationTests.java | 11 +- ...tAutoConfigurationImportSelectorTests.java | 4 +- .../ThymeleafAutoConfigurationTests.java | 4 +- .../VelocityAutoConfigurationTests.java | 20 +- ...asicErrorControllerDirectMockMvcTests.java | 14 +- .../BasicErrorControllerIntegrationTests.java | 32 ++-- .../web/BasicErrorControllerMockMvcTests.java | 6 +- .../web/DefaultErrorViewIntegrationTests.java | 15 +- .../web/ServerPropertiesTests.java | 57 +++--- .../web/WebMvcAutoConfigurationTests.java | 92 ++++----- .../web/WelcomePageMockMvcTests.java | 14 +- ...SocketMessagingAutoConfigurationTests.java | 17 +- .../boot/cli/CommandLineIT.java | 4 +- .../boot/cli/command/init/InitCommand.java | 29 ++- .../boot/cli/command/jar/JarCommand.java | 25 ++- .../options/CompilerOptionHandler.java | 2 +- .../AnnotatedNodeASTTransformation.java | 4 +- .../boot/cli/compiler/AstUtils.java | 3 +- ...DependencyManagementBomTransformation.java | 35 ++-- .../boot/cli/compiler/GroovyCompiler.java | 38 ++-- .../boot/cli/compiler/MavenSettings.java | 33 ++-- .../cli/compiler/MavenSettingsReader.java | 11 +- .../RepositoryConfigurationFactory.java | 8 +- .../cli/compiler/SmartImportCustomizer.java | 3 +- .../ReactorCompilerAutoConfiguration.java | 8 +- .../SpringRetryCompilerAutoConfiguration.java | 6 +- ...ringSecurityCompilerAutoConfiguration.java | 3 +- ...curityOAuth2CompilerAutoConfiguration.java | 7 +- ...ManagementArtifactCoordinatesResolver.java | 4 +- .../MavenModelDependencyManagement.java | 4 +- ...gBootDependenciesDependencyManagement.java | 4 +- ...ositorySystemSessionAutoConfiguration.java | 4 +- .../grape/SummaryProgressReporter.java | 6 +- .../boot/cli/GrabCommandIntegrationTests.java | 6 +- .../init/ProjectGenerationRequestTests.java | 5 +- .../compiler/DependencyCustomizerTests.java | 42 +++-- .../RepositoryConfigurationFactoryTests.java | 49 +++-- ...endencyCoordinatesTransformationTests.java | 11 +- .../CompositeDependencyManagementTests.java | 33 ++-- ...ementArtifactCoordinatesResolverTests.java | 4 +- .../grape/AetherGrapeEngineTests.java | 10 +- ...rySystemSessionAutoConfigurationTests.java | 65 +++---- .../devtools/RemoteUrlPropertyExtractor.java | 4 +- .../autoconfigure/DevToolsProperties.java | 4 +- .../FileWatchingFailureHandler.java | 4 +- .../LocalDevToolsAutoConfiguration.java | 4 +- .../OptionalLiveReloadServer.java | 4 +- .../RemoteDevToolsAutoConfiguration.java | 11 +- .../classpath/ClassPathFileSystemWatcher.java | 4 +- ...DevToolsPropertyDefaultsPostProcessor.java | 1 + .../devtools/filewatch/FileSystemWatcher.java | 4 +- .../devtools/filewatch/FolderSnapshot.java | 11 +- .../boot/devtools/livereload/Connection.java | 8 +- .../client/ClassPathChangeUploader.java | 16 +- .../client/RemoteClientConfiguration.java | 12 +- .../restart/DefaultRestartInitializer.java | 11 +- .../restart/RestartApplicationListener.java | 4 +- .../restart/RestartScopeInitializer.java | 4 +- .../boot/devtools/restart/Restarter.java | 8 +- .../classloader/RestartClassLoader.java | 3 +- .../restart/server/HttpRestartServer.java | 3 +- .../restart/server/RestartServer.java | 3 +- .../tunnel/client/HttpTunnelConnection.java | 8 +- .../devtools/tunnel/client/TunnelClient.java | 4 +- .../tunnel/server/HttpTunnelServer.java | 24 +-- .../server/RemoteDebugPortProvider.java | 7 +- .../server/SocketTargetServerConnection.java | 4 +- .../DevToolsPropertiesTests.java | 6 +- .../LocalDevToolsAutoConfigurationTests.java | 4 +- .../RemoteDevToolsAutoConfigurationTests.java | 7 +- .../ClassPathFileChangeListenerTests.java | 3 +- .../ClassPathFileSystemWatcherTests.java | 7 +- .../PatternClassPathRestartStrategyTests.java | 3 +- ...ToolsHomePropertiesPostProcessorTests.java | 8 +- .../filewatch/FileSystemWatcherTests.java | 4 +- .../filewatch/FolderSnapshotTests.java | 4 +- .../client/ClassPathChangeUploaderTests.java | 4 +- .../client/DelayedLiveReloadTriggerTests.java | 13 +- .../remote/server/DispatcherTests.java | 4 +- .../devtools/restart/ChangeableUrlsTests.java | 8 +- .../DefaultRestartInitializerTests.java | 3 +- .../devtools/restart/MainMethodTests.java | 4 +- .../boot/devtools/restart/MockRestarter.java | 3 +- .../RestartApplicationListenerTests.java | 7 +- .../restart/RestartScopeInitializerTests.java | 4 +- .../classloader/ClassLoaderFilesTests.java | 4 +- .../classloader/RestartClassLoaderTests.java | 22 ++- .../DefaultSourceFolderUrlFilterTests.java | 8 +- .../test/MockClientHttpRequestFactory.java | 8 +- .../payload/HttpTunnelPayloadTests.java | 4 +- .../tunnel/server/HttpTunnelServerTests.java | 8 +- .../boot/gradle/SpringLoadedTests.java | 11 +- .../springframework/boot/gradle/Versions.java | 18 +- .../boot/gradle/WarPackagingTests.java | 20 +- .../log4j/SampleActuatorApplicationTests.java | 8 +- .../sample/ant/SampleAntApplicationIT.java | 6 +- .../java/sample/cache/CacheManagerCheck.java | 3 +- .../main/java/sample/cache/SampleClient.java | 4 +- ...OrderedCassandraTestExecutionListener.java | 4 +- .../java/sample/devtools/MyController.java | 4 +- ...ermediaJpaApplicationIntegrationTests.java | 4 +- .../SampleHypermediaUiApplicationTests.java | 19 +- ...pleHypermediaApplicationHomePageTests.java | 14 +- .../jetty/SampleJettyApplicationTests.java | 9 +- .../jetty8/SampleJetty8ApplicationTests.java | 9 +- .../SampleJetty93ApplicationTests.java | 13 +- .../main/java/sample/jooq/domain/Keys.java | 3 +- .../main/java/sample/jooq/domain/Public.java | 3 +- .../main/java/sample/jooq/domain/Tables.java | 3 +- .../sample/jooq/domain/tables/Author.java | 3 +- .../java/sample/jooq/domain/tables/Book.java | 3 +- .../sample/jooq/domain/tables/BookStore.java | 6 +- .../jooq/domain/tables/BookToBookStore.java | 3 +- .../sample/jooq/domain/tables/Language.java | 3 +- .../domain/tables/records/AuthorRecord.java | 7 +- .../domain/tables/records/BookRecord.java | 7 +- .../tables/records/BookStoreRecord.java | 7 +- .../tables/records/BookToBookStoreRecord.java | 3 +- .../domain/tables/records/LanguageRecord.java | 7 +- .../jooq/SampleJooqApplicationTests.java | 6 +- .../redis/AggregateMetricsConfiguration.java | 5 +- .../redis/SampleRedisExportApplication.java | 4 +- .../SampleParentContextApplication.java | 4 +- .../SamplePropertyValidationApplication.java | 4 +- .../SampleSecureOAuth2ApplicationTests.java | 21 +-- .../sso/SampleOAuth2SsoApplicationTests.java | 5 +- .../secure/SampleSecureApplicationTests.java | 3 +- .../tomcat/SampleTomcatApplicationTests.java | 9 +- .../SampleUndertowApplicationTests.java | 9 +- .../github/SampleGithubApplicationTests.java | 4 +- .../boot/ant/FindMainClass.java | 8 +- .../ConfigurationMetadataProperty.java | 4 +- ...gurationMetadataRepositoryJsonBuilder.java | 14 +- .../DescriptionExtractor.java | 4 +- .../configurationmetadata/JsonReader.java | 16 +- .../RawConfigurationMetadata.java | 3 +- ...SimpleConfigurationMetadataRepository.java | 4 +- .../boot/configurationmetadata/ValueHint.java | 4 +- .../configurationmetadata/ValueProvider.java | 4 +- .../AbstractConfigurationMetadataTests.java | 4 +- ...ionMetadataRepositoryJsonBuilderTests.java | 38 ++-- .../DescriptionExtractorTests.java | 16 +- .../JsonReaderTests.java | 7 +- ...figurationMetadataAnnotationProcessor.java | 35 ++-- .../configurationprocessor/MetadataStore.java | 3 +- .../fieldvalues/javac/ExpressionTree.java | 9 +- .../metadata/ConfigurationMetadata.java | 3 +- .../metadata/JsonMarshaller.java | 4 +- ...ationMetadataAnnotationProcessorTests.java | 178 +++++++----------- .../ConfigurationMetadataMatchers.java | 20 +- .../metadata/JsonMarshallerTests.java | 25 +-- .../boot/loader/tools/JarWriter.java | 4 +- .../boot/loader/tools/Repackager.java | 4 +- .../boot/loader/tools/RunProcess.java | 3 +- .../boot/loader/tools/RepackagerTests.java | 13 +- .../boot/loader/jar/JarFile.java | 3 +- .../ExecutableArchiveLauncherTests.java | 7 +- .../boot/maven/AbstractRunMojo.java | 37 ++-- .../boot/maven/RepackageMojo.java | 12 +- .../springframework/boot/maven/RunMojo.java | 4 +- .../maven/SpringApplicationAdminClient.java | 8 +- .../springframework/boot/maven/StartMojo.java | 28 +-- .../springframework/boot/maven/StopMojo.java | 11 +- .../boot/maven/DependencyFilterMojoTests.java | 4 +- .../springframework/boot/maven/Verify.java | 13 +- .../springframework/boot/ApplicationTemp.java | 4 +- .../boot/SpringApplication.java | 56 +++--- ...SpringApplicationAdminMXBeanRegistrar.java | 9 +- .../boot/ansi/AnsiPropertySource.java | 4 +- .../DefaultPropertyNamePatternsMatcher.java | 3 +- .../boot/bind/OriginCapablePropertyValue.java | 4 +- .../PatternPropertyNamePatternsMatcher.java | 4 +- .../bind/PropertiesConfigurationFactory.java | 7 +- .../bind/PropertySourcesPropertyValues.java | 4 +- ...edBindingNotWritablePropertyException.java | 4 +- .../boot/bind/RelaxedDataBinder.java | 26 +-- ...udFoundryVcapEnvironmentPostProcessor.java | 7 +- .../VcapEnvironmentPostProcessor.java | 4 +- ...ontextIdApplicationContextInitializer.java | 4 +- .../config/AnsiOutputApplicationListener.java | 4 +- .../ConfigFileEnvironmentPostProcessor.java | 52 ++--- ...tConfigurableEmbeddedServletContainer.java | 6 +- .../JettyEmbeddedServletContainerFactory.java | 84 +++++---- .../tomcat/TomcatEmbeddedContext.java | 5 +- ...TomcatEmbeddedServletContainerFactory.java | 40 ++-- .../undertow/FileSessionPersistence.java | 10 +- .../UndertowEmbeddedServletContainer.java | 19 +- .../properties/ConfigurationProperties.java | 6 +- ...urationPropertiesBindingPostProcessor.java | 37 ++-- ...ConfigurationPropertiesImportSelector.java | 23 ++- .../web/OrderedHiddenHttpMethodFilter.java | 3 +- .../web/OrderedHttpPutFormContentFilter.java | 7 +- ...PortInfoApplicationContextInitializer.java | 19 +- ...mentPostProcessingApplicationListener.java | 8 +- .../boot/logging/AbstractLoggingSystem.java | 7 +- .../ClasspathLoggingApplicationListener.java | 8 +- .../boot/logging/log4j2/ColorConverter.java | 2 + .../logging/logback/LogbackLoggingSystem.java | 9 +- .../logback/SpringBootJoranConfigurator.java | 4 +- .../logging/logback/SpringProfileAction.java | 4 +- .../logging/logback/SpringPropertyAction.java | 3 +- .../orm/jpa/EntityManagerFactoryBuilder.java | 12 +- .../IntegrationTestPropertiesListener.java | 3 +- .../MergedContextConfigurationProperties.java | 4 +- .../test/SpringApplicationContextLoader.java | 34 ++-- .../boot/test/TestRestTemplate.java | 20 +- .../web/servlet/ServletComponentHandler.java | 7 +- ...vletComponentRegisteringPostProcessor.java | 5 +- .../ServletComponentScanRegistrar.java | 12 +- .../boot/web/servlet/WebFilterHandler.java | 7 +- .../boot/web/servlet/WebListenerHandler.java | 4 +- .../boot/web/servlet/WebServletHandler.java | 4 +- .../boot/yaml/ArrayDocumentMatcher.java | 4 +- .../DefaultApplicationArgumentsTests.java | 9 +- .../boot/OverrideSourcesTests.java | 8 +- .../boot/SpringApplicationTests.java | 85 +++++---- .../boot/ansi/AnsiPropertySourceTests.java | 3 +- ...faultPropertyNamePatternsMatcherTests.java | 20 +- ...onfigurationFactoryParameterizedTests.java | 5 +- .../boot/bind/RelaxedDataBinderTests.java | 4 +- ...ndryVcapEnvironmentPostProcessorTests.java | 104 +++++----- ...nfigFileEnvironmentPostProcessorTests.java | 122 ++++++------ ...tEmbeddedServletContainerFactoryTests.java | 82 ++++---- ...yEmbeddedServletContainerFactoryTests.java | 8 +- ...tEmbeddedServletContainerFactoryTests.java | 7 +- .../undertow/FileSessionPersistenceTests.java | 8 +- .../SpringBootServletInitializerTests.java | 7 +- .../LoggingApplicationListenerTests.java | 14 +- .../logging/java/JavaLoggingSystemTests.java | 11 +- .../log4j2/Log4J2LoggingSystemTests.java | 34 ++-- .../logback/LogbackLoggingSystemTests.java | 24 +-- .../jpa/EntityManagerFactoryBuilderTests.java | 4 +- .../ServletComponentScanIntegrationTests.java | 4 +- .../ServletComponentScanRegistrarTests.java | 14 +- .../web/servlet/WebFilterHandlerTests.java | 30 +-- .../web/servlet/WebListenerHandlerTests.java | 4 +- .../web/servlet/WebServletHandlerTests.java | 19 +- .../servlet/testcomponents/TestServlet.java | 7 +- 408 files changed, 2831 insertions(+), 2652 deletions(-) diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java index 0331c2399a..c10b465397 100644 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java +++ b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java @@ -113,19 +113,19 @@ public class EndpointDocumentation { final List endpoints = new ArrayList(); model.put("endpoints", endpoints); for (MvcEndpoint endpoint : getEndpoints()) { - final String endpointPath = StringUtils.hasText(endpoint.getPath()) ? endpoint - .getPath() : "/"; + final String endpointPath = StringUtils.hasText(endpoint.getPath()) + ? endpoint.getPath() : "/"; if (!endpointPath.equals("/docs") && !endpointPath.equals("/logfile")) { String output = endpointPath.substring(1); output = output.length() > 0 ? output : "./"; - this.mockMvc - .perform(get(endpointPath).accept(MediaType.APPLICATION_JSON)) + this.mockMvc.perform(get(endpointPath).accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(document(output)) .andDo(new ResultHandler() { @Override public void handle(MvcResult mvcResult) throws Exception { - EndpointDoc endpoint = new EndpointDoc(docs, endpointPath); + EndpointDoc endpoint = new EndpointDoc(docs, + endpointPath); endpoints.add(endpoint); } }); @@ -135,8 +135,8 @@ public class EndpointDocumentation { file.getParentFile().mkdirs(); PrintWriter writer = new PrintWriter(file, "UTF-8"); try { - Template template = this.templates.createTemplate(new File( - "src/restdoc/resources/templates/endpoints.adoc.tpl")); + Template template = this.templates.createTemplate( + new File("src/restdoc/resources/templates/endpoints.adoc.tpl")); template.make(model).writeTo(writer); } finally { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java index bf95683503..a7dd5a8df4 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java @@ -103,11 +103,11 @@ import org.springframework.util.StringUtils; * infrastructure add beans of type {@link CrshShellProperties} to the application * context. *

- * Additional shell commands can be implemented using the guide and documentation at crashub.org. By default Boot will search for commands - * using the following classpath scanning pattern {@code classpath*:/commands/**}. To add - * different locations or override the default use {@code shell.command_path_patterns} in - * your application configuration. + * Additional shell commands can be implemented using the guide and documentation at + * crashub.org. By default Boot will search for + * commands using the following classpath scanning pattern {@code classpath*:/commands/**} + * . To add different locations or override the default use + * {@code shell.command_path_patterns} in your application configuration. * * @author Christian Dupuis * @see ShellProperties @@ -179,8 +179,8 @@ public class CrshAutoConfiguration { // ConfigurationProperties. SpringAuthenticationProperties authenticationProperties = new SpringAuthenticationProperties(); if (this.management != null) { - authenticationProperties.setRoles(new String[] { this.management - .getSecurity().getRole() }); + authenticationProperties.setRoles( + new String[] { this.management.getSecurity().getRole() }); } return authenticationProperties; } @@ -239,8 +239,8 @@ public class CrshAutoConfiguration { pathPattern, this.resourceLoader, filterPatterns))); } catch (IOException ex) { - throw new IllegalStateException("Failed to mount file system for '" - + pathPattern + "'", ex); + throw new IllegalStateException( + "Failed to mount file system for '" + pathPattern + "'", ex); } } return fileSystem; @@ -272,9 +272,9 @@ public class CrshAutoConfiguration { private static class AuthenticationManagerAdapter extends CRaSHPlugin implements AuthenticationPlugin { - private static final PropertyDescriptor ROLES = PropertyDescriptor - .create("auth.spring.roles", "ADMIN", - "Comma separated list of roles required to access the shell"); + private static final PropertyDescriptor ROLES = PropertyDescriptor.create( + "auth.spring.roles", "ADMIN", + "Comma separated list of roles required to access the shell"); @Autowired private AuthenticationManager authenticationManager; @@ -346,8 +346,8 @@ public class CrshAutoConfiguration { * {@link ServiceLoaderDiscovery} to expose {@link CRaSHPlugin} Beans from Spring and * deal with filtering disabled plugins. */ - private static class BeanFactoryFilteringPluginDiscovery extends - ServiceLoaderDiscovery { + private static class BeanFactoryFilteringPluginDiscovery + extends ServiceLoaderDiscovery { private final ListableBeanFactory beanFactory; @@ -355,7 +355,7 @@ public class CrshAutoConfiguration { BeanFactoryFilteringPluginDiscovery(ClassLoader classLoader, ListableBeanFactory beanFactory, String[] disabledPlugins) - throws NullPointerException { + throws NullPointerException { super(classLoader); this.beanFactory = beanFactory; this.disabledPlugins = disabledPlugins; @@ -372,8 +372,8 @@ public class CrshAutoConfiguration { } } - Collection pluginBeans = this.beanFactory.getBeansOfType( - CRaSHPlugin.class).values(); + Collection pluginBeans = this.beanFactory + .getBeansOfType(CRaSHPlugin.class).values(); for (CRaSHPlugin pluginBean : pluginBeans) { if (isEnabled(pluginBean)) { plugins.add(pluginBean); @@ -404,8 +404,8 @@ public class CrshAutoConfiguration { private boolean isEnabled(Class pluginClass) { for (String disabledPlugin : this.disabledPlugins) { if (ClassUtils.getShortName(pluginClass).equalsIgnoreCase(disabledPlugin) - || ClassUtils.getQualifiedName(pluginClass).equalsIgnoreCase( - disabledPlugin)) { + || ClassUtils.getQualifiedName(pluginClass) + .equalsIgnoreCase(disabledPlugin)) { return false; } } @@ -506,7 +506,8 @@ public class CrshAutoConfiguration { Resource[] resources = this.resourceLoader.getResources(getName()); List files = new ArrayList(); for (Resource resource : resources) { - if (!resource.getURL().getPath().endsWith("/") && !shouldFilter(resource)) { + if (!resource.getURL().getPath().endsWith("/") + && !shouldFilter(resource)) { files.add(new FileHandle(resource.getFilename(), resource)); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfiguration.java index b300d92776..3645b6c705 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfiguration.java @@ -60,7 +60,8 @@ public class EndpointMBeanExportAutoConfiguration { @Bean public EndpointMBeanExporter endpointMBeanExporter(MBeanServer server) { - EndpointMBeanExporter mbeanExporter = new EndpointMBeanExporter(this.objectMapper); + EndpointMBeanExporter mbeanExporter = new EndpointMBeanExporter( + this.objectMapper); String domain = this.properties.getDomain(); if (StringUtils.hasText(domain)) { mbeanExporter.setDomain(domain); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java index 8830a38fa2..2d131767f3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java @@ -95,8 +95,8 @@ import org.springframework.web.servlet.DispatcherServlet; ManagementServerPropertiesAutoConfiguration.class, RepositoryRestMvcAutoConfiguration.class, HypermediaAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class }) -public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, - BeanFactoryAware, SmartInitializingSingleton { +public class EndpointWebMvcAutoConfiguration + implements ApplicationContextAware, BeanFactoryAware, SmartInitializingSingleton { private static final Log logger = LogFactory .getLog(EndpointWebMvcAutoConfiguration.class); @@ -138,8 +138,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, public void afterSingletonsInstantiated() { ManagementServerPort managementPort = ManagementServerPort.DIFFERENT; if (this.applicationContext instanceof WebApplicationContext) { - managementPort = ManagementServerPort.get( - this.applicationContext.getEnvironment(), this.beanFactory); + managementPort = ManagementServerPort + .get(this.applicationContext.getEnvironment(), this.beanFactory); } if (managementPort == ManagementServerPort.DIFFERENT && this.applicationContext instanceof EmbeddedWebApplicationContext @@ -147,10 +147,10 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, .getEmbeddedServletContainer() != null) { createChildManagementContext(); } - if (managementPort == ManagementServerPort.SAME - && this.applicationContext.getEnvironment() instanceof ConfigurableEnvironment) { - addLocalManagementPortPropertyAlias((ConfigurableEnvironment) this.applicationContext - .getEnvironment()); + if (managementPort == ManagementServerPort.SAME && this.applicationContext + .getEnvironment() instanceof ConfigurableEnvironment) { + addLocalManagementPortPropertyAlias( + (ConfigurableEnvironment) this.applicationContext.getEnvironment()); } } @@ -163,8 +163,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, PropertyPlaceholderAutoConfiguration.class, EmbeddedServletContainerAutoConfiguration.class, DispatcherServletAutoConfiguration.class); - CloseEventPropagationListener - .addIfPossible(this.applicationContext, childContext); + CloseEventPropagationListener.addIfPossible(this.applicationContext, + childContext); try { childContext.refresh(); managementContextResolver().setApplicationContext(childContext); @@ -174,8 +174,9 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, // and this is the signature of that happening if (ex instanceof EmbeddedServletContainerException || ex.getCause() instanceof EmbeddedServletContainerException) { - logger.warn("Could not start embedded management container (management endpoints " - + "are still available through JMX)"); + logger.warn( + "Could not start embedded management container (management endpoints " + + "are still available through JMX)"); logger.debug("Embedded management container startup failed", ex); } else { @@ -191,8 +192,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, */ private void addLocalManagementPortPropertyAlias( final ConfigurableEnvironment environment) { - environment.getPropertySources().addLast( - new PropertySource("Management Server") { + environment.getPropertySources() + .addLast(new PropertySource("Management Server") { @Override public Object getProperty(String name) { if ("local.management.port".equals(name)) { @@ -239,7 +240,7 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) - throws ServletException, IOException { + throws ServletException, IOException { if (this.properties == null) { this.properties = this.applicationContext .getBean(ManagementServerProperties.class); @@ -257,8 +258,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, * {@link ApplicationListener} to propagate the {@link ContextClosedEvent} from a * parent to a child. */ - private static class CloseEventPropagationListener implements - ApplicationListener { + private static class CloseEventPropagationListener + implements ApplicationListener { private final ApplicationContext parentContext; @@ -286,14 +287,14 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, private static void add(ConfigurableApplicationContext parentContext, ConfigurableApplicationContext childContext) { - parentContext.addApplicationListener(new CloseEventPropagationListener( - parentContext, childContext)); + parentContext.addApplicationListener( + new CloseEventPropagationListener(parentContext, childContext)); } } - private static class OnManagementMvcCondition extends SpringBootCondition implements - ConfigurationCondition { + private static class OnManagementMvcCondition extends SpringBootCondition + implements ConfigurationCondition { @Override public ConfigurationPhase getConfigurationPhase() { @@ -306,8 +307,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, if (!(context.getResourceLoader() instanceof WebApplicationContext)) { return ConditionOutcome.noMatch("Non WebApplicationContext"); } - ManagementServerPort port = ManagementServerPort.get( - context.getEnvironment(), context.getBeanFactory()); + ManagementServerPort port = ManagementServerPort.get(context.getEnvironment(), + context.getBeanFactory()); return new ConditionOutcome(port == ManagementServerPort.SAME, "Management context"); } @@ -321,17 +322,15 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, public static ManagementServerPort get(Environment environment, BeanFactory beanFactory) { Integer serverPort = getPortProperty(environment, "server."); - if (serverPort == null - && hasCustomBeanDefinition(beanFactory, ServerProperties.class, - ServerPropertiesAutoConfiguration.class)) { + if (serverPort == null && hasCustomBeanDefinition(beanFactory, + ServerProperties.class, ServerPropertiesAutoConfiguration.class)) { ServerProperties bean = beanFactory.getBean(ServerProperties.class); serverPort = bean.getPort(); } Integer managementPort = getPortProperty(environment, "management."); - if (managementPort == null - && hasCustomBeanDefinition(beanFactory, - ManagementServerProperties.class, - ManagementServerPropertiesAutoConfiguration.class)) { + if (managementPort == null && hasCustomBeanDefinition(beanFactory, + ManagementServerProperties.class, + ManagementServerPropertiesAutoConfiguration.class)) { ManagementServerProperties bean = beanFactory .getBean(ManagementServerProperties.class); managementPort = bean.getPort(); @@ -342,7 +341,7 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, return ((managementPort == null) || (serverPort == null && managementPort.equals(8080)) || (managementPort != 0 && managementPort.equals(serverPort)) ? SAME - : DIFFERENT); + : DIFFERENT); } private static Integer getPortProperty(Environment environment, String prefix) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java index 9d6efedd13..7ea6cac1c9 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java @@ -159,8 +159,8 @@ public class EndpointWebMvcChildContextConfiguration { */ @Configuration @ConditionalOnClass(WebSecurityConfigurerAdapter.class) - protected static class SecureEndpointHandlerMappingConfiguration extends - EndpointHandlerMappingConfiguration { + protected static class SecureEndpointHandlerMappingConfiguration + extends EndpointHandlerMappingConfiguration { @Override protected void postProcessMapping(ListableBeanFactory beanFactory, @@ -203,8 +203,8 @@ public class EndpointWebMvcChildContextConfiguration { } - static class ServerCustomization implements EmbeddedServletContainerCustomizer, - Ordered { + static class ServerCustomization + implements EmbeddedServletContainerCustomizer, Ordered { @Autowired private ListableBeanFactory beanFactory; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java index 18f694cece..621faf2659 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java @@ -146,7 +146,8 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { * Controller advice that adds links to the actuator endpoint's path. */ @ControllerAdvice - public static class ActuatorEndpointLinksAdvice implements ResponseBodyAdvice { + public static class ActuatorEndpointLinksAdvice + implements ResponseBodyAdvice { @Autowired private MvcEndpoints endpoints; @@ -187,8 +188,8 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { } private void beforeBodyWrite(Object body, ServletServerHttpRequest request) { - Object pattern = request.getServletRequest().getAttribute( - HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); + Object pattern = request.getServletRequest() + .getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); if (pattern != null && body instanceof ResourceSupport) { beforeBodyWrite(pattern.toString(), (ResourceSupport) body); } @@ -196,15 +197,14 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { private void beforeBodyWrite(String path, ResourceSupport body) { if (isActuatorEndpointPath(path)) { - this.linksEnhancer - .addEndpointLinks(body, this.actuatorEndpoint.getPath()); + this.linksEnhancer.addEndpointLinks(body, + this.actuatorEndpoint.getPath()); } } private boolean isActuatorEndpointPath(String path) { - return this.actuatorEndpoint != null - && (this.management.getContextPath() + this.actuatorEndpoint - .getPath()).equals(path); + return this.actuatorEndpoint != null && (this.management.getContextPath() + + this.actuatorEndpoint.getPath()).equals(path); } } @@ -293,13 +293,14 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { private boolean isHypermediaDisabled(MethodParameter returnType) { return AnnotationUtils.findAnnotation(returnType.getMethod(), HypermediaDisabled.class) != null - || AnnotationUtils.findAnnotation(returnType.getMethod() - .getDeclaringClass(), HypermediaDisabled.class) != null; + || AnnotationUtils.findAnnotation( + returnType.getMethod().getDeclaringClass(), + HypermediaDisabled.class) != null; } private String getPath(ServletServerHttpRequest request) { - String path = (String) request.getServletRequest().getAttribute( - HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); + String path = (String) request.getServletRequest() + .getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); return (path == null ? "" : path); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfiguration.java index bd667edbff..e9793f9806 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfiguration.java @@ -139,8 +139,8 @@ public class EndpointWebMvcManagementContextConfiguration { boolean secure = (security != null && security.isEnabled()); HealthMvcEndpoint healthMvcEndpoint = new HealthMvcEndpoint(delegate, secure); if (this.healthMvcEndpointProperties.getMapping() != null) { - healthMvcEndpoint.addStatusMapping(this.healthMvcEndpointProperties - .getMapping()); + healthMvcEndpoint + .addStatusMapping(this.healthMvcEndpointProperties.getMapping()); } return healthMvcEndpoint; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java index 8d2fcde4f1..d2a6d4522b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java @@ -134,8 +134,8 @@ public class HealthIndicatorAutoConfiguration { @SuppressWarnings("unchecked") protected H createHealthIndicator(S source) { - Class[] generics = ResolvableType.forClass( - CompositeHealthIndicatorConfiguration.class, getClass()) + Class[] generics = ResolvableType + .forClass(CompositeHealthIndicatorConfiguration.class, getClass()) .resolveGenerics(); Class indicatorClass = (Class) generics[0]; Class sourceClass = (Class) generics[1]; @@ -211,8 +211,7 @@ public class HealthIndicatorAutoConfiguration { @Configuration @ConditionalOnBean(RedisConnectionFactory.class) @ConditionalOnEnabledHealthIndicator("redis") - public static class RedisHealthIndicatorConfiguration - extends + public static class RedisHealthIndicatorConfiguration extends CompositeHealthIndicatorConfiguration { @Autowired @@ -281,8 +280,7 @@ public class HealthIndicatorAutoConfiguration { @Configuration @ConditionalOnBean(JavaMailSenderImpl.class) @ConditionalOnEnabledHealthIndicator("mail") - public static class MailHealthIndicatorConfiguration - extends + public static class MailHealthIndicatorConfiguration extends CompositeHealthIndicatorConfiguration { @Autowired(required = false) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java index 21ddc6a1e4..19dbf1a5d4 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java @@ -50,8 +50,8 @@ import org.springframework.core.type.AnnotatedTypeMetadata; * *

* Additional configuration parameters for Jolokia can be provided by specifying - * {@code jolokia.config.*} properties. See the http://jolokia.org web site for more information on + * {@code jolokia.config.*} properties. See the + * http://jolokia.org web site for more information on * supported configuration parameters. * * @author Christian Dupuis diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementContextConfigurationsImportSelector.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementContextConfigurationsImportSelector.java index 513e2ed002..a28c479e2b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementContextConfigurationsImportSelector.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementContextConfigurationsImportSelector.java @@ -39,16 +39,16 @@ import org.springframework.core.type.AnnotationMetadata; * @see ManagementContextConfiguration */ @Order(Ordered.LOWEST_PRECEDENCE) -class ManagementContextConfigurationsImportSelector implements DeferredImportSelector, - BeanClassLoaderAware { +class ManagementContextConfigurationsImportSelector + implements DeferredImportSelector, BeanClassLoaderAware { private ClassLoader classLoader; @Override public String[] selectImports(AnnotationMetadata metadata) { // Find all possible auto configuration classes, filtering duplicates - List factories = new ArrayList(new LinkedHashSet( - SpringFactoriesLoader.loadFactoryNames( + List factories = new ArrayList( + new LinkedHashSet(SpringFactoriesLoader.loadFactoryNames( ManagementContextConfiguration.class, this.classLoader))); AnnotationAwareOrderComparator.sort(factories); return factories.toArray(new String[0]); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java index bc37835061..8e2aefa12f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java @@ -101,8 +101,8 @@ public class ManagementWebSecurityAutoConfiguration { } @Configuration - protected static class ManagementSecurityPropertiesConfiguration implements - SecurityPrerequisite { + protected static class ManagementSecurityPropertiesConfiguration + implements SecurityPrerequisite { @Autowired(required = false) private SecurityProperties security; @@ -122,8 +122,8 @@ public class ManagementWebSecurityAutoConfiguration { // Get the ignored paths in early @Order(SecurityProperties.IGNORED_ORDER + 1) - private static class IgnoredPathsWebSecurityConfigurerAdapter implements - WebSecurityConfigurer { + private static class IgnoredPathsWebSecurityConfigurerAdapter + implements WebSecurityConfigurer { @Autowired(required = false) private ErrorController errorController; @@ -152,8 +152,8 @@ public class ManagementWebSecurityAutoConfiguration { List ignored = SpringBootWebSecurityConfiguration .getIgnored(this.security); if (!this.management.getSecurity().isEnabled()) { - ignored.addAll(Arrays.asList(EndpointPaths.ALL - .getPaths(this.endpointHandlerMapping))); + ignored.addAll(Arrays + .asList(EndpointPaths.ALL.getPaths(this.endpointHandlerMapping))); } if (ignored.contains("none")) { ignored.remove("none"); @@ -192,12 +192,13 @@ public class ManagementWebSecurityAutoConfiguration { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - String managementEnabled = context.getEnvironment().getProperty( - "management.security.enabled", "true"); - String basicEnabled = context.getEnvironment().getProperty( - "security.basic.enabled", "true"); - return new ConditionOutcome("true".equalsIgnoreCase(managementEnabled) - && !"true".equalsIgnoreCase(basicEnabled), + String managementEnabled = context.getEnvironment() + .getProperty("management.security.enabled", "true"); + String basicEnabled = context.getEnvironment() + .getProperty("security.basic.enabled", "true"); + return new ConditionOutcome( + "true".equalsIgnoreCase(managementEnabled) + && !"true".equalsIgnoreCase(basicEnabled), "Management security enabled and basic disabled"); } @@ -207,8 +208,8 @@ public class ManagementWebSecurityAutoConfiguration { @ConditionalOnMissingBean({ ManagementWebSecurityConfigurerAdapter.class }) @ConditionalOnProperty(prefix = "management.security", name = "enabled", matchIfMissing = true) @Order(ManagementServerProperties.BASIC_AUTH_ORDER) - protected static class ManagementWebSecurityConfigurerAdapter extends - WebSecurityConfigurerAdapter { + protected static class ManagementWebSecurityConfigurerAdapter + extends WebSecurityConfigurerAdapter { @Autowired private SecurityProperties security; @@ -234,8 +235,8 @@ public class ManagementWebSecurityAutoConfiguration { if (this.endpointHandlerMapping == null) { ApplicationContext context = (this.contextResolver == null ? null : this.contextResolver.getApplicationContext()); - if (context != null - && context.getBeanNamesForType(EndpointHandlerMapping.class).length > 0) { + if (context != null && context + .getBeanNamesForType(EndpointHandlerMapping.class).length > 0) { this.endpointHandlerMapping = context .getBean(EndpointHandlerMapping.class); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java index 9900b840c3..1531b6b9c6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java @@ -116,9 +116,8 @@ public class MetricExportAutoConfiguration { @ConditionalOnMissingBean public MetricExportProperties metricExportProperties() { MetricExportProperties export = new MetricExportProperties(); - export.getRedis().setPrefix( - "spring.metrics" + (this.prefix.length() > 0 ? "." : "") - + this.prefix); + export.getRedis().setPrefix("spring.metrics" + + (this.prefix.length() > 0 ? "." : "") + this.prefix); export.getAggregate().setPrefix(this.prefix); export.getAggregate().setKeyPattern(this.aggregateKeyPattern); return export; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsDropwizardAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsDropwizardAutoConfiguration.java index c8ecfcd9d7..1dc65d43fd 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsDropwizardAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsDropwizardAutoConfiguration.java @@ -50,13 +50,16 @@ public class MetricsDropwizardAutoConfiguration { @Bean @ConditionalOnMissingBean({ DropwizardMetricServices.class, CounterService.class, GaugeService.class }) - public DropwizardMetricServices dropwizardMetricServices(MetricRegistry metricRegistry) { + public DropwizardMetricServices dropwizardMetricServices( + MetricRegistry metricRegistry) { return new DropwizardMetricServices(metricRegistry); } @Bean - public MetricReaderPublicMetrics dropwizardPublicMetrics(MetricRegistry metricRegistry) { - MetricRegistryMetricReader reader = new MetricRegistryMetricReader(metricRegistry); + public MetricReaderPublicMetrics dropwizardPublicMetrics( + MetricRegistry metricRegistry) { + MetricRegistryMetricReader reader = new MetricRegistryMetricReader( + metricRegistry); return new MetricReaderPublicMetrics(reader); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java index fa1d06c020..0c53123bcf 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java @@ -61,6 +61,7 @@ final class MetricsFilter extends OncePerRequestFilter { private final GaugeService gaugeService; private static final Set STATUS_REPLACERS; + static { Set replacements = new LinkedHashSet(); replacements.add(new PatternReplacer("[{}]", 0, "-")); @@ -72,6 +73,7 @@ final class MetricsFilter extends OncePerRequestFilter { } private static final Set KEY_REPLACERS; + static { Set replacements = new LinkedHashSet(); replacements.add(new PatternReplacer("/", Pattern.LITERAL, ".")); @@ -217,8 +219,8 @@ final class MetricsFilter extends OncePerRequestFilter { } public String apply(String input) { - return this.pattern.matcher(input).replaceAll( - Matcher.quoteReplacement(this.replacement)); + return this.pattern.matcher(input) + .replaceAll(Matcher.quoteReplacement(this.replacement)); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/OnEnabledHealthIndicatorCondition.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/OnEnabledHealthIndicatorCondition.java index 2355200898..4cbb0a369d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/OnEnabledHealthIndicatorCondition.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/OnEnabledHealthIndicatorCondition.java @@ -37,8 +37,8 @@ class OnEnabledHealthIndicatorCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(ANNOTATION_CLASS)); + AnnotationAttributes annotationAttributes = AnnotationAttributes + .fromMap(metadata.getAnnotationAttributes(ANNOTATION_CLASS)); String endpointName = annotationAttributes.getString("value"); ConditionOutcome outcome = getHealthIndicatorOutcome(context, endpointName); if (outcome != null) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfiguration.java index f0a8e53521..8c63fa6f35 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfiguration.java @@ -144,8 +144,8 @@ public class PublicMetricsAutoConfiguration { @ConditionalOnMissingBean public MetricReaderPublicMetrics springIntegrationPublicMetrics( IntegrationMBeanExporter exporter) { - return new MetricReaderPublicMetrics(new SpringIntegrationMetricReader( - exporter)); + return new MetricReaderPublicMetrics( + new SpringIntegrationMetricReader(exporter)); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/AbstractJmxCacheStatisticsProvider.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/AbstractJmxCacheStatisticsProvider.java index 0120223bbe..c0412eb626 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/AbstractJmxCacheStatisticsProvider.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/AbstractJmxCacheStatisticsProvider.java @@ -41,8 +41,8 @@ import org.springframework.cache.CacheManager; * @author Stephane Nicoll * @since 1.3.0 */ -public abstract class AbstractJmxCacheStatisticsProvider implements - CacheStatisticsProvider { +public abstract class AbstractJmxCacheStatisticsProvider + implements CacheStatisticsProvider { private static final Logger logger = LoggerFactory .getLogger(AbstractJmxCacheStatisticsProvider.class); @@ -81,7 +81,8 @@ public abstract class AbstractJmxCacheStatisticsProvider implem */ protected abstract CacheStatistics getCacheStatistics(ObjectName objectName); - private ObjectName internalGetObjectName(C cache) throws MalformedObjectNameException { + private ObjectName internalGetObjectName(C cache) + throws MalformedObjectNameException { String cacheName = cache.getName(); ObjectNameWrapper value = this.caches.get(cacheName); if (value != null) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/ConcurrentMapCacheStatisticsProvider.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/ConcurrentMapCacheStatisticsProvider.java index c48aeb25dd..7adee9999f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/ConcurrentMapCacheStatisticsProvider.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/ConcurrentMapCacheStatisticsProvider.java @@ -25,8 +25,8 @@ import org.springframework.cache.concurrent.ConcurrentMapCache; * @author Stephane Nicoll * @since 1.3.0 */ -public class ConcurrentMapCacheStatisticsProvider implements - CacheStatisticsProvider { +public class ConcurrentMapCacheStatisticsProvider + implements CacheStatisticsProvider { @Override public CacheStatistics getCacheStatistics(CacheManager cacheManager, diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/GuavaCacheStatisticsProvider.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/GuavaCacheStatisticsProvider.java index 8168d01199..69b5611e12 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/GuavaCacheStatisticsProvider.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/GuavaCacheStatisticsProvider.java @@ -30,7 +30,8 @@ import com.google.common.cache.CacheStats; public class GuavaCacheStatisticsProvider implements CacheStatisticsProvider { @Override - public CacheStatistics getCacheStatistics(CacheManager cacheManager, GuavaCache cache) { + public CacheStatistics getCacheStatistics(CacheManager cacheManager, + GuavaCache cache) { DefaultCacheStatistics statistics = new DefaultCacheStatistics(); statistics.setSize(cache.getNativeCache().size()); CacheStats guavaStats = cache.getNativeCache().stats(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/HazelcastCacheStatisticsProvider.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/HazelcastCacheStatisticsProvider.java index ca7b74ff2b..48cf84005d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/HazelcastCacheStatisticsProvider.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/HazelcastCacheStatisticsProvider.java @@ -28,8 +28,8 @@ import com.hazelcast.spring.cache.HazelcastCache; * @author Stephane Nicoll * @since 1.3.0 */ -public class HazelcastCacheStatisticsProvider implements - CacheStatisticsProvider { +public class HazelcastCacheStatisticsProvider + implements CacheStatisticsProvider { @Override public CacheStatistics getCacheStatistics(CacheManager cacheManager, diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/InfinispanCacheStatisticsProvider.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/InfinispanCacheStatisticsProvider.java index ba4f795bc5..819b7118fe 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/InfinispanCacheStatisticsProvider.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/InfinispanCacheStatisticsProvider.java @@ -30,15 +30,15 @@ import org.infinispan.spring.provider.SpringCache; * @author Stephane Nicoll * @since 1.3.0 */ -public class InfinispanCacheStatisticsProvider extends - AbstractJmxCacheStatisticsProvider { +public class InfinispanCacheStatisticsProvider + extends AbstractJmxCacheStatisticsProvider { @Override protected ObjectName getObjectName(SpringCache cache) throws MalformedObjectNameException { ObjectName name = new ObjectName( - "org.infinispan:component=Statistics,type=Cache,name=\"" - + cache.getName() + "(local)\",*"); + "org.infinispan:component=Statistics,type=Cache,name=\"" + cache.getName() + + "(local)\",*"); Set instances = getMBeanServer().queryMBeans(name, null); if (instances.size() == 1) { return instances.iterator().next().getObjectName(); @@ -61,7 +61,8 @@ public class InfinispanCacheStatisticsProvider extends return statistics; } - private void initalizeStats(ObjectName objectName, DefaultCacheStatistics statistics) { + private void initalizeStats(ObjectName objectName, + DefaultCacheStatistics statistics) { Double hitRatio = getAttribute(objectName, "hitRatio", Double.class); if ((hitRatio != null)) { statistics.setHitRatio(hitRatio); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/JCacheCacheStatisticsProvider.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/JCacheCacheStatisticsProvider.java index a9e60a5df9..02cc62ae17 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/JCacheCacheStatisticsProvider.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/JCacheCacheStatisticsProvider.java @@ -30,14 +30,14 @@ import org.springframework.cache.jcache.JCacheCache; * @author Stephane Nicoll * @since 1.3.0 */ -public class JCacheCacheStatisticsProvider extends - AbstractJmxCacheStatisticsProvider { +public class JCacheCacheStatisticsProvider + extends AbstractJmxCacheStatisticsProvider { @Override protected ObjectName getObjectName(JCacheCache cache) throws MalformedObjectNameException { - ObjectName name = new ObjectName("javax.cache:type=CacheStatistics,Cache=" - + cache.getName() + ",*"); + ObjectName name = new ObjectName( + "javax.cache:type=CacheStatistics,Cache=" + cache.getName() + ",*"); Set instances = getMBeanServer().queryMBeans(name, null); if (instances.size() == 1) { return instances.iterator().next().getObjectName(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/condition/OnEnabledEndpointCondition.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/condition/OnEnabledEndpointCondition.java index 243b8bb66c..1f1d609c5b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/condition/OnEnabledEndpointCondition.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/condition/OnEnabledEndpointCondition.java @@ -37,8 +37,8 @@ class OnEnabledEndpointCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(ANNOTATION_CLASS)); + AnnotationAttributes annotationAttributes = AnnotationAttributes + .fromMap(metadata.getAnnotationAttributes(ANNOTATION_CLASS)); String endpointName = annotationAttributes.getString("value"); boolean enabledByDefault = annotationAttributes.getBoolean("enabledByDefault"); ConditionOutcome outcome = determineEndpointOutcome(endpointName, @@ -66,8 +66,8 @@ class OnEnabledEndpointCondition extends SpringBootCondition { RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( context.getEnvironment(), "endpoints."); boolean match = Boolean.valueOf(resolver.getProperty("enabled", "true")); - return new ConditionOutcome(match, "All endpoints are " - + (match ? "enabled" : "disabled") + " by default"); + return new ConditionOutcome(match, + "All endpoints are " + (match ? "enabled" : "disabled") + " by default"); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java index 8590005e62..25ab754826 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java @@ -87,12 +87,12 @@ public class CachePublicMetrics implements PublicMetrics { private CacheStatistics getCacheStatistics(Cache cache, CacheManager cacheManager) { if (this.statisticsProviders != null) { for (CacheStatisticsProvider provider : this.statisticsProviders) { - Class cacheType = ResolvableType.forClass( - CacheStatisticsProvider.class, provider.getClass()) + Class cacheType = ResolvableType + .forClass(CacheStatisticsProvider.class, provider.getClass()) .resolveGeneric(); if (cacheType.isInstance(cache)) { - CacheStatistics statistics = provider.getCacheStatistics( - cacheManager, cache); + CacheStatistics statistics = provider.getCacheStatistics(cacheManager, + cache); if (statistics != null) { return statistics; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java index 29c98bb356..db0e411c68 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java @@ -59,8 +59,8 @@ import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; * @author Dave Syer */ @ConfigurationProperties(prefix = "endpoints.configprops", ignoreUnknownFields = false) -public class ConfigurationPropertiesReportEndpoint extends - AbstractEndpoint> implements ApplicationContextAware { +public class ConfigurationPropertiesReportEndpoint + extends AbstractEndpoint> implements ApplicationContextAware { private static final String CGLIB_FILTER_ID = "cglibFilter"; @@ -101,7 +101,8 @@ public class ConfigurationPropertiesReportEndpoint extends private Map extract(ApplicationContext context, ObjectMapper mapper) { Map result = new HashMap(); - ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData(context); + ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData( + context); Map beans = getConfigurationPropertiesBeans(context, beanFactoryMetaData); for (Map.Entry entry : beans.entrySet()) { @@ -153,8 +154,8 @@ public class ConfigurationPropertiesReportEndpoint extends String prefix) { try { @SuppressWarnings("unchecked") - Map result = new HashMap(mapper.convertValue( - bean, Map.class)); + Map result = new HashMap( + mapper.convertValue(bean, Map.class)); return result; } catch (Exception ex) { @@ -210,8 +211,8 @@ public class ConfigurationPropertiesReportEndpoint extends ConfigurationProperties annotation = context.findAnnotationOnBean(beanName, ConfigurationProperties.class); if (beanFactoryMetaData != null) { - ConfigurationProperties override = beanFactoryMetaData.findFactoryAnnotation( - beanName, ConfigurationProperties.class); + ConfigurationProperties override = beanFactoryMetaData + .findFactoryAnnotation(beanName, ConfigurationProperties.class); if (override != null) { // The @Bean-level @ConfigurationProperties overrides the one at type // level when binding. Arguably we should render them both, but this one @@ -249,8 +250,8 @@ public class ConfigurationPropertiesReportEndpoint extends * properties. */ @SuppressWarnings("serial") - private static class CglibAnnotationIntrospector extends - JacksonAnnotationIntrospector { + private static class CglibAnnotationIntrospector + extends JacksonAnnotationIntrospector { @Override public Object findFilterId(Annotated a) { @@ -312,9 +313,8 @@ public class ConfigurationPropertiesReportEndpoint extends // that its a nested class used solely for binding to config props, so it // should be kosher. This filter is not used if there is JSON metadata for // the property, so it's mainly for user-defined beans. - return (setter != null) - || ClassUtils.getPackageName(parentType).equals( - ClassUtils.getPackageName(type)); + return (setter != null) || ClassUtils.getPackageName(parentType) + .equals(ClassUtils.getPackageName(type)); } private AnnotatedMethod findSetter(BeanDescription beanDesc, diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java index 8a0e050310..63386b556e 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java @@ -35,7 +35,8 @@ class Sanitizer { private Pattern[] keysToSanitize; Sanitizer() { - setKeysToSanitize("password", "secret", "key", ".*credentials.*", "vcap_services"); + setKeysToSanitize("password", "secret", "key", ".*credentials.*", + "vcap_services"); } /** diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBean.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBean.java index 8f29721d03..3b407b6256 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBean.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBean.java @@ -58,7 +58,8 @@ public class EndpointMBean { * @param endpoint the endpoint to wrap * @param objectMapper the {@link ObjectMapper} used to convert the payload */ - public EndpointMBean(String beanName, Endpoint endpoint, ObjectMapper objectMapper) { + public EndpointMBean(String beanName, Endpoint endpoint, + ObjectMapper objectMapper) { Assert.notNull(beanName, "BeanName must not be null"); Assert.notNull(endpoint, "Endpoint must not be null"); Assert.notNull(objectMapper, "ObjectMapper must not be null"); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java index 6327d17552..1133eef4d9 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java @@ -58,8 +58,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; * @author Christian Dupuis * @author Andy Wilkinson */ -public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecycle, - ApplicationContextAware { +public class EndpointMBeanExporter extends MBeanExporter + implements SmartLifecycle, ApplicationContextAware { /** * The default JMX domain. @@ -139,7 +139,8 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc } @Override - public void setEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames) { + public void setEnsureUniqueRuntimeObjectNames( + boolean ensureUniqueRuntimeObjectNames) { super.setEnsureUniqueRuntimeObjectNames(ensureUniqueRuntimeObjectNames); this.ensureUniqueRuntimeObjectNames = ensureUniqueRuntimeObjectNames; } @@ -209,9 +210,8 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc + ObjectUtils.getIdentityHexString(this.applicationContext)); } if (this.ensureUniqueRuntimeObjectNames) { - builder.append(",identity=" - + ObjectUtils.getIdentityHexString(((EndpointMBean) bean) - .getEndpoint())); + builder.append(",identity=" + ObjectUtils + .getIdentityHexString(((EndpointMBean) bean).getEndpoint())); } builder.append(getStaticNames()); return ObjectNameManager.getInstance(builder.toString()); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointMvcAdapter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointMvcAdapter.java index 500cf1e02d..9cef437865 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointMvcAdapter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointMvcAdapter.java @@ -29,8 +29,8 @@ import org.springframework.util.Assert; * @author Phillip Webb * @since 1.3.0 */ -public abstract class AbstractEndpointMvcAdapter> implements - MvcEndpoint { +public abstract class AbstractEndpointMvcAdapter> + implements MvcEndpoint { private final E delegate; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorHalBrowserEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorHalBrowserEndpoint.java index f5fc4e1e8b..aeebd94600 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorHalBrowserEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorHalBrowserEndpoint.java @@ -40,8 +40,8 @@ import org.springframework.web.servlet.resource.TransformedResource; * @author Andy Wilkinson * @since 1.3.0 */ -public class ActuatorHalBrowserEndpoint extends ActuatorHalJsonEndpoint implements - ResourceLoaderAware { +public class ActuatorHalBrowserEndpoint extends ActuatorHalJsonEndpoint + implements ResourceLoaderAware { private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); @@ -86,7 +86,8 @@ public class ActuatorHalBrowserEndpoint extends ActuatorHalJsonEndpoint implemen } } - public static HalBrowserLocation getHalBrowserLocation(ResourceLoader resourceLoader) { + public static HalBrowserLocation getHalBrowserLocation( + ResourceLoader resourceLoader) { for (HalBrowserLocation candidate : HAL_BROWSER_RESOURCE_LOCATIONS) { try { Resource resource = resourceLoader.getResource(candidate.toString()); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorHalJsonEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorHalJsonEndpoint.java index 78e5098413..751d51f53d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorHalJsonEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ActuatorHalJsonEndpoint.java @@ -37,8 +37,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter * @since 1.3.0 */ @ConfigurationProperties("endpoints.actuator") -public class ActuatorHalJsonEndpoint extends WebMvcConfigurerAdapter implements - MvcEndpoint { +public class ActuatorHalJsonEndpoint extends WebMvcConfigurerAdapter + implements MvcEndpoint { /** * Endpoint URL path. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java index 5e9c1dea6e..de0e9fa0bf 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java @@ -58,13 +58,14 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean { this.endpoints.addAll(existing); this.customTypes = findEndpointClasses(existing); @SuppressWarnings("rawtypes") - Collection delegates = BeanFactoryUtils.beansOfTypeIncludingAncestors( - this.applicationContext, Endpoint.class).values(); + Collection delegates = BeanFactoryUtils + .beansOfTypeIncludingAncestors(this.applicationContext, Endpoint.class) + .values(); for (Endpoint endpoint : delegates) { if (isGenericEndpoint(endpoint.getClass()) && endpoint.isEnabled()) { EndpointMvcAdapter adapter = new EndpointMvcAdapter(endpoint); - String path = this.applicationContext.getEnvironment().getProperty( - "endpoints." + endpoint.getId() + ".path"); + String path = this.applicationContext.getEnvironment() + .getProperty("endpoints." + endpoint.getId() + ".path"); if (path != null) { adapter.setPath(path); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CassandraHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CassandraHealthIndicator.java index e2359c24bc..d4802b7a94 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CassandraHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CassandraHealthIndicator.java @@ -47,8 +47,8 @@ public class CassandraHealthIndicator extends AbstractHealthIndicator { @Override protected void doHealthCheck(Health.Builder builder) throws Exception { try { - Select select = QueryBuilder.select("release_version") - .from("system", "local"); + Select select = QueryBuilder.select("release_version").from("system", + "local"); ResultSet results = this.cassandraAdminOperations.query(select); if (results.isExhausted()) { builder.up(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DataSourceHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DataSourceHealthIndicator.java index 37af708253..ddc6692530 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DataSourceHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DataSourceHealthIndicator.java @@ -46,8 +46,8 @@ import org.springframework.util.StringUtils; * @author Arthur Kalimullin * @since 1.1.0 */ -public class DataSourceHealthIndicator extends AbstractHealthIndicator implements - InitializingBean { +public class DataSourceHealthIndicator extends AbstractHealthIndicator + implements InitializingBean { private static final String DEFAULT_QUERY = "SELECT 1"; @@ -121,8 +121,8 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement private String getProduct() { return this.jdbcTemplate.execute(new ConnectionCallback() { @Override - public String doInConnection(Connection connection) throws SQLException, - DataAccessException { + public String doInConnection(Connection connection) + throws SQLException, DataAccessException { return connection.getMetaData().getDatabaseProductName(); } }); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicator.java index 46afd732da..058ebe18b0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicator.java @@ -46,9 +46,7 @@ public class ElasticsearchHealthIndicator extends AbstractHealthIndicator { @Override protected void doHealthCheck(Health.Builder builder) throws Exception { List indices = this.properties.getIndices(); - ClusterHealthResponse response = this.client - .admin() - .cluster() + ClusterHealthResponse response = this.client.admin().cluster() .health(Requests.clusterHealthRequest(indices.isEmpty() ? allIndices : indices.toArray(new String[indices.size()]))) .actionGet(this.properties.getResponseTimeout()); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReader.java index af8915e67e..f39c9424f8 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReader.java @@ -121,16 +121,19 @@ public class AggregateMetricReader implements MetricReader { String name = this.prefix + key; Metric aggregate = result.findOne(name); if (aggregate == null) { - aggregate = new Metric(name, metric.getValue(), metric.getTimestamp()); + aggregate = new Metric(name, metric.getValue(), + metric.getTimestamp()); } else if (key.contains("counter.")) { // accumulate all values - aggregate = new Metric(name, metric.increment( - aggregate.getValue().intValue()).getValue(), metric.getTimestamp()); + aggregate = new Metric(name, + metric.increment(aggregate.getValue().intValue()).getValue(), + metric.getTimestamp()); } else if (aggregate.getTimestamp().before(metric.getTimestamp())) { // sort by timestamp and only take the latest - aggregate = new Metric(name, metric.getValue(), metric.getTimestamp()); + aggregate = new Metric(name, metric.getValue(), + metric.getTimestamp()); } result.set(aggregate); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReader.java index 443cc24fbf..0a6ad4aacf 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReader.java @@ -81,7 +81,8 @@ public class BufferMetricReader implements MetricReader, PrefixMetricReader { } private > void collectMetrics( - Buffers buffers, Predicate predicate, final List> metrics) { + Buffers buffers, Predicate predicate, + final List> metrics) { buffers.forEach(predicate, new BiConsumer() { @Override diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java index 69b7cf76cb..f034994755 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java @@ -52,8 +52,8 @@ public abstract class AbstractMetricExporter implements Exporter { private Date latestTimestamp = new Date(0L); public AbstractMetricExporter(String prefix) { - this.prefix = (!StringUtils.hasText(prefix) ? "" : (prefix.endsWith(".") ? prefix - : prefix + ".")); + this.prefix = (!StringUtils.hasText(prefix) ? "" + : (prefix.endsWith(".") ? prefix : prefix + ".")); } /** diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java index c57f0b97dd..44b8ffaef1 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java @@ -86,7 +86,8 @@ public class MetricExporters implements SchedulingConfigurer { } } - private MetricCopyExporter getExporter(MetricWriter writer, TriggerProperties trigger) { + private MetricCopyExporter getExporter(MetricWriter writer, + TriggerProperties trigger) { MetricCopyExporter exporter = new MetricCopyExporter(this.reader, writer); exporter.setIncludes(trigger.getIncludes()); exporter.setExcludes(trigger.getExcludes()); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReader.java index ba684248b0..459a67bafa 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReader.java @@ -55,25 +55,25 @@ public class SpringIntegrationMetricReader implements MetricReader { String prefix = "integration.channel." + name; metrics.addAll(getStatistics(prefix + ".errorRate", exporter.getChannelErrorRate(name))); - metrics.add(new Metric(prefix + ".sendCount", exporter - .getChannelSendCountLong(name))); + metrics.add(new Metric(prefix + ".sendCount", + exporter.getChannelSendCountLong(name))); metrics.addAll(getStatistics(prefix + ".sendRate", exporter.getChannelSendRate(name))); - metrics.add(new Metric(prefix + ".receiveCount", exporter - .getChannelReceiveCountLong(name))); + metrics.add(new Metric(prefix + ".receiveCount", + exporter.getChannelReceiveCountLong(name))); } for (String name : exporter.getHandlerNames()) { metrics.addAll(getStatistics("integration.handler." + name + ".duration", exporter.getHandlerDuration(name))); } - metrics.add(new Metric("integration.activeHandlerCount", exporter - .getActiveHandlerCount())); - metrics.add(new Metric("integration.handlerCount", exporter - .getHandlerCount())); - metrics.add(new Metric("integration.channelCount", exporter - .getChannelCount())); - metrics.add(new Metric("integration.queuedMessageCount", exporter - .getQueuedMessageCount())); + metrics.add(new Metric("integration.activeHandlerCount", + exporter.getActiveHandlerCount())); + metrics.add(new Metric("integration.handlerCount", + exporter.getHandlerCount())); + metrics.add(new Metric("integration.channelCount", + exporter.getChannelCount())); + metrics.add(new Metric("integration.queuedMessageCount", + exporter.getQueuedMessageCount())); return metrics; } @@ -83,7 +83,8 @@ public class SpringIntegrationMetricReader implements MetricReader { metrics.add(new Metric(name + ".mean", statistic.getMean())); metrics.add(new Metric(name + ".max", statistic.getMax())); metrics.add(new Metric(name + ".min", statistic.getMin())); - metrics.add(new Metric(name + ".stdev", statistic.getStandardDeviation())); + metrics.add( + new Metric(name + ".stdev", statistic.getStandardDeviation())); metrics.add(new Metric(name + ".count", statistic.getCountLong())); return metrics; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbMetricWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbMetricWriter.java index 888a9725de..ca48f1a36d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbMetricWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbMetricWriter.java @@ -69,7 +69,8 @@ public class OpenTsdbMetricWriter implements MetricWriter { */ private MediaType mediaType = MediaType.APPLICATION_JSON; - private final List buffer = new ArrayList(this.bufferSize); + private final List buffer = new ArrayList( + this.bufferSize); private OpenTsdbNamingStrategy namingStrategy = new DefaultOpenTsdbNamingStrategy(); @@ -104,9 +105,8 @@ public class OpenTsdbMetricWriter implements MetricWriter { @Override public void set(Metric value) { - OpenTsdbData data = new OpenTsdbData( - this.namingStrategy.getName(value.getName()), value.getValue(), value - .getTimestamp().getTime()); + OpenTsdbData data = new OpenTsdbData(this.namingStrategy.getName(value.getName()), + value.getValue(), value.getTimestamp().getTime()); synchronized (this.buffer) { this.buffer.add(data); if (this.buffer.size() >= this.bufferSize) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java index a123bf1a21..14df26ff6c 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java @@ -53,8 +53,8 @@ public class InMemoryMetricRepository implements MetricRepository, MultiMetricRe public Metric modify(Metric current) { if (current != null) { Metric metric = current; - return new Metric(metricName, metric.increment(amount) - .getValue(), timestamp); + return new Metric(metricName, + metric.increment(amount).getValue(), timestamp); } else { return new Metric(metricName, new Long(amount), timestamp); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriter.java index 877cf48975..d865d26c8f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriter.java @@ -98,8 +98,8 @@ public class StatsdMetricWriter implements MetricWriter, Closeable { this.client.stop(); } - private static final class LoggingStatsdErrorHandler implements - StatsDClientErrorHandler { + private static final class LoggingStatsdErrorHandler + implements StatsDClientErrorHandler { @Override public void handle(Exception e) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidFileWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidFileWriter.java index 9c65846fb5..2be97b5657 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidFileWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidFileWriter.java @@ -56,14 +56,15 @@ import org.springframework.util.Assert; * @author Tomasz Przybyla * @since 1.2.0 */ -public class ApplicationPidFileWriter implements - ApplicationListener, Ordered { +public class ApplicationPidFileWriter + implements ApplicationListener, Ordered { private static final Log logger = LogFactory.getLog(ApplicationPidFileWriter.class); private static final String DEFAULT_FILE_NAME = "application.pid"; private static final List FILE_PROPERTIES; + static { List properties = new ArrayList(); properties.add(new SpringProperty("spring.pid.", "file")); @@ -73,6 +74,7 @@ public class ApplicationPidFileWriter implements } private static final List FAIL_ON_WRITE_ERROR_PROPERTIES; + static { List properties = new ArrayList(); properties.add(new SpringProperty("spring.pid.", "fail-on-write-error")); @@ -116,9 +118,9 @@ public class ApplicationPidFileWriter implements /** * Sets the type of application event that will trigger writing of the PID file. * Defaults to {@link ApplicationPreparedEvent}. NOTE: If you use the - * {@link org.springframework.boot.context.event.ApplicationStartedEvent} - * to trigger the write, you will not be able to - * specify the PID filename in the Spring {@link Environment}. + * {@link org.springframework.boot.context.event.ApplicationStartedEvent} to trigger + * the write, you will not be able to specify the PID filename in the Spring + * {@link Environment}. * @param triggerEventType the trigger event type */ public void setTriggerEventType( @@ -135,8 +137,8 @@ public class ApplicationPidFileWriter implements writePidFile(event); } catch (Exception ex) { - String message = String - .format("Cannot create pid file %s", this.file); + String message = String.format("Cannot create pid file %s", + this.file); if (failOnWriteError(event)) { throw new IllegalStateException(message, ex); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CacheStatisticsAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CacheStatisticsAutoConfigurationTests.java index 04b7da0fd0..39f82b49b2 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CacheStatisticsAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CacheStatisticsAutoConfigurationTests.java @@ -78,16 +78,16 @@ public class CacheStatisticsAutoConfigurationTests { @Test public void basicJCacheCacheStatistics() { load(JCacheCacheConfig.class); - CacheStatisticsProvider provider = this.context.getBean( - "jCacheCacheStatisticsProvider", CacheStatisticsProvider.class); + CacheStatisticsProvider provider = this.context + .getBean("jCacheCacheStatisticsProvider", CacheStatisticsProvider.class); doTestCoreStatistics(provider, false); } @Test public void basicEhCacheCacheStatistics() { load(EhCacheConfig.class); - CacheStatisticsProvider provider = this.context.getBean( - "ehCacheCacheStatisticsProvider", CacheStatisticsProvider.class); + CacheStatisticsProvider provider = this.context + .getBean("ehCacheCacheStatisticsProvider", CacheStatisticsProvider.class); doTestCoreStatistics(provider, true); } @@ -110,8 +110,8 @@ public class CacheStatisticsAutoConfigurationTests { @Test public void basicGuavaCacheStatistics() { load(GuavaConfig.class); - CacheStatisticsProvider provider = this.context.getBean( - "guavaCacheStatisticsProvider", CacheStatisticsProvider.class); + CacheStatisticsProvider provider = this.context + .getBean("guavaCacheStatisticsProvider", CacheStatisticsProvider.class); doTestCoreStatistics(provider, true); } @@ -125,23 +125,23 @@ public class CacheStatisticsAutoConfigurationTests { books); assertCoreStatistics(cacheStatistics, 0L, null, null); getOrCreate(books, "a", "b", "b", "a", "a"); - CacheStatistics updatedCacheStatistics = provider.getCacheStatistics( - this.cacheManager, books); + CacheStatistics updatedCacheStatistics = provider + .getCacheStatistics(this.cacheManager, books); assertCoreStatistics(updatedCacheStatistics, 2L, null, null); } @Test public void noOpCacheStatistics() { load(NoOpCacheConfig.class); - CacheStatisticsProvider provider = this.context.getBean( - "noOpCacheStatisticsProvider", CacheStatisticsProvider.class); + CacheStatisticsProvider provider = this.context + .getBean("noOpCacheStatisticsProvider", CacheStatisticsProvider.class); Cache books = getCache("books"); CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager, books); assertCoreStatistics(cacheStatistics, null, null, null); getOrCreate(books, "a", "b", "b", "a", "a"); - CacheStatistics updatedCacheStatistics = provider.getCacheStatistics( - this.cacheManager, books); + CacheStatistics updatedCacheStatistics = provider + .getCacheStatistics(this.cacheManager, books); assertCoreStatistics(updatedCacheStatistics, null, null, null); } @@ -152,14 +152,14 @@ public class CacheStatisticsAutoConfigurationTests { books); assertCoreStatistics(cacheStatistics, (supportSize ? 0L : null), null, null); getOrCreate(books, "a", "b", "b", "a", "a", "a"); - CacheStatistics updatedCacheStatistics = provider.getCacheStatistics( - this.cacheManager, books); + CacheStatistics updatedCacheStatistics = provider + .getCacheStatistics(this.cacheManager, books); assertCoreStatistics(updatedCacheStatistics, (supportSize ? 2L : null), 0.66D, 0.33D); } - private void assertCoreStatistics(CacheStatistics metrics, Long size, - Double hitRatio, Double missRatio) { + private void assertCoreStatistics(CacheStatistics metrics, Long size, Double hitRatio, + Double missRatio) { assertNotNull("Cache metrics must not be null", metrics); assertEquals("Wrong size for metrics " + metrics, size, metrics.getSize()); checkRatio("Wrong hit ratio for metrics " + metrics, hitRatio, @@ -213,8 +213,9 @@ public class CacheStatisticsAutoConfigurationTests { @Bean public javax.cache.CacheManager jCacheCacheManager() { - javax.cache.CacheManager cacheManager = Caching.getCachingProvider( - HazelcastCachingProvider.class.getName()).getCacheManager(); + javax.cache.CacheManager cacheManager = Caching + .getCachingProvider(HazelcastCachingProvider.class.getName()) + .getCacheManager(); MutableConfiguration config = new MutableConfiguration(); config.setStatisticsEnabled(true); cacheManager.createCache("books", config); @@ -234,8 +235,8 @@ public class CacheStatisticsAutoConfigurationTests { @Bean public net.sf.ehcache.CacheManager ehCacheCacheManager() { - return EhCacheManagerUtils.buildCacheManager(new ClassPathResource( - "cache/test-ehcache.xml")); + return EhCacheManagerUtils + .buildCacheManager(new ClassPathResource("cache/test-ehcache.xml")); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java index a6b679a76f..a04017d991 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java @@ -86,8 +86,8 @@ public class EndpointMvcIntegrationTests { @Test public void envEndpointHidden() throws InterruptedException { - String body = new TestRestTemplate().getForObject("http://localhost:" + this.port - + "/env/user.dir", String.class); + String body = new TestRestTemplate().getForObject( + "http://localhost:" + this.port + "/env/user.dir", String.class); assertNotNull(body); assertTrue("Wrong body: \n" + body, body.contains("spring-boot-actuator")); assertTrue(this.interceptor.invoked()); @@ -95,8 +95,8 @@ public class EndpointMvcIntegrationTests { @Test public void healthEndpointNotHidden() throws InterruptedException { - String body = new TestRestTemplate().getForObject("http://localhost:" + this.port - + "/health", String.class); + String body = new TestRestTemplate() + .getForObject("http://localhost:" + this.port + "/health", String.class); assertNotNull(body); assertTrue("Wrong body: \n" + body, body.contains("status")); assertTrue(this.interceptor.invoked()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java index 05ff71446e..f20f932a8c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java @@ -145,8 +145,8 @@ public class EndpointWebMvcAutoConfigurationTests { assertContent("/endpoint", ports.get().server, null); assertContent("/controller", ports.get().management, null); assertContent("/endpoint", ports.get().management, "endpointoutput"); - ApplicationContext managementContext = this.applicationContext.getBean( - ManagementContextResolver.class).getApplicationContext(); + ApplicationContext managementContext = this.applicationContext + .getBean(ManagementContextResolver.class).getApplicationContext(); List interceptors = (List) ReflectionTestUtils.getField( managementContext.getBean(EndpointHandlerMapping.class), "interceptors"); assertEquals(1, interceptors.size()); @@ -160,10 +160,10 @@ public class EndpointWebMvcAutoConfigurationTests { DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); ServletContext servletContext = mock(ServletContext.class); - given(servletContext.getInitParameterNames()).willReturn( - new Vector().elements()); - given(servletContext.getAttributeNames()).willReturn( - new Vector().elements()); + given(servletContext.getInitParameterNames()) + .willReturn(new Vector().elements()); + given(servletContext.getAttributeNames()) + .willReturn(new Vector().elements()); this.applicationContext.setServletContext(servletContext); this.applicationContext.refresh(); assertContent("/controller", ports.get().management, null); @@ -205,8 +205,9 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void specificPortsViaProperties() throws Exception { - EnvironmentTestUtils.addEnvironment(this.applicationContext, "server.port:" - + ports.get().server, "management.port:" + ports.get().management); + EnvironmentTestUtils.addEnvironment(this.applicationContext, + "server.port:" + ports.get().server, + "management.port:" + ports.get().management); this.applicationContext.register(RootConfig.class, EndpointConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -245,8 +246,8 @@ public class EndpointWebMvcAutoConfigurationTests { new ServerPortInfoApplicationContextInitializer() .initialize(this.applicationContext); this.applicationContext.refresh(); - Integer localServerPort = this.applicationContext.getEnvironment().getProperty( - "local.server.port", Integer.class); + Integer localServerPort = this.applicationContext.getEnvironment() + .getProperty("local.server.port", Integer.class); Integer localManagementPort = this.applicationContext.getEnvironment() .getProperty("local.management.port", Integer.class); assertThat(localServerPort, notNullValue()); @@ -264,8 +265,8 @@ public class EndpointWebMvcAutoConfigurationTests { BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); this.applicationContext.refresh(); - Integer localServerPort = this.applicationContext.getEnvironment().getProperty( - "local.server.port", Integer.class); + Integer localServerPort = this.applicationContext.getEnvironment() + .getProperty("local.server.port", Integer.class); Integer localManagementPort = this.applicationContext.getEnvironment() .getProperty("local.management.port", Integer.class); assertThat(localServerPort, notNullValue()); @@ -345,8 +346,9 @@ public class EndpointWebMvcAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.applicationContext, "endpoints.shutdown.enabled:true"); this.applicationContext.refresh(); - assertThat(this.applicationContext.getBeansOfType(ShutdownMvcEndpoint.class) - .size(), is(equalTo(1))); + assertThat( + this.applicationContext.getBeansOfType(ShutdownMvcEndpoint.class).size(), + is(equalTo(1))); } private void endpointDisabled(String name, Class type) { @@ -378,8 +380,8 @@ public class EndpointWebMvcAutoConfigurationTests { public void assertContent(String url, int port, Object expected) throws Exception { SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory(); - ClientHttpRequest request = clientHttpRequestFactory.createRequest(new URI( - "http://localhost:" + port + url), HttpMethod.GET); + ClientHttpRequest request = clientHttpRequestFactory + .createRequest(new URI("http://localhost:" + port + url), HttpMethod.GET); try { ClientHttpResponse response = request.execute(); try { @@ -404,8 +406,8 @@ public class EndpointWebMvcAutoConfigurationTests { public boolean hasHeader(String url, int port, String header) throws Exception { SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory(); - ClientHttpRequest request = clientHttpRequestFactory.createRequest(new URI( - "http://localhost:" + port + url), HttpMethod.GET); + ClientHttpRequest request = clientHttpRequestFactory + .createRequest(new URI("http://localhost:" + port + url), HttpMethod.GET); ClientHttpResponse response = request.execute(); return response.getHeaders().containsKey(header); } @@ -582,8 +584,8 @@ public class EndpointWebMvcAutoConfigurationTests { } - private static class GrabManagementPort implements - ApplicationListener { + private static class GrabManagementPort + implements ApplicationListener { private ApplicationContext rootContext; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java index be23920e80..4f6d9e7eb2 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java @@ -99,8 +99,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -113,8 +113,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertSame(this.context.getBean("customHealthIndicator"), beans.values() - .iterator().next()); + assertSame(this.context.getBean("customHealthIndicator"), + beans.values().iterator().next()); } @Test @@ -128,8 +128,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(DiskSpaceHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(DiskSpaceHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -333,8 +333,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(MailHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(MailHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -349,8 +349,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -364,8 +364,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(JmsHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(JmsHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -380,8 +380,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -397,8 +397,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ElasticsearchHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ElasticsearchHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -415,8 +415,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(ApplicationHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Configuration diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java index 79da5696b5..506e10fce2 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java @@ -59,8 +59,8 @@ public class HealthMvcEndpointAutoConfigurationTests { this.context.setServletContext(new MockServletContext()); this.context.register(TestConfiguration.class); this.context.refresh(); - Health health = (Health) this.context.getBean(HealthMvcEndpoint.class).invoke( - null); + Health health = (Health) this.context.getBean(HealthMvcEndpoint.class) + .invoke(null); assertEquals(Status.UP, health.getStatus()); assertEquals(null, health.getDetails().get("foo")); } @@ -73,8 +73,8 @@ public class HealthMvcEndpointAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "management.security.enabled=false"); this.context.refresh(); - Health health = (Health) this.context.getBean(HealthMvcEndpoint.class).invoke( - null); + Health health = (Health) this.context.getBean(HealthMvcEndpoint.class) + .invoke(null); assertEquals(Status.UP, health.getStatus()); Health map = (Health) health.getDetails().get("test"); assertEquals("bar", map.getDetails().get("foo")); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java index be05f51984..53795acafd 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java @@ -88,11 +88,12 @@ public class JolokiaAutoConfigurationTests { HttpMessageConvertersAutoConfiguration.class, JolokiaAutoConfiguration.class); this.context.refresh(); - assertEquals(1, this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); + assertEquals(1, + this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build(); - mockMvc.perform(MockMvcRequestBuilders.get("/foo/bar")).andExpect( - MockMvcResultMatchers.content().string( - Matchers.containsString("\"request\":{\"type\""))); + mockMvc.perform(MockMvcRequestBuilders.get("/foo/bar")) + .andExpect(MockMvcResultMatchers.content() + .string(Matchers.containsString("\"request\":{\"type\""))); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementContextPathHypermediaIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementContextPathHypermediaIntegrationTests.java index b4e2050c87..99e83c98a3 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementContextPathHypermediaIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementContextPathHypermediaIntegrationTests.java @@ -85,12 +85,10 @@ public class ManagementContextPathHypermediaIntegrationTests { @Test public void trace() throws Exception { - this.mockMvc - .perform(get("/admin/trace").accept(MediaType.APPLICATION_JSON)) + this.mockMvc.perform(get("/admin/trace").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) - .andExpect( - jsonPath("$._links.self.href").value( - "http://localhost/admin/trace")) + .andExpect(jsonPath("$._links.self.href") + .value("http://localhost/admin/trace")) .andExpect(jsonPath("$.content").isArray()); } @@ -103,12 +101,10 @@ public class ManagementContextPathHypermediaIntegrationTests { } path = path.startsWith("/") ? path.substring(1) : path; path = path.length() > 0 ? path : "self"; - this.mockMvc - .perform(get("/admin").accept(MediaType.APPLICATION_JSON)) + this.mockMvc.perform(get("/admin").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) - .andExpect( - jsonPath("$._links.%s.href", path).value( - "http://localhost/admin" + endpoint.getPath())); + .andExpect(jsonPath("$._links.%s.href", path) + .value("http://localhost/admin" + endpoint.getPath())); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java index 6ac8362d40..c6bf08cf60 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java @@ -99,7 +99,8 @@ public class ManagementWebSecurityAutoConfigurationTests { assertThat(filterChainProxy.getFilters("/beans"), hasSize(greaterThan(0))); assertThat(filterChainProxy.getFilters("/beans/"), hasSize(greaterThan(0))); assertThat(filterChainProxy.getFilters("/beans.foo"), hasSize(greaterThan(0))); - assertThat(filterChainProxy.getFilters("/beans/foo/bar"), hasSize(greaterThan(0))); + assertThat(filterChainProxy.getFilters("/beans/foo/bar"), + hasSize(greaterThan(0))); } @Test @@ -115,9 +116,8 @@ public class ManagementWebSecurityAutoConfigurationTests { this.context.register(WebConfiguration.class); this.context.refresh(); UserDetails user = getUser(); - assertTrue(user.getAuthorities().containsAll( - AuthorityUtils - .commaSeparatedStringToAuthorityList("ROLE_USER,ROLE_ADMIN"))); + assertTrue(user.getAuthorities().containsAll(AuthorityUtils + .commaSeparatedStringToAuthorityList("ROLE_USER,ROLE_ADMIN"))); } private UserDetails getUser() { @@ -125,8 +125,8 @@ public class ManagementWebSecurityAutoConfigurationTests { .getBean(AuthenticationManager.class); DaoAuthenticationProvider provider = (DaoAuthenticationProvider) parent .getProviders().get(0); - UserDetailsService service = (UserDetailsService) ReflectionTestUtils.getField( - provider, "userDetailsService"); + UserDetailsService service = (UserDetailsService) ReflectionTestUtils + .getField(provider, "userDetailsService"); UserDetails user = service.loadUserByUsername("user"); return user; } @@ -143,8 +143,8 @@ public class ManagementWebSecurityAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "security.ignored:none"); this.context.refresh(); // Just the application and management endpoints now - assertEquals(2, this.context.getBean(FilterChainProxy.class).getFilterChains() - .size()); + assertEquals(2, + this.context.getBean(FilterChainProxy.class).getFilterChains().size()); } @Test @@ -156,8 +156,8 @@ public class ManagementWebSecurityAutoConfigurationTests { this.context.refresh(); // Just the management endpoints (one filter) and ignores now plus the backup // filter on app endpoints - assertEquals(6, this.context.getBean(FilterChainProxy.class).getFilterChains() - .size()); + assertEquals(6, + this.context.getBean(FilterChainProxy.class).getFilterChains().size()); } @Test @@ -193,16 +193,14 @@ public class ManagementWebSecurityAutoConfigurationTests { public void realmSameForManagement() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); - this.context - .register(AuthenticationConfig.class, SecurityAutoConfiguration.class, - ManagementWebSecurityAutoConfiguration.class, - JacksonAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - EndpointAutoConfiguration.class, - EndpointWebMvcAutoConfiguration.class, - ManagementServerPropertiesAutoConfiguration.class, - WebMvcAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); + this.context.register(AuthenticationConfig.class, SecurityAutoConfiguration.class, + ManagementWebSecurityAutoConfiguration.class, + JacksonAutoConfiguration.class, + HttpMessageConvertersAutoConfiguration.class, + EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class, + ManagementServerPropertiesAutoConfiguration.class, + WebMvcAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); Filter filter = this.context.getBean("springSecurityFilterChain", Filter.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfigurationTests.java index 2a7e9145de..e7c2f9a544 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfigurationTests.java @@ -88,8 +88,8 @@ public class MetricExportAutoConfigurationTests { assertNotNull(gaugeService); gaugeService.submit("foo", 2.7); MetricExporters exporters = this.context.getBean(MetricExporters.class); - MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters().get( - "writer"); + MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters() + .get("writer"); exporter.setIgnoreTimestamps(true); exporter.export(); MetricWriter writer = this.context.getBean("writer", MetricWriter.class); @@ -102,8 +102,8 @@ public class MetricExportAutoConfigurationTests { MetricEndpointConfiguration.class, MetricExportAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); MetricExporters exporters = this.context.getBean(MetricExporters.class); - MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters().get( - "writer"); + MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters() + .get("writer"); exporter.setIgnoreTimestamps(true); exporter.export(); MetricsEndpointMetricReader reader = this.context.getBean("endpointReader", diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java index 9d00ca79ea..9306902231 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java @@ -65,8 +65,8 @@ public class MetricRepositoryAutoConfigurationTests { assertNotNull(this.context.getBean(BufferCounterService.class)); assertNotNull(this.context.getBean(PrefixMetricReader.class)); gaugeService.submit("foo", 2.7); - assertEquals(2.7, this.context.getBean(MetricReader.class).findOne("gauge.foo") - .getValue()); + assertEquals(2.7, + this.context.getBean(MetricReader.class).findOne("gauge.foo").getValue()); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java index cb7822bebd..6c031e45f8 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java @@ -94,8 +94,8 @@ public class PublicMetricsAutoConfigurationTests { @Test public void metricReaderPublicMetrics() throws Exception { load(); - assertEquals(1, this.context.getBeansOfType(MetricReaderPublicMetrics.class) - .size()); + assertEquals(1, + this.context.getBeansOfType(MetricReaderPublicMetrics.class).size()); } @Test @@ -105,8 +105,8 @@ public class PublicMetricsAutoConfigurationTests { PublicMetricsAutoConfiguration.class); RichGaugeReader richGaugeReader = context.getBean(RichGaugeReader.class); assertNotNull(richGaugeReader); - given(richGaugeReader.findAll()).willReturn( - Collections.singletonList(new RichGauge("bar", 3.7d))); + given(richGaugeReader.findAll()) + .willReturn(Collections.singletonList(new RichGauge("bar", 3.7d))); RichGaugeReaderPublicMetrics publicMetrics = context .getBean(RichGaugeReaderPublicMetrics.class); assertNotNull(publicMetrics); @@ -125,7 +125,8 @@ public class PublicMetricsAutoConfigurationTests { @Test public void noDataSource() { load(); - assertEquals(0, this.context.getBeansOfType(DataSourcePublicMetrics.class).size()); + assertEquals(0, + this.context.getBeansOfType(DataSourcePublicMetrics.class).size()); } @Test @@ -145,12 +146,12 @@ public class PublicMetricsAutoConfigurationTests { "datasource.commonsDbcp.active", "datasource.commonsDbcp.usage"); // Hikari won't work unless a first connection has been retrieved - JdbcTemplate jdbcTemplate = new JdbcTemplate(this.context.getBean("hikariDS", - DataSource.class)); + JdbcTemplate jdbcTemplate = new JdbcTemplate( + this.context.getBean("hikariDS", DataSource.class)); jdbcTemplate.execute(new ConnectionCallback() { @Override - public Void doInConnection(Connection connection) throws SQLException, - DataAccessException { + public Void doInConnection(Connection connection) + throws SQLException, DataAccessException { return null; } }); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ServerContextPathHypermediaIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ServerContextPathHypermediaIntegrationTests.java index bce0f028d6..8321543ae6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ServerContextPathHypermediaIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ServerContextPathHypermediaIntegrationTests.java @@ -80,7 +80,8 @@ public class ServerContextPathHypermediaIntegrationTests { "http://localhost:" + this.port + "/spring/actuator/", HttpMethod.GET, new HttpEntity(null, headers), String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body: " + entity.getBody(), entity.getBody().contains("(null, headers), String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body: " + entity.getBody(), entity.getBody().contains(" 0 ? path : "/"; - this.mockMvc - .perform(get(path).accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect( - jsonPath("$._links.self.href").value( - "http://localhost" + endpoint.getPath())); + this.mockMvc.perform(get(path).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andExpect(jsonPath("$._links.self.href") + .value("http://localhost" + endpoint.getPath())); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java index 53703cb751..28e6ac3cee 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java @@ -96,18 +96,14 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests env = report.invoke(); - assertEquals("******", - ((Map) env.get("systemProperties")) - .get("my.services.amqp-free.credentials.uri")); - assertEquals("******", - ((Map) env.get("systemProperties")) - .get("credentials.http_api_uri")); - assertEquals("******", - ((Map) env.get("systemProperties")) - .get("my.services.cleardb-free.credentials")); - assertEquals("******", - ((Map) env.get("systemProperties")) - .get("foo.mycredentials.uri")); + assertEquals("******", ((Map) env.get("systemProperties")) + .get("my.services.amqp-free.credentials.uri")); + assertEquals("******", ((Map) env.get("systemProperties")) + .get("credentials.http_api_uri")); + assertEquals("******", ((Map) env.get("systemProperties")) + .get("my.services.cleardb-free.credentials")); + assertEquals("******", ((Map) env.get("systemProperties")) + .get("foo.mycredentials.uri")); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporterTests.java index 1e0e3d17d6..a1997c8c4c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporterTests.java @@ -72,12 +72,12 @@ public class EndpointMBeanExporterTests { this.context = new GenericApplicationContext(); this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class)); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - TestEndpoint.class)); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(TestEndpoint.class)); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); - MBeanInfo mbeanInfo = mbeanExporter.getServer().getMBeanInfo( - getObjectName("endpoint1", this.context)); + MBeanInfo mbeanInfo = mbeanExporter.getServer() + .getMBeanInfo(getObjectName("endpoint1", this.context)); assertNotNull(mbeanInfo); assertEquals(3, mbeanInfo.getOperations().length); assertEquals(3, mbeanInfo.getAttributes().length); @@ -90,12 +90,12 @@ public class EndpointMBeanExporterTests { new RootBeanDefinition(EndpointMBeanExporter.class)); MutablePropertyValues mvp = new MutablePropertyValues(); mvp.add("enabled", Boolean.FALSE); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - TestEndpoint.class, null, mvp)); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(TestEndpoint.class, null, mvp)); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); - assertFalse(mbeanExporter.getServer().isRegistered( - getObjectName("endpoint1", this.context))); + assertFalse(mbeanExporter.getServer() + .isRegistered(getObjectName("endpoint1", this.context))); } @Test @@ -105,12 +105,12 @@ public class EndpointMBeanExporterTests { new RootBeanDefinition(EndpointMBeanExporter.class)); MutablePropertyValues mvp = new MutablePropertyValues(); mvp.add("enabled", Boolean.TRUE); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - TestEndpoint.class, null, mvp)); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(TestEndpoint.class, null, mvp)); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); - assertTrue(mbeanExporter.getServer().isRegistered( - getObjectName("endpoint1", this.context))); + assertTrue(mbeanExporter.getServer() + .isRegistered(getObjectName("endpoint1", this.context))); } @Test @@ -118,28 +118,27 @@ public class EndpointMBeanExporterTests { this.context = new GenericApplicationContext(); this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class)); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - TestEndpoint.class)); - this.context.registerBeanDefinition("endpoint2", new RootBeanDefinition( - TestEndpoint.class)); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(TestEndpoint.class)); + this.context.registerBeanDefinition("endpoint2", + new RootBeanDefinition(TestEndpoint.class)); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); - assertNotNull(mbeanExporter.getServer().getMBeanInfo( - getObjectName("endpoint1", this.context))); - assertNotNull(mbeanExporter.getServer().getMBeanInfo( - getObjectName("endpoint2", this.context))); + assertNotNull(mbeanExporter.getServer() + .getMBeanInfo(getObjectName("endpoint1", this.context))); + assertNotNull(mbeanExporter.getServer() + .getMBeanInfo(getObjectName("endpoint2", this.context))); } @Test public void testRegistrationWithDifferentDomain() throws Exception { this.context = new GenericApplicationContext(); - this.context.registerBeanDefinition( - "endpointMbeanExporter", + this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class, null, - new MutablePropertyValues(Collections.singletonMap("domain", - "test-domain")))); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - TestEndpoint.class)); + new MutablePropertyValues( + Collections.singletonMap("domain", "test-domain")))); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(TestEndpoint.class)); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); assertNotNull(mbeanExporter.getServer().getMBeanInfo( @@ -155,8 +154,8 @@ public class EndpointMBeanExporterTests { this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class, null, new MutablePropertyValues(properties))); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - TestEndpoint.class)); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(TestEndpoint.class)); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); assertNotNull(mbeanExporter.getServer().getMBeanInfo( @@ -177,14 +176,14 @@ public class EndpointMBeanExporterTests { this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class, null, new MutablePropertyValues(properties))); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - TestEndpoint.class)); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(TestEndpoint.class)); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); - assertNotNull(mbeanExporter.getServer().getMBeanInfo( - ObjectNameManager.getInstance(getObjectName("test-domain", "endpoint1", - true, this.context).toString() - + ",key1=value1,key2=value2"))); + assertNotNull(mbeanExporter.getServer() + .getMBeanInfo(ObjectNameManager.getInstance( + getObjectName("test-domain", "endpoint1", true, this.context) + .toString() + ",key1=value1,key2=value2"))); } @Test @@ -192,15 +191,15 @@ public class EndpointMBeanExporterTests { this.context = new GenericApplicationContext(); this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class)); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - TestEndpoint.class)); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(TestEndpoint.class)); GenericApplicationContext parent = new GenericApplicationContext(); this.context.setParent(parent); parent.refresh(); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); - assertNotNull(mbeanExporter.getServer().getMBeanInfo( - getObjectName("endpoint1", this.context))); + assertNotNull(mbeanExporter.getServer() + .getMBeanInfo(getObjectName("endpoint1", this.context))); parent.close(); } @@ -210,8 +209,8 @@ public class EndpointMBeanExporterTests { this.context = new GenericApplicationContext(); this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class)); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - JsonConversionEndpoint.class)); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(JsonConversionEndpoint.class)); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); Object response = mbeanExporter.getServer().invoke( @@ -228,11 +227,11 @@ public class EndpointMBeanExporterTests { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd")); constructorArgs.addIndexedArgumentValue(0, objectMapper); - this.context - .registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition( - EndpointMBeanExporter.class, constructorArgs, null)); - this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition( - JsonConversionEndpoint.class)); + this.context.registerBeanDefinition("endpointMbeanExporter", + new RootBeanDefinition(EndpointMBeanExporter.class, constructorArgs, + null)); + this.context.registerBeanDefinition("endpoint1", + new RootBeanDefinition(JsonConversionEndpoint.class)); this.context.refresh(); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); Object response = mbeanExporter.getServer().invoke( @@ -249,16 +248,14 @@ public class EndpointMBeanExporterTests { private ObjectName getObjectName(String domain, String beanKey, boolean includeIdentity, ApplicationContext applicationContext) - throws MalformedObjectNameException { + throws MalformedObjectNameException { if (includeIdentity) { - return ObjectNameManager - .getInstance(String.format("%s:type=Endpoint,name=%s,identity=%s", - domain, beanKey, ObjectUtils - .getIdentityHexString(applicationContext - .getBean(beanKey)))); + return ObjectNameManager.getInstance(String.format( + "%s:type=Endpoint,name=%s,identity=%s", domain, beanKey, ObjectUtils + .getIdentityHexString(applicationContext.getBean(beanKey)))); } - return ObjectNameManager.getInstance(String.format("%s:type=Endpoint,name=%s", - domain, beanKey)); + return ObjectNameManager + .getInstance(String.format("%s:type=Endpoint,name=%s", domain, beanKey)); } public static class TestEndpoint extends AbstractEndpoint { @@ -274,8 +271,8 @@ public class EndpointMBeanExporterTests { } - public static class JsonConversionEndpoint extends - AbstractEndpoint> { + public static class JsonConversionEndpoint + extends AbstractEndpoint> { public JsonConversionEndpoint() { super("json-conversion"); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java index c6e6d6fc7c..8e5804c933 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java @@ -65,8 +65,8 @@ public class EnvironmentMvcEndpointTests { public void setUp() { this.context.getBean(EnvironmentEndpoint.class).setEnabled(true); this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); - EnvironmentTestUtils.addEnvironment( - (ConfigurableApplicationContext) this.context, "foo:bar", "fool:baz"); + EnvironmentTestUtils.addEnvironment((ConfigurableApplicationContext) this.context, + "foo:bar", "fool:baz"); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java index 9f111c59bb..33cdf087da 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java @@ -98,10 +98,10 @@ public class HealthMvcEndpointTests { @Test @SuppressWarnings("unchecked") public void customMapping() { - given(this.endpoint.invoke()).willReturn( - new Health.Builder().status("OK").build()); - this.mvc.setStatusMapping(Collections.singletonMap("OK", - HttpStatus.INTERNAL_SERVER_ERROR)); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().status("OK").build()); + this.mvc.setStatusMapping( + Collections.singletonMap("OK", HttpStatus.INTERNAL_SERVER_ERROR)); Object result = this.mvc.invoke(null); assertTrue(result instanceof ResponseEntity); ResponseEntity response = (ResponseEntity) result; @@ -112,8 +112,8 @@ public class HealthMvcEndpointTests { @Test @SuppressWarnings("unchecked") public void customMappingWithRelaxedName() { - given(this.endpoint.invoke()).willReturn( - new Health.Builder().outOfService().build()); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().outOfService().build()); this.mvc.setStatusMapping(Collections.singletonMap("out-of-service", HttpStatus.INTERNAL_SERVER_ERROR)); Object result = this.mvc.invoke(null); @@ -125,8 +125,8 @@ public class HealthMvcEndpointTests { @Test public void secureEvenWhenNotSensitive() { - given(this.endpoint.invoke()).willReturn( - new Health.Builder().up().withDetail("foo", "bar").build()); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().up().withDetail("foo", "bar").build()); given(this.endpoint.isSensitive()).willReturn(false); Object result = this.mvc.invoke(this.admin); assertTrue(result instanceof Health); @@ -136,8 +136,8 @@ public class HealthMvcEndpointTests { @Test public void secureNonAdmin() { - given(this.endpoint.invoke()).willReturn( - new Health.Builder().up().withDetail("foo", "bar").build()); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().up().withDetail("foo", "bar").build()); Object result = this.mvc.invoke(this.user); assertTrue(result instanceof Health); assertTrue(((Health) result).getStatus() == Status.UP); @@ -148,8 +148,8 @@ public class HealthMvcEndpointTests { public void healthIsCached() { given(this.endpoint.getTimeToLive()).willReturn(10000L); given(this.endpoint.isSensitive()).willReturn(true); - given(this.endpoint.invoke()).willReturn( - new Health.Builder().up().withDetail("foo", "bar").build()); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().up().withDetail("foo", "bar").build()); Object result = this.mvc.invoke(this.admin); assertTrue(result instanceof Health); Health health = (Health) result; @@ -170,8 +170,8 @@ public class HealthMvcEndpointTests { public void unsecureAnonymousAccessUnrestricted() { this.mvc = new HealthMvcEndpoint(this.endpoint, false); this.mvc.setEnvironment(this.environment); - given(this.endpoint.invoke()).willReturn( - new Health.Builder().up().withDetail("foo", "bar").build()); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().up().withDetail("foo", "bar").build()); Object result = this.mvc.invoke(null); assertTrue(result instanceof Health); assertTrue(((Health) result).getStatus() == Status.UP); @@ -181,8 +181,8 @@ public class HealthMvcEndpointTests { @Test public void unsensitiveAnonymousAccessRestricted() { this.environment.getPropertySources().addLast(NON_SENSITIVE); - given(this.endpoint.invoke()).willReturn( - new Health.Builder().up().withDetail("foo", "bar").build()); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().up().withDetail("foo", "bar").build()); Object result = this.mvc.invoke(null); assertTrue(result instanceof Health); assertTrue(((Health) result).getStatus() == Status.UP); @@ -194,8 +194,8 @@ public class HealthMvcEndpointTests { this.mvc = new HealthMvcEndpoint(this.endpoint, false); this.mvc.setEnvironment(this.environment); this.environment.getPropertySources().addLast(NON_SENSITIVE); - given(this.endpoint.invoke()).willReturn( - new Health.Builder().up().withDetail("foo", "bar").build()); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().up().withDetail("foo", "bar").build()); Object result = this.mvc.invoke(null); assertTrue(result instanceof Health); assertTrue(((Health) result).getStatus() == Status.UP); @@ -205,8 +205,8 @@ public class HealthMvcEndpointTests { @Test public void noCachingWhenTimeToLiveIsZero() { given(this.endpoint.getTimeToLive()).willReturn(0L); - given(this.endpoint.invoke()).willReturn( - new Health.Builder().up().withDetail("foo", "bar").build()); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().up().withDetail("foo", "bar").build()); Object result = this.mvc.invoke(null); assertTrue(result instanceof Health); assertTrue(((Health) result).getStatus() == Status.UP); @@ -221,8 +221,8 @@ public class HealthMvcEndpointTests { public void newValueIsReturnedOnceTtlExpires() throws InterruptedException { given(this.endpoint.getTimeToLive()).willReturn(50L); given(this.endpoint.isSensitive()).willReturn(false); - given(this.endpoint.invoke()).willReturn( - new Health.Builder().up().withDetail("foo", "bar").build()); + given(this.endpoint.invoke()) + .willReturn(new Health.Builder().up().withDetail("foo", "bar").build()); Object result = this.mvc.invoke(null); assertTrue(result instanceof Health); assertTrue(((Health) result).getStatus() == Status.UP); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java index dec7065143..ff2a8e4398 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java @@ -61,20 +61,21 @@ public class MvcEndpointCorsIntegrationTests { @Test public void corsIsDisabledByDefault() throws Exception { - createMockMvc().perform( - options("/beans").header("Origin", "foo.example.com").header( - HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")).andExpect( - header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + createMockMvc() + .perform(options("/beans").header("Origin", "foo.example.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) + .andExpect( + header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); } @Test public void settingAllowedOriginsEnablesCors() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "endpoints.cors.allowed-origins:foo.example.com"); - createMockMvc().perform( - options("/beans").header("Origin", "bar.example.com").header( - HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")).andExpect( - status().isForbidden()); + createMockMvc() + .perform(options("/beans").header("Origin", "bar.example.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) + .andExpect(status().isForbidden()); performAcceptedCorsRequest(); } @@ -82,8 +83,8 @@ public class MvcEndpointCorsIntegrationTests { public void maxAgeDefaultsTo30Minutes() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "endpoints.cors.allowed-origins:foo.example.com"); - performAcceptedCorsRequest().andExpect( - header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); + performAcceptedCorsRequest() + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); } @Test @@ -91,16 +92,16 @@ public class MvcEndpointCorsIntegrationTests { EnvironmentTestUtils.addEnvironment(this.context, "endpoints.cors.allowed-origins:foo.example.com", "endpoints.cors.max-age: 2400"); - performAcceptedCorsRequest().andExpect( - header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "2400")); + performAcceptedCorsRequest() + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "2400")); } @Test public void requestsWithDisallowedHeadersAreRejected() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "endpoints.cors.allowed-origins:foo.example.com"); - createMockMvc().perform( - options("/beans").header("Origin", "foo.example.com") + createMockMvc() + .perform(options("/beans").header("Origin", "foo.example.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Alpha")) .andExpect(status().isForbidden()); @@ -112,25 +113,21 @@ public class MvcEndpointCorsIntegrationTests { "endpoints.cors.allowed-origins:foo.example.com", "endpoints.cors.allowed-headers:Alpha,Bravo"); createMockMvc() - .perform( - options("/beans") - .header("Origin", "foo.example.com") - .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET") - .header(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, - "Alpha")) - .andExpect(status().isOk()) - .andExpect( - header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Alpha")); + .perform(options("/beans").header("Origin", "foo.example.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Alpha")) + .andExpect(status().isOk()).andExpect(header() + .string(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Alpha")); } @Test public void requestsWithDisallowedMethodsAreRejected() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "endpoints.cors.allowed-origins:foo.example.com"); - createMockMvc().perform( - options("/health").header(HttpHeaders.ORIGIN, "foo.example.com").header( - HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "HEAD")).andExpect( - status().isForbidden()); + createMockMvc() + .perform(options("/health").header(HttpHeaders.ORIGIN, "foo.example.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "HEAD")) + .andExpect(status().isForbidden()); } @Test @@ -139,14 +136,10 @@ public class MvcEndpointCorsIntegrationTests { "endpoints.cors.allowed-origins:foo.example.com", "endpoints.cors.allowed-methods:GET,HEAD"); createMockMvc() - .perform( - options("/health") - .header(HttpHeaders.ORIGIN, "foo.example.com") - .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "HEAD")) - .andExpect(status().isOk()) - .andExpect( - header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, - "GET,HEAD")); + .perform(options("/health").header(HttpHeaders.ORIGIN, "foo.example.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "HEAD")) + .andExpect(status().isOk()).andExpect(header() + .string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,HEAD")); } @Test @@ -171,10 +164,10 @@ public class MvcEndpointCorsIntegrationTests { public void jolokiaEndpointUsesGlobalCorsConfiguration() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "endpoints.cors.allowed-origins:foo.example.com"); - createMockMvc().perform( - options("/jolokia").header("Origin", "bar.example.com").header( - HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")).andExpect( - status().isForbidden()); + createMockMvc() + .perform(options("/jolokia").header("Origin", "bar.example.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) + .andExpect(status().isForbidden()); performAcceptedCorsRequest("/jolokia"); } @@ -189,12 +182,11 @@ public class MvcEndpointCorsIntegrationTests { private ResultActions performAcceptedCorsRequest(String url) throws Exception { return createMockMvc() - .perform( - options(url).header(HttpHeaders.ORIGIN, "foo.example.com") - .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) - .andExpect( - header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, - "foo.example.com")).andExpect(status().isOk()); + .perform(options(url).header(HttpHeaders.ORIGIN, "foo.example.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, + "foo.example.com")) + .andExpect(status().isOk()); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java index 57a620ff70..2a15a3bbd5 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java @@ -182,8 +182,8 @@ public class MvcEndpointIntegrationTests { EnvironmentTestUtils.addEnvironment(this.context, "spring.jackson.serialization.indent-output:true"); MockMvc mockMvc = createMockMvc(); - mockMvc.perform(get("/beans")).andExpect( - content().string(startsWith("{" + LINE_SEPARATOR))); + mockMvc.perform(get("/beans")) + .andExpect(content().string(startsWith("{" + LINE_SEPARATOR))); } private MockMvc createMockMvc() { @@ -205,8 +205,8 @@ public class MvcEndpointIntegrationTests { } @ImportAutoConfiguration({ JacksonAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class, + HttpMessageConvertersAutoConfiguration.class, EndpointAutoConfiguration.class, + EndpointWebMvcAutoConfiguration.class, ManagementServerPropertiesAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, WebMvcAutoConfiguration.class }) static class DefaultConfiguration { @@ -224,8 +224,8 @@ public class MvcEndpointIntegrationTests { @ImportAutoConfiguration({ HypermediaAutoConfiguration.class, RepositoryRestMvcAutoConfiguration.class, JacksonAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class, + HttpMessageConvertersAutoConfiguration.class, EndpointAutoConfiguration.class, + EndpointWebMvcAutoConfiguration.class, ManagementServerPropertiesAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, WebMvcAutoConfiguration.class }) static class SpringDataRestConfiguration { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java index 7f005564e2..d3d8bce645 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java @@ -65,15 +65,15 @@ public class MvcEndpointsTests { @Test public void changesPath() throws Exception { - EnvironmentTestUtils - .addEnvironment(this.context, "endpoints.test.path=/foo/bar/"); + EnvironmentTestUtils.addEnvironment(this.context, + "endpoints.test.path=/foo/bar/"); this.context.getDefaultListableBeanFactory().registerSingleton("endpoint", new TestEndpoint()); this.endpoints.setApplicationContext(this.context); this.endpoints.afterPropertiesSet(); assertEquals(1, this.endpoints.getEndpoints().size()); - assertEquals("/foo/bar", this.endpoints.getEndpoints().iterator().next() - .getPath()); + assertEquals("/foo/bar", + this.endpoints.getEndpoints().iterator().next().getPath()); } protected static class TestEndpoint extends AbstractEndpoint { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorTests.java index ef3ca35a20..713a682b54 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorTests.java @@ -120,8 +120,8 @@ public class ElasticsearchHealthIndicatorTests { public void healthDetails() { PlainActionFuture responseFuture = new PlainActionFuture(); responseFuture.onResponse(new StubClusterHealthResponse()); - given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn( - responseFuture); + given(this.cluster.health(any(ClusterHealthRequest.class))) + .willReturn(responseFuture); Health health = this.indicator.health(); assertThat(health.getStatus(), is(Status.UP)); Map details = health.getDetails(); @@ -139,26 +139,26 @@ public class ElasticsearchHealthIndicatorTests { public void redResponseMapsToDown() { PlainActionFuture responseFuture = new PlainActionFuture(); responseFuture.onResponse(new StubClusterHealthResponse(ClusterHealthStatus.RED)); - given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn( - responseFuture); + given(this.cluster.health(any(ClusterHealthRequest.class))) + .willReturn(responseFuture); assertThat(this.indicator.health().getStatus(), is(Status.DOWN)); } @Test public void yellowResponseMapsToUp() { PlainActionFuture responseFuture = new PlainActionFuture(); - responseFuture.onResponse(new StubClusterHealthResponse( - ClusterHealthStatus.YELLOW)); - given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn( - responseFuture); + responseFuture + .onResponse(new StubClusterHealthResponse(ClusterHealthStatus.YELLOW)); + given(this.cluster.health(any(ClusterHealthRequest.class))) + .willReturn(responseFuture); assertThat(this.indicator.health().getStatus(), is(Status.UP)); } @Test public void responseTimeout() { PlainActionFuture responseFuture = new PlainActionFuture(); - given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn( - responseFuture); + given(this.cluster.health(any(ClusterHealthRequest.class))) + .willReturn(responseFuture); Health health = this.indicator.health(); assertThat(health.getStatus(), is(Status.DOWN)); assertThat((String) health.getDetails().get("error"), @@ -179,9 +179,10 @@ public class ElasticsearchHealthIndicatorTests { } private StubClusterHealthResponse(ClusterHealthStatus status) { - super("test-cluster", new String[0], new ClusterState(null, 0, null, - RoutingTable.builder().build(), DiscoveryNodes.builder().build(), - ClusterBlocks.builder().build(), null)); + super("test-cluster", new String[0], + new ClusterState(null, 0, null, RoutingTable.builder().build(), + DiscoveryNodes.builder().build(), + ClusterBlocks.builder().build(), null)); this.status = status; } @@ -227,8 +228,8 @@ public class ElasticsearchHealthIndicatorTests { } - private static class TestActionFuture extends - PlainActionFuture { + private static class TestActionFuture + extends PlainActionFuture { private long getTimeout = -1L; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/JmsHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/JmsHealthIndicatorTests.java index 3eb90a59d7..b10a1eb8cb 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/JmsHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/JmsHealthIndicatorTests.java @@ -54,8 +54,8 @@ public class JmsHealthIndicatorTests { @Test public void jmsBrokerIsDown() throws JMSException { ConnectionFactory connectionFactory = mock(ConnectionFactory.class); - given(connectionFactory.createConnection()).willThrow( - new JMSException("test", "123")); + given(connectionFactory.createConnection()) + .willThrow(new JMSException("test", "123")); JmsHealthIndicator indicator = new JmsHealthIndicator(connectionFactory); Health health = indicator.health(); assertEquals(Status.DOWN, health.getStatus()); @@ -65,8 +65,8 @@ public class JmsHealthIndicatorTests { @Test public void jmsBrokerCouldNotRetrieveProviderMetadata() throws JMSException { ConnectionMetaData connectionMetaData = mock(ConnectionMetaData.class); - given(connectionMetaData.getJMSProviderName()).willThrow( - new JMSException("test", "123")); + given(connectionMetaData.getJMSProviderName()) + .willThrow(new JMSException("test", "123")); Connection connection = mock(Connection.class); given(connection.getMetaData()).willReturn(connectionMetaData); ConnectionFactory connectionFactory = mock(ConnectionFactory.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReaderTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReaderTests.java index be9be3cb5e..d20a1e946a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReaderTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReaderTests.java @@ -32,7 +32,8 @@ public class BufferMetricReaderTests { private GaugeBuffers gauges = new GaugeBuffers(); - private BufferMetricReader reader = new BufferMetricReader(this.counters, this.gauges); + private BufferMetricReader reader = new BufferMetricReader(this.counters, + this.gauges); @Test public void countReflectsNumberOfMetrics() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultGaugeServiceSpeedTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultGaugeServiceSpeedTests.java index 63a6e8f223..47e87f01ac 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultGaugeServiceSpeedTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultGaugeServiceSpeedTests.java @@ -93,8 +93,8 @@ public class DefaultGaugeServiceSpeedTests { public void run() { for (int i = 0; i < number; i++) { String name = sample[i % sample.length]; - DefaultGaugeServiceSpeedTests.this.gaugeService.submit(name, count - + i); + DefaultGaugeServiceSpeedTests.this.gaugeService.submit(name, + count + i); } } }; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServicesTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServicesTests.java index 4e7aadd091..dc30801fa6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServicesTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServicesTests.java @@ -121,7 +121,8 @@ public class DropwizardMetricServicesTests { private DropwizardMetricServices writer; - public WriterThread(ThreadGroup group, int index, DropwizardMetricServices writer) { + public WriterThread(ThreadGroup group, int index, + DropwizardMetricServices writer) { super(group, "Writer-" + index); this.index = index; this.writer = writer; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java index d4c218471a..500dd72aef 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java @@ -76,8 +76,8 @@ public class RedisMultiMetricRepositoryTests { @After public void clear() { - assertTrue(new StringRedisTemplate(this.redis.getConnectionFactory()) - .opsForZSet().size("keys." + this.prefix) > 0); + assertTrue(new StringRedisTemplate(this.redis.getConnectionFactory()).opsForZSet() + .size("keys." + this.prefix) > 0); this.repository.reset("foo"); this.repository.reset("bar"); assertNull(new StringRedisTemplate(this.redis.getConnectionFactory()) @@ -92,23 +92,26 @@ public class RedisMultiMetricRepositoryTests { Arrays.>asList(new Metric("foo.bar", 12.3))); this.repository.set("foo", Arrays.>asList(new Metric("foo.bar", 15.3))); - assertEquals(15.3, Iterables.collection(this.repository.findAll("foo")) - .iterator().next().getValue()); + assertEquals(15.3, Iterables.collection(this.repository.findAll("foo")).iterator() + .next().getValue()); } @Test public void setAndGetMultiple() { - this.repository.set("foo", Arrays.>asList(new Metric("foo.val", - 12.3), new Metric("foo.bar", 11.3))); + this.repository.set("foo", + Arrays.>asList(new Metric("foo.val", 12.3), + new Metric("foo.bar", 11.3))); assertEquals(2, Iterables.collection(this.repository.findAll("foo")).size()); } @Test public void groups() { - this.repository.set("foo", Arrays.>asList(new Metric("foo.val", - 12.3), new Metric("foo.bar", 11.3))); - this.repository.set("bar", Arrays.>asList(new Metric("bar.val", - 12.3), new Metric("bar.foo", 11.3))); + this.repository.set("foo", + Arrays.>asList(new Metric("foo.val", 12.3), + new Metric("foo.bar", 11.3))); + this.repository.set("bar", + Arrays.>asList(new Metric("bar.val", 12.3), + new Metric("bar.foo", 11.3))); Collection groups = Iterables.collection(this.repository.groups()); assertEquals(2, groups.size()); assertTrue("Wrong groups: " + groups, groups.contains("foo")); @@ -116,10 +119,12 @@ public class RedisMultiMetricRepositoryTests { @Test public void count() { - this.repository.set("foo", Arrays.>asList(new Metric("foo.val", - 12.3), new Metric("foo.bar", 11.3))); - this.repository.set("bar", Arrays.>asList(new Metric("bar.val", - 12.3), new Metric("bar.foo", 11.3))); + this.repository.set("foo", + Arrays.>asList(new Metric("foo.val", 12.3), + new Metric("foo.bar", 11.3))); + this.repository.set("bar", + Arrays.>asList(new Metric("bar.val", 12.3), + new Metric("bar.foo", 11.3))); assertEquals(2, this.repository.countGroups()); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java index a6db1be014..521153977b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java @@ -116,8 +116,9 @@ public class StatsdMetricWriterTests { final DatagramPacket packet = new DatagramPacket(new byte[256], 256); DummyStatsDServer.this.server.receive(packet); - DummyStatsDServer.this.messagesReceived.add(new String(packet - .getData(), Charset.forName("UTF-8")).trim()); + DummyStatsDServer.this.messagesReceived.add( + new String(packet.getData(), Charset.forName("UTF-8")) + .trim()); } catch (Exception e) { // Ignore diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/ApplicationPidFileWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/ApplicationPidFileWriterTests.java index 4a13f56d05..62d5e7bc65 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/ApplicationPidFileWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/ApplicationPidFileWriterTests.java @@ -75,7 +75,8 @@ public class ApplicationPidFileWriterTests { File file = this.temporaryFolder.newFile(); ApplicationPidFileWriter listener = new ApplicationPidFileWriter(file); listener.onApplicationEvent(EVENT); - assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString())); + assertThat(FileCopyUtils.copyToString(new FileReader(file)), + not(isEmptyString())); } @Test @@ -96,7 +97,8 @@ public class ApplicationPidFileWriterTests { file.getAbsolutePath()); ApplicationPidFileWriter listener = new ApplicationPidFileWriter(); listener.onApplicationEvent(event); - assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString())); + assertThat(FileCopyUtils.copyToString(new FileReader(file)), + not(isEmptyString())); } @Test @@ -109,7 +111,8 @@ public class ApplicationPidFileWriterTests { assertThat(FileCopyUtils.copyToString(new FileReader(file)), isEmptyString()); listener.setTriggerEventType(ApplicationEnvironmentPreparedEvent.class); listener.onApplicationEvent(event); - assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString())); + assertThat(FileCopyUtils.copyToString(new FileReader(file)), + not(isEmptyString())); } @Test @@ -117,9 +120,10 @@ public class ApplicationPidFileWriterTests { File file = this.temporaryFolder.newFile(); ApplicationPidFileWriter listener = new ApplicationPidFileWriter(file); listener.setTriggerEventType(ApplicationStartedEvent.class); - listener.onApplicationEvent(new ApplicationStartedEvent(new SpringApplication(), - new String[] {})); - assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString())); + listener.onApplicationEvent( + new ApplicationStartedEvent(new SpringApplication(), new String[] {})); + assertThat(FileCopyUtils.copyToString(new FileReader(file)), + not(isEmptyString())); } @Test @@ -161,9 +165,11 @@ public class ApplicationPidFileWriterTests { new String[] {}, environment); } - private SpringApplicationEvent createPreparedEvent(String propName, String propValue) { + private SpringApplicationEvent createPreparedEvent(String propName, + String propValue) { ConfigurableEnvironment environment = createEnvironment(propName, propValue); - ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class); + ConfigurableApplicationContext context = mock( + ConfigurableApplicationContext.class); given(context.getEnvironment()).willReturn(environment); return new ApplicationPreparedEvent(new SpringApplication(), new String[] {}, context); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessor.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessor.java index 8f2dbce319..eebf2ccb6d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessor.java @@ -42,8 +42,8 @@ import org.springframework.util.StringUtils; * @since 1.3.0 * @see BeanDefinition#setDependsOn(String[]) */ -public abstract class AbstractDependsOnBeanFactoryPostProcessor implements - BeanFactoryPostProcessor { +public abstract class AbstractDependsOnBeanFactoryPostProcessor + implements BeanFactoryPostProcessor { private final Class beanClass; @@ -74,9 +74,8 @@ public abstract class AbstractDependsOnBeanFactoryPostProcessor implements Set names = new HashSet(); names.addAll(Arrays.asList(BeanFactoryUtils.beanNamesForTypeIncludingAncestors( beanFactory, this.beanClass, true, false))); - for (String factoryBeanName : BeanFactoryUtils - .beanNamesForTypeIncludingAncestors(beanFactory, this.factoryBeanClass, - true, false)) { + for (String factoryBeanName : BeanFactoryUtils.beanNamesForTypeIncludingAncestors( + beanFactory, this.factoryBeanClass, true, false)) { names.add(BeanFactoryUtils.transformedBeanName(factoryBeanName)); } return names; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.java index 8e3ca18ad5..0a2a9b9511 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.java @@ -71,7 +71,8 @@ public class EnableAutoConfigurationImportSelector implements DeferredImportSele public String[] selectImports(AnnotationMetadata metadata) { try { AnnotationAttributes attributes = getAttributes(metadata); - List configurations = getCandidateConfigurations(metadata, attributes); + List configurations = getCandidateConfigurations(metadata, + attributes); configurations = removeDuplicates(configurations); Set exclusions = getExclusions(metadata, attributes); configurations.removeAll(exclusions); @@ -93,8 +94,8 @@ public class EnableAutoConfigurationImportSelector implements DeferredImportSele */ protected AnnotationAttributes getAttributes(AnnotationMetadata metadata) { String name = getAnnotationClass().getName(); - AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(name, true)); + AnnotationAttributes attributes = AnnotationAttributes + .fromMap(metadata.getAnnotationAttributes(name, true)); Assert.notNull(attributes, "No auto-configuration attributes found. Is " + metadata.getClassName() + " annotated with " + ClassUtils.getShortName(name) + "?"); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java index 64aa55ef28..32b315d4e7 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java @@ -87,9 +87,8 @@ public class MessageSourceAutoConfiguration { public MessageSource messageSource() { ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); if (StringUtils.hasText(this.basename)) { - messageSource.setBasenames(StringUtils - .commaDelimitedListToStringArray(StringUtils - .trimAllWhitespace(this.basename))); + messageSource.setBasenames(StringUtils.commaDelimitedListToStringArray( + StringUtils.trimAllWhitespace(this.basename))); } if (this.encoding != null) { messageSource.setDefaultEncoding(this.encoding.name()); @@ -138,8 +137,8 @@ public class MessageSourceAutoConfiguration { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - String basename = context.getEnvironment().getProperty( - "spring.messages.basename", "messages"); + String basename = context.getEnvironment() + .getProperty("spring.messages.basename", "messages"); ConditionOutcome outcome = cache.get(basename); if (outcome == null) { outcome = getMatchOutcomeForBasename(context, basename); @@ -150,8 +149,8 @@ public class MessageSourceAutoConfiguration { private ConditionOutcome getMatchOutcomeForBasename(ConditionContext context, String basename) { - for (String name : StringUtils.commaDelimitedListToStringArray(StringUtils - .trimAllWhitespace(basename))) { + for (String name : StringUtils.commaDelimitedListToStringArray( + StringUtils.trimAllWhitespace(basename))) { for (Resource resource : getResources(context.getClassLoader(), name)) { if (resource.exists()) { return ConditionOutcome.match("Bundle found for " @@ -159,8 +158,8 @@ public class MessageSourceAutoConfiguration { } } } - return ConditionOutcome.noMatch("No bundle found for " - + "spring.messages.basename: " + basename); + return ConditionOutcome.noMatch( + "No bundle found for " + "spring.messages.basename: " + basename); } private Resource[] getResources(ClassLoader classLoader, String name) { @@ -179,10 +178,11 @@ public class MessageSourceAutoConfiguration { * {@link PathMatchingResourcePatternResolver} that skips well known JARs that don't * contain messages.properties. */ - private static class SkipPatternPathMatchingResourcePatternResolver extends - PathMatchingResourcePatternResolver { + private static class SkipPatternPathMatchingResourcePatternResolver + extends PathMatchingResourcePatternResolver { private static final ClassLoader ROOT_CLASSLOADER; + static { ClassLoader classLoader = null; try { @@ -223,7 +223,8 @@ public class MessageSourceAutoConfiguration { protected Set doFindAllClassPathResources(String path) throws IOException { Set resources = super.doFindAllClassPathResources(path); - for (Iterator iterator = resources.iterator(); iterator.hasNext();) { + for (Iterator iterator = resources.iterator(); iterator + .hasNext();) { Resource resource = iterator.next(); for (String skipped : SKIPPED) { if (resource.getFilename().startsWith(skipped)) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.java index 058f649ad0..59ebd609f5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.java @@ -62,8 +62,8 @@ public class SpringApplicationAdminJmxAutoConfiguration { @Bean public SpringApplicationAdminMXBeanRegistrar springApplicationAdminRegistrar() throws MalformedObjectNameException { - String jmxName = this.environment - .getProperty(JMX_NAME_PROPERTY, DEFAULT_JMX_NAME); + String jmxName = this.environment.getProperty(JMX_NAME_PROPERTY, + DEFAULT_JMX_NAME); if (this.mbeanExporter != null) { // Make sure to not register that MBean twice this.mbeanExporter.addExcludedBean(jmxName); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java index ce83ef676a..a026ba226a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java @@ -112,9 +112,9 @@ public class BatchAutoConfiguration { @Bean @ConditionalOnMissingBean(JobOperator.class) - public SimpleJobOperator jobOperator(JobExplorer jobExplorer, - JobLauncher jobLauncher, ListableJobLocator jobRegistry, - JobRepository jobRepository) throws Exception { + public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher, + ListableJobLocator jobRegistry, JobRepository jobRepository) + throws Exception { SimpleJobOperator factory = new SimpleJobOperator(); factory.setJobExplorer(jobExplorer); factory.setJobLauncher(jobLauncher); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.java index fd5d08512a..59b41762ba 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.java @@ -87,8 +87,8 @@ public class CacheAutoConfiguration { for (String name : beanFactory.getBeanNamesForType(CacheAspectSupport.class, false, false)) { BeanDefinition definition = beanFactory.getBeanDefinition(name); - definition.setDependsOn(append(definition.getDependsOn(), - VALIDATOR_BEAN_NAME)); + definition.setDependsOn( + append(definition.getDependsOn(), VALIDATOR_BEAN_NAME)); } } @@ -116,9 +116,10 @@ public class CacheAutoConfiguration { @PostConstruct public void checkHasCacheManager() { - Assert.notNull(this.cacheManager, "No cache manager could " - + "be auto-configured, check your configuration (caching " - + "type is '" + this.cacheProperties.getType() + "')"); + Assert.notNull(this.cacheManager, + "No cache manager could " + + "be auto-configured, check your configuration (caching " + + "type is '" + this.cacheProperties.getType() + "')"); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.java index e785ac9cb2..4c8fbc66c2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.java @@ -40,8 +40,8 @@ class CacheCondition extends SpringBootCondition { if (!resolver.containsProperty("type")) { return ConditionOutcome.match("Automatic cache type"); } - CacheType cacheType = CacheConfigurations.getType(((AnnotationMetadata) metadata) - .getClassName()); + CacheType cacheType = CacheConfigurations + .getType(((AnnotationMetadata) metadata).getClassName()); String value = resolver.getProperty("type").replace("-", "_").toUpperCase(); if (value.equals(cacheType.name())) { return ConditionOutcome.match("Cache type " + cacheType); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java index 0a25d566ea..72f14b7396 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java @@ -33,6 +33,7 @@ final class CacheConfigurations { } private static final Map> MAPPINGS; + static { Map> mappings = new HashMap>(); mappings.put(CacheType.GENERIC, GenericCacheConfiguration.class); @@ -59,8 +60,8 @@ final class CacheConfigurations { return entry.getKey(); } } - throw new IllegalStateException("Unknown configuration class " - + configurationClassName); + throw new IllegalStateException( + "Unknown configuration class " + configurationClassName); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java index 85380b43c0..d8653abedb 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java @@ -89,8 +89,8 @@ class JCacheCacheConfiguration { } private CacheManager createCacheManager() throws IOException { - CachingProvider cachingProvider = getCachingProvider(this.cacheProperties - .getJcache().getProvider()); + CachingProvider cachingProvider = getCachingProvider( + this.cacheProperties.getJcache().getProvider()); Resource configLocation = this.cacheProperties .resolveConfigLocation(this.cacheProperties.getJcache().getConfig()); if (configLocation != null) { @@ -112,8 +112,8 @@ class JCacheCacheConfiguration { throws IOException { Properties properties = new Properties(); // Hazelcast does not use the URI as a mean to specify a custom config. - properties.setProperty("hazelcast.config.location", configLocation.getURI() - .toString()); + properties.setProperty("hazelcast.config.location", + configLocation.getURI().toString()); return properties; } @@ -178,8 +178,8 @@ class JCacheCacheConfiguration { } providers.next(); if (providers.hasNext()) { - return ConditionOutcome.noMatch("Multiple default JSR-107 compliant " - + "providers found"); + return ConditionOutcome.noMatch( + "Multiple default JSR-107 compliant " + "providers found"); } return ConditionOutcome.match("Default JSR-107 compliant provider found."); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java index 131c1e6701..4422b97548 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java @@ -42,8 +42,8 @@ import org.springframework.util.StringUtils; * * @author Phillip Webb */ -abstract class AbstractNestedCondition extends SpringBootCondition implements - ConfigurationCondition { +abstract class AbstractNestedCondition extends SpringBootCondition + implements ConfigurationCondition { private final ConfigurationPhase configurationPhase; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AllNestedConditions.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AllNestedConditions.java index 6b6388ffb1..9638ec1f2a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AllNestedConditions.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AllNestedConditions.java @@ -47,10 +47,11 @@ public abstract class AllNestedConditions extends AbstractNestedCondition { @Override protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcomes) { - return new ConditionOutcome(memberOutcomes.getMatches().size() == memberOutcomes - .getAll().size(), "nested all match resulted in " - + memberOutcomes.getMatches() + " matches and " - + memberOutcomes.getNonMatches() + " non matches"); + return new ConditionOutcome( + memberOutcomes.getMatches().size() == memberOutcomes.getAll().size(), + "nested all match resulted in " + memberOutcomes.getMatches() + + " matches and " + memberOutcomes.getNonMatches() + + " non matches"); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java index 53e7add76e..3d0a22fea9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java @@ -84,19 +84,19 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit ConditionalOnBean.class); List matching = getMatchingBeans(context, spec); if (matching.isEmpty()) { - return ConditionOutcome.noMatch("@ConditionalOnBean " + spec - + " found no beans"); + return ConditionOutcome + .noMatch("@ConditionalOnBean " + spec + " found no beans"); } - matchMessage.append("@ConditionalOnBean " + spec + " found the following " - + matching); + matchMessage.append( + "@ConditionalOnBean " + spec + " found the following " + matching); } if (metadata.isAnnotated(ConditionalOnSingleCandidate.class.getName())) { BeanSearchSpec spec = new SingleCandidateBeanSearchSpec(context, metadata, ConditionalOnSingleCandidate.class); List matching = getMatchingBeans(context, spec); if (matching.isEmpty()) { - return ConditionOutcome.noMatch("@ConditionalOnSingleCandidate " + spec - + " found no beans"); + return ConditionOutcome.noMatch( + "@ConditionalOnSingleCandidate " + spec + " found no beans"); } else if (!hasSingleAutowireCandidate(context.getBeanFactory(), matching)) { return ConditionOutcome.noMatch("@ConditionalOnSingleCandidate " + spec @@ -120,7 +120,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit return ConditionOutcome.match(matchMessage.toString()); } - private List getMatchingBeans(ConditionContext context, BeanSearchSpec beans) { + private List getMatchingBeans(ConditionContext context, + BeanSearchSpec beans) { ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); if (beans.getStrategy() == SearchStrategy.PARENTS) { BeanFactory parent = beanFactory.getParentBeanFactory(); @@ -163,7 +164,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit private Collection getBeanNamesForType(ListableBeanFactory beanFactory, String type, ClassLoader classLoader, boolean considerHierarchy) - throws LinkageError { + throws LinkageError { try { Set result = new LinkedHashSet(); collectBeanNamesForType(result, beanFactory, @@ -198,7 +199,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit .forName(type, classLoader); result = beanFactory.getBeanNamesForAnnotation(typeClass); if (considerHierarchy) { - if (beanFactory.getParentBeanFactory() instanceof ConfigurableListableBeanFactory) { + if (beanFactory + .getParentBeanFactory() instanceof ConfigurableListableBeanFactory) { String[] parentResult = getBeanNamesForAnnotation( (ConfigurableListableBeanFactory) beanFactory .getParentBeanFactory(), @@ -223,7 +225,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit private boolean hasSingleAutowireCandidate( ConfigurableListableBeanFactory beanFactory, List beanNames) { - return (beanNames.size() == 1 || getPrimaryBeans(beanFactory, beanNames).size() == 1); + return (beanNames.size() == 1 + || getPrimaryBeans(beanFactory, beanNames).size() == 1); } private List getPrimaryBeans(ConfigurableListableBeanFactory beanFactory, @@ -266,8 +269,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit if (this.types.isEmpty() && this.names.isEmpty()) { addDeducedBeanType(context, metadata, this.types); } - this.strategy = (SearchStrategy) metadata.getAnnotationAttributes( - annotationType.getName()).get("search"); + this.strategy = (SearchStrategy) metadata + .getAnnotationAttributes(annotationType.getName()).get("search"); validate(); } @@ -324,8 +327,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit methodMetadata.getDeclaringClassName(), context.getClassLoader()); ReflectionUtils.doWithMethods(configClass, new MethodCallback() { @Override - public void doWith(Method method) throws IllegalArgumentException, - IllegalAccessException { + public void doWith(Method method) + throws IllegalArgumentException, IllegalAccessException { if (methodMetadata.getMethodName().equals(method.getName())) { beanTypes.add(method.getReturnType().getName()); } @@ -335,10 +338,9 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit catch (Throwable ex) { // swallow exception and continue if (logger.isDebugEnabled()) { - logger.debug( - "Unable to deduce bean type for " - + methodMetadata.getDeclaringClassName() + "." - + methodMetadata.getMethodName(), ex); + logger.debug("Unable to deduce bean type for " + + methodMetadata.getDeclaringClassName() + "." + + methodMetadata.getMethodName(), ex); } } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java index f4db37ac81..b91ce08878 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java @@ -50,8 +50,10 @@ class OnResourceCondition extends SpringBootCondition { Assert.isTrue(locations.size() > 0, "@ConditionalOnResource annotations must specify at least one resource location"); for (String location : locations) { - if (!loader.getResource( - context.getEnvironment().resolvePlaceholders(location)).exists()) { + if (!loader + .getResource( + context.getEnvironment().resolvePlaceholders(location)) + .exists()) { return ConditionOutcome.noMatch("resource not found: " + location); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ResourceCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ResourceCondition.java index 7c68b2ec23..20e4fcab35 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ResourceCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ResourceCondition.java @@ -78,12 +78,12 @@ public abstract class ResourceCondition extends SpringBootCondition { for (String location : this.resourceLocations) { Resource resource = context.getResourceLoader().getResource(location); if (resource != null && resource.exists()) { - return ConditionOutcome.match("Found " + this.name + " config in " - + resource); + return ConditionOutcome + .match("Found " + this.name + " config in " + resource); } } - return ConditionOutcome.noMatch("No specific " + this.name - + " configuration found"); + return ConditionOutcome + .noMatch("No specific " + this.name + " configuration found"); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigureRegistrar.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigureRegistrar.java index b672586662..406a021166 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigureRegistrar.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigureRegistrar.java @@ -31,8 +31,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi * @author Eddú Meléndez * @since 1.3.0 */ -class CassandraRepositoriesAutoConfigureRegistrar extends - AbstractRepositoryConfigurationSourceSupport { +class CassandraRepositoriesAutoConfigureRegistrar + extends AbstractRepositoryConfigurationSourceSupport { @Override protected Class getAnnotation() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java index a639e30ee9..dcbbd99b86 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java @@ -56,6 +56,7 @@ import org.springframework.util.StringUtils; public class ElasticsearchAutoConfiguration implements DisposableBean { private static final Map DEFAULTS; + static { Map defaults = new LinkedHashMap(); defaults.put("http.enabled", String.valueOf(false)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/EntityManagerFactoryDependsOnPostProcessor.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/EntityManagerFactoryDependsOnPostProcessor.java index 8e67eaab18..8fe72e8720 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/EntityManagerFactoryDependsOnPostProcessor.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/EntityManagerFactoryDependsOnPostProcessor.java @@ -34,8 +34,8 @@ import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean; * @since 1.1.0 * @see BeanDefinition#setDependsOn(String[]) */ -public class EntityManagerFactoryDependsOnPostProcessor extends - AbstractDependsOnBeanFactoryPostProcessor { +public class EntityManagerFactoryDependsOnPostProcessor + extends AbstractDependsOnBeanFactoryPostProcessor { public EntityManagerFactoryDependsOnPostProcessor(String... dependsOn) { super(EntityManagerFactory.class, AbstractEntityManagerFactoryBean.class, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoClientDependsOnBeanFactoryPostProcessor.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoClientDependsOnBeanFactoryPostProcessor.java index e65e67f1e5..c5480fa8c4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoClientDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoClientDependsOnBeanFactoryPostProcessor.java @@ -34,8 +34,8 @@ import com.mongodb.MongoClient; * @since 1.3.0 */ @Order(Ordered.LOWEST_PRECEDENCE) -public class MongoClientDependsOnBeanFactoryPostProcessor extends - AbstractDependsOnBeanFactoryPostProcessor { +public class MongoClientDependsOnBeanFactoryPostProcessor + extends AbstractDependsOnBeanFactoryPostProcessor { public MongoClientDependsOnBeanFactoryPostProcessor(String... dependsOn) { super(MongoClient.class, MongoClientFactoryBean.class, dependsOn); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.java index de19ca82b2..9c8ab06917 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.java @@ -142,8 +142,8 @@ public class MongoDataAutoConfiguration implements BeanClassLoaderAware { context.setInitialEntitySet(getInitialEntitySet(beanFactory)); Class strategyClass = this.properties.getFieldNamingStrategy(); if (strategyClass != null) { - context.setFieldNamingStrategy((FieldNamingStrategy) BeanUtils - .instantiate(strategyClass)); + context.setFieldNamingStrategy( + (FieldNamingStrategy) BeanUtils.instantiate(strategyClass)); } return context; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.java index 7f2de6079a..da0d51f10e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.java @@ -114,8 +114,8 @@ public class RedisAutoConfiguration { sentinels.add(new RedisNode(parts[0], Integer.valueOf(parts[1]))); } catch (RuntimeException ex) { - throw new IllegalStateException("Invalid redis sentinel " - + "property '" + node + "'", ex); + throw new IllegalStateException( + "Invalid redis sentinel " + "property '" + node + "'", ex); } } return sentinels; @@ -128,8 +128,8 @@ public class RedisAutoConfiguration { */ @Configuration @ConditionalOnMissingClass("org.apache.commons.pool2.impl.GenericObjectPool") - protected static class RedisConnectionConfiguration extends - AbstractRedisConfiguration { + protected static class RedisConnectionConfiguration + extends AbstractRedisConfiguration { @Bean @ConditionalOnMissingBean(RedisConnectionFactory.class) @@ -145,8 +145,8 @@ public class RedisAutoConfiguration { */ @Configuration @ConditionalOnClass(GenericObjectPool.class) - protected static class RedisPooledConnectionConfiguration extends - AbstractRedisConfiguration { + protected static class RedisPooledConnectionConfiguration + extends AbstractRedisConfiguration { @Bean @ConditionalOnMissingBean(RedisConnectionFactory.class) @@ -184,7 +184,7 @@ public class RedisAutoConfiguration { @ConditionalOnMissingBean(name = "redisTemplate") public RedisTemplate redisTemplate( RedisConnectionFactory redisConnectionFactory) - throws UnknownHostException { + throws UnknownHostException { RedisTemplate template = new RedisTemplate(); template.setConnectionFactory(redisConnectionFactory); return template; @@ -194,7 +194,7 @@ public class RedisAutoConfiguration { @ConditionalOnMissingBean(StringRedisTemplate.class) public StringRedisTemplate stringRedisTemplate( RedisConnectionFactory redisConnectionFactory) - throws UnknownHostException { + throws UnknownHostException { StringRedisTemplate template = new StringRedisTemplate(); template.setConnectionFactory(redisConnectionFactory); return template; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index fe16020927..a4dd68e5bb 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -130,8 +130,8 @@ public class FlywayAutoConfiguration { @Configuration @ConditionalOnClass(LocalContainerEntityManagerFactoryBean.class) @ConditionalOnBean(AbstractEntityManagerFactoryBean.class) - protected static class FlywayInitializerJpaDependencyConfiguration extends - EntityManagerFactoryDependsOnPostProcessor { + protected static class FlywayInitializerJpaDependencyConfiguration + extends EntityManagerFactoryDependsOnPostProcessor { public FlywayInitializerJpaDependencyConfiguration() { super("flywayInitializer"); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.java index 35c2d54e2f..691d0b4aa5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.java @@ -72,8 +72,8 @@ public class H2ConsoleAutoConfiguration { } @Order(SecurityProperties.BASIC_AUTH_ORDER - 10) - private static class H2ConsoleSecurityConfigurer extends - WebSecurityConfigurerAdapter { + private static class H2ConsoleSecurityConfigurer + extends WebSecurityConfigurerAdapter { @Autowired private H2ConsoleProperties console; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaHttpMessageConverterConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaHttpMessageConverterConfiguration.java index a2673c0619..c7f0c4121c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaHttpMessageConverterConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaHttpMessageConverterConfiguration.java @@ -56,8 +56,8 @@ public class HypermediaHttpMessageConverterConfiguration { * {@code Jackson2ModuleRegisteringBeanPostProcessor} has registered the converter and * it is unordered. */ - private static class HalMessageConverterSupportedMediaTypesCustomizer implements - BeanFactoryAware { + private static class HalMessageConverterSupportedMediaTypesCustomizer + implements BeanFactoryAware { private volatile BeanFactory beanFactory; @@ -73,9 +73,9 @@ public class HypermediaHttpMessageConverterConfiguration { .getMessageConverters()) { if (converter instanceof TypeConstrainedMappingJackson2HttpMessageConverter) { ((TypeConstrainedMappingJackson2HttpMessageConverter) converter) - .setSupportedMediaTypes(Arrays.asList( - MediaTypes.HAL_JSON, - MediaType.APPLICATION_JSON)); + .setSupportedMediaTypes( + Arrays.asList(MediaTypes.HAL_JSON, + MediaType.APPLICATION_JSON)); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastConfigResourceCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastConfigResourceCondition.java index 373c7c9844..19b34355f4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastConfigResourceCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastConfigResourceCondition.java @@ -43,8 +43,8 @@ public abstract class HazelcastConfigResourceCondition extends ResourceCondition protected ConditionOutcome getResourceOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { if (System.getProperty(CONFIG_SYSTEM_PROPERTY) != null) { - return ConditionOutcome.match("System property '" + CONFIG_SYSTEM_PROPERTY - + "' is set."); + return ConditionOutcome + .match("System property '" + CONFIG_SYSTEM_PROPERTY + "' is set."); } return super.getResourceOutcome(context, metadata); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java index d0f646074b..fc15a249e5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java @@ -103,21 +103,23 @@ public class JacksonAutoConfiguration { SimpleModule module = new SimpleModule(); JacksonJodaDateFormat jacksonJodaFormat = getJacksonJodaDateFormat(); if (jacksonJodaFormat != null) { - module.addSerializer(DateTime.class, new DateTimeSerializer( - jacksonJodaFormat)); + module.addSerializer(DateTime.class, + new DateTimeSerializer(jacksonJodaFormat)); } return module; } private JacksonJodaDateFormat getJacksonJodaDateFormat() { if (this.jacksonProperties.getJodaDateTimeFormat() != null) { - return new JacksonJodaDateFormat(DateTimeFormat.forPattern( - this.jacksonProperties.getJodaDateTimeFormat()).withZoneUTC()); + return new JacksonJodaDateFormat(DateTimeFormat + .forPattern(this.jacksonProperties.getJodaDateTimeFormat()) + .withZoneUTC()); } if (this.jacksonProperties.getDateFormat() != null) { try { - return new JacksonJodaDateFormat(DateTimeFormat.forPattern( - this.jacksonProperties.getDateFormat()).withZoneUTC()); + return new JacksonJodaDateFormat(DateTimeFormat + .forPattern(this.jacksonProperties.getDateFormat()) + .withZoneUTC()); } catch (IllegalArgumentException ex) { if (this.log.isWarnEnabled()) { @@ -163,8 +165,8 @@ public class JacksonAutoConfiguration { Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder(); builder.applicationContext(this.applicationContext); if (this.jacksonProperties.getSerializationInclusion() != null) { - builder.serializationInclusion(this.jacksonProperties - .getSerializationInclusion()); + builder.serializationInclusion( + this.jacksonProperties.getSerializationInclusion()); } if (this.jacksonProperties.getTimeZone() != null) { builder.timeZone(this.jacksonProperties.getTimeZone()); @@ -200,8 +202,8 @@ public class JacksonAutoConfiguration { if (dateFormat != null) { try { Class dateFormatClass = ClassUtils.forName(dateFormat, null); - builder.dateFormat((DateFormat) BeanUtils - .instantiateClass(dateFormatClass)); + builder.dateFormat( + (DateFormat) BeanUtils.instantiateClass(dateFormatClass)); } catch (ClassNotFoundException ex) { builder.dateFormat(new SimpleDateFormat(dateFormat)); @@ -209,7 +211,8 @@ public class JacksonAutoConfiguration { } } - private void configurePropertyNamingStrategy(Jackson2ObjectMapperBuilder builder) { + private void configurePropertyNamingStrategy( + Jackson2ObjectMapperBuilder builder) { // We support a fully qualified class name extending Jackson's // PropertyNamingStrategy or a string value corresponding to the constant // names in PropertyNamingStrategy which hold default provided implementations @@ -226,7 +229,8 @@ public class JacksonAutoConfiguration { } private void configurePropertyNamingStrategyClass( - Jackson2ObjectMapperBuilder builder, Class propertyNamingStrategyClass) { + Jackson2ObjectMapperBuilder builder, + Class propertyNamingStrategyClass) { builder.propertyNamingStrategy((PropertyNamingStrategy) BeanUtils .instantiateClass(propertyNamingStrategyClass)); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java index 7474567043..6242146000 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java @@ -43,8 +43,8 @@ import org.springframework.util.StringUtils; * @since 1.1.0 */ @ConfigurationProperties(prefix = DataSourceProperties.PREFIX) -public class DataSourceProperties implements BeanClassLoaderAware, EnvironmentAware, - InitializingBean { +public class DataSourceProperties + implements BeanClassLoaderAware, EnvironmentAware, InitializingBean { public static final String PREFIX = "spring.datasource"; @@ -162,8 +162,8 @@ public class DataSourceProperties implements BeanClassLoaderAware, EnvironmentAw public String getDriverClassName() { if (StringUtils.hasText(this.driverClassName)) { - Assert.state(driverClassIsLoadable(), "Cannot load driver class: " - + this.driverClassName); + Assert.state(driverClassIsLoadable(), + "Cannot load driver class: " + this.driverClassName); return this.driverClassName; } String driverClassName = null; @@ -383,8 +383,9 @@ public class DataSourceProperties implements BeanClassLoaderAware, EnvironmentAw } else { message.append(" (the profiles \"" - + StringUtils.arrayToCommaDelimitedString(environment - .getActiveProfiles()) + "\" are currently active)"); + + StringUtils.arrayToCommaDelimitedString( + environment.getActiveProfiles()) + + "\" are currently active)"); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java index 685fac7ecd..9d8012d400 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java @@ -64,7 +64,8 @@ public enum EmbeddedDatabaseConnection { private final String url; - EmbeddedDatabaseConnection(EmbeddedDatabaseType type, String driverClass, String url) { + EmbeddedDatabaseConnection(EmbeddedDatabaseType type, String driverClass, + String url) { this.type = type; this.driverClass = driverClass; this.url = url; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProviders.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProviders.java index 7be02bee30..cdff451358 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProviders.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProviders.java @@ -41,8 +41,8 @@ public class DataSourcePoolMetadataProviders implements DataSourcePoolMetadataPr */ public DataSourcePoolMetadataProviders( Collection providers) { - this.providers = (providers == null ? Collections - .emptyList() + this.providers = (providers == null + ? Collections.emptyList() : new ArrayList(providers)); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java index fd25209308..ac28329c7b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java @@ -120,8 +120,9 @@ public class JmsProperties { if (this.concurrency == null) { return (this.maxConcurrency != null ? "1-" + this.maxConcurrency : null); } - return (this.maxConcurrency != null ? this.concurrency + "-" - + this.maxConcurrency : String.valueOf(this.concurrency)); + return (this.maxConcurrency != null + ? this.concurrency + "-" + this.maxConcurrency + : String.valueOf(this.concurrency)); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryConfiguration.java index 4da9628d62..d39b30d53b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryConfiguration.java @@ -35,8 +35,8 @@ import org.springframework.context.annotation.Configuration; class ArtemisConnectionFactoryConfiguration { @Bean - public ActiveMQConnectionFactory jmsConnectionFactory( - ListableBeanFactory beanFactory, ArtemisProperties properties) { + public ActiveMQConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory, + ArtemisProperties properties) { return new ArtemisConnectionFactoryFactory(beanFactory, properties) .createConnectionFactory(ActiveMQConnectionFactory.class); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java index ae87dc9bad..f7c890103e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java @@ -62,8 +62,8 @@ class ArtemisConnectionFactoryFactory { return doCreateConnectionFactory(factoryClass); } catch (Exception ex) { - throw new IllegalStateException("Unable to create " - + "ActiveMQConnectionFactory", ex); + throw new IllegalStateException( + "Unable to create " + "ActiveMQConnectionFactory", ex); } } @@ -106,12 +106,12 @@ class ArtemisConnectionFactoryFactory { Class factoryClass) throws Exception { try { TransportConfiguration transportConfiguration = new TransportConfiguration( - InVMConnectorFactory.class.getName(), this.properties.getEmbedded() - .generateTransportParameters()); + InVMConnectorFactory.class.getName(), + this.properties.getEmbedded().generateTransportParameters()); ServerLocator serviceLocator = ActiveMQClient .createServerLocatorWithoutHA(transportConfiguration); - return factoryClass.getConstructor(ServerLocator.class).newInstance( - serviceLocator); + return factoryClass.getConstructor(ServerLocator.class) + .newInstance(serviceLocator); } catch (NoClassDefFoundError ex) { throw new IllegalStateException("Unable to create InVM " diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisXAConnectionFactoryConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisXAConnectionFactoryConfiguration.java index c0292d42ec..60eb2472f6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisXAConnectionFactoryConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisXAConnectionFactoryConfiguration.java @@ -46,10 +46,10 @@ class ArtemisXAConnectionFactoryConfiguration { @Bean(name = { "jmsConnectionFactory", "xaJmsConnectionFactory" }) public ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory, ArtemisProperties properties, XAConnectionFactoryWrapper wrapper) - throws Exception { - return wrapper.wrapConnectionFactory(new ArtemisConnectionFactoryFactory( - beanFactory, properties) - .createConnectionFactory(ActiveMQXAConnectionFactory.class)); + throws Exception { + return wrapper.wrapConnectionFactory( + new ArtemisConnectionFactoryFactory(beanFactory, properties) + .createConnectionFactory(ActiveMQXAConnectionFactory.class)); } @Bean diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java index ba5ff41800..f2f9e14606 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java @@ -57,9 +57,10 @@ public class JooqAutoConfiguration { @Bean @ConditionalOnMissingBean(DataSourceConnectionProvider.class) - public DataSourceConnectionProvider dataSourceConnectionProvider(DataSource dataSource) { - return new DataSourceConnectionProvider(new TransactionAwareDataSourceProxy( - dataSource)); + public DataSourceConnectionProvider dataSourceConnectionProvider( + DataSource dataSource) { + return new DataSourceConnectionProvider( + new TransactionAwareDataSourceProxy(dataSource)); } @Bean diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java index addc5857ea..a0e86a1508 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java @@ -64,8 +64,8 @@ class JooqExceptionTranslator extends DefaultExecuteListener { /** * Handle a single exception in the chain. SQLExceptions might be nested multiple - * levels deep. The outermost exception is usually the least interesting one - * ("Call getNextException to see the cause."). Therefore the innermost exception is + * levels deep. The outermost exception is usually the least interesting one ( + * "Call getNextException to see the cause."). Therefore the innermost exception is * propagated and all other exceptions are logged. * @param context the execute context * @param translator the exception translator diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializer.java index 81b7d95f8a..f7a48b8db9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializer.java @@ -55,8 +55,8 @@ import org.springframework.util.StringUtils; * @author Phillip Webb * @author Andy Wilkinson */ -public class AutoConfigurationReportLoggingInitializer implements - ApplicationContextInitializer { +public class AutoConfigurationReportLoggingInitializer + implements ApplicationContextInitializer { private final Log logger = LogFactory.getLog(getClass()); @@ -70,20 +70,22 @@ public class AutoConfigurationReportLoggingInitializer implements applicationContext.addApplicationListener(new AutoConfigurationReportListener()); if (applicationContext instanceof GenericApplicationContext) { // Get the report early in case the context fails to load - this.report = ConditionEvaluationReport.get(this.applicationContext - .getBeanFactory()); + this.report = ConditionEvaluationReport + .get(this.applicationContext.getBeanFactory()); } } protected void onApplicationEvent(ApplicationEvent event) { ConfigurableApplicationContext initializerApplicationContext = AutoConfigurationReportLoggingInitializer.this.applicationContext; if (event instanceof ContextRefreshedEvent) { - if (((ApplicationContextEvent) event).getApplicationContext() == initializerApplicationContext) { + if (((ApplicationContextEvent) event) + .getApplicationContext() == initializerApplicationContext) { logAutoConfigurationReport(); } } else if (event instanceof ApplicationFailedEvent) { - if (((ApplicationFailedEvent) event).getApplicationContext() == initializerApplicationContext) { + if (((ApplicationFailedEvent) event) + .getApplicationContext() == initializerApplicationContext) { logAutoConfigurationReport(true); } } @@ -100,8 +102,8 @@ public class AutoConfigurationReportLoggingInitializer implements + "due to missing ApplicationContext"); return; } - this.report = ConditionEvaluationReport.get(this.applicationContext - .getBeanFactory()); + this.report = ConditionEvaluationReport + .get(this.applicationContext.getBeanFactory()); } if (this.report.getConditionAndOutcomesBySource().size() > 0) { if (isCrashReport && this.logger.isInfoEnabled() @@ -124,8 +126,8 @@ public class AutoConfigurationReportLoggingInitializer implements message.append("=========================\n\n\n"); message.append("Positive matches:\n"); message.append("-----------------\n"); - Map shortOutcomes = orderByName(report - .getConditionAndOutcomesBySource()); + Map shortOutcomes = orderByName( + report.getConditionAndOutcomesBySource()); for (Map.Entry entry : shortOutcomes.entrySet()) { if (entry.getValue().isFullMatch()) { addLogMessage(message, entry.getKey(), entry.getValue()); @@ -185,8 +187,8 @@ public class AutoConfigurationReportLoggingInitializer implements private void addLogMessage(StringBuilder message, String source, ConditionAndOutcomes conditionAndOutcomes) { message.append("\n " + source); - message.append(conditionAndOutcomes.isFullMatch() ? " matched\n" - : " did not match\n"); + message.append( + conditionAndOutcomes.isFullMatch() ? " matched\n" : " did not match\n"); for (ConditionAndOutcome conditionAndOutcome : conditionAndOutcomes) { message.append(" - "); if (StringUtils.hasLength(conditionAndOutcome.getOutcome().getMessage())) { @@ -197,8 +199,8 @@ public class AutoConfigurationReportLoggingInitializer implements : "did not match"); } message.append(" ("); - message.append(ClassUtils.getShortName(conditionAndOutcome.getCondition() - .getClass())); + message.append(ClassUtils + .getShortName(conditionAndOutcome.getCondition().getClass())); message.append(")\n"); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/JndiSessionConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/JndiSessionConfiguration.java index 060cc24c98..dcd38e038c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/JndiSessionConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/JndiSessionConfiguration.java @@ -51,8 +51,9 @@ class JndiSessionConfiguration { return new JndiLocatorDelegate().lookup(jndiName, Session.class); } catch (NamingException ex) { - throw new IllegalStateException(String.format( - "Unable to find Session in JNDI location %s", jndiName), ex); + throw new IllegalStateException( + String.format("Unable to find Session in JNDI location %s", jndiName), + ex); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index ff951ee58d..a535a92828 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -93,20 +93,20 @@ public class EmbeddedMongoAutoConfiguration { @ConditionalOnMissingBean @ConditionalOnClass(Logger.class) public IRuntimeConfig embeddedMongoRuntimeConfig() { - Logger logger = LoggerFactory.getLogger(getClass().getPackage().getName() - + ".EmbeddedMongo"); + Logger logger = LoggerFactory + .getLogger(getClass().getPackage().getName() + ".EmbeddedMongo"); ProcessOutput processOutput = new ProcessOutput( Processors.logTo(logger, Slf4jLevel.INFO), - Processors.logTo(logger, Slf4jLevel.ERROR), - Processors.named("[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG))); + Processors.logTo(logger, Slf4jLevel.ERROR), Processors.named("[console>]", + Processors.logTo(logger, Slf4jLevel.DEBUG))); return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger) .processOutput(processOutput).artifactStore(getArtifactStore(logger)) .build(); } private ArtifactStoreBuilder getArtifactStore(Logger logger) { - return new ExtractedArtifactStoreBuilder().defaults(Command.MongoD).download( - new DownloadConfigBuilder().defaultsForCommand(Command.MongoD) + return new ExtractedArtifactStoreBuilder().defaults(Command.MongoD) + .download(new DownloadConfigBuilder().defaultsForCommand(Command.MongoD) .progressListener(new Slf4jProgressListener(logger))); } @@ -181,8 +181,8 @@ public class EmbeddedMongoAutoConfiguration { */ @Configuration @ConditionalOnClass(MongoClient.class) - protected static class EmbeddedMongoDependencyConfiguration extends - MongoClientDependsOnBeanFactoryPostProcessor { + protected static class EmbeddedMongoDependencyConfiguration + extends MongoClientDependsOnBeanFactoryPostProcessor { public EmbeddedMongoDependencyConfiguration() { super("embeddedMongoServer"); @@ -194,14 +194,15 @@ public class EmbeddedMongoAutoConfiguration { * A workaround for the lack of a {@code toString} implementation on * {@code GenericFeatureAwareVersion}. */ - private final static class ToStringFriendlyFeatureAwareVersion implements - IFeatureAwareVersion { + private final static class ToStringFriendlyFeatureAwareVersion + implements IFeatureAwareVersion { private final String version; private final Set features; - private ToStringFriendlyFeatureAwareVersion(String version, Set features) { + private ToStringFriendlyFeatureAwareVersion(String version, + Set features) { Assert.notNull(version, "version must not be null"); this.version = version; this.features = (features == null ? Collections.emptySet() diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilder.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilder.java index 8915e21133..e8d04a9ff6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilder.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilder.java @@ -66,8 +66,8 @@ public class EntityManagerFactoryBuilder { * @param callback the entity manager factory bean callback */ public void setCallback(final EntityManagerFactoryBeanCallback callback) { - this.delegate - .setCallback(new org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder.EntityManagerFactoryBeanCallback() { + this.delegate.setCallback( + new org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder.EntityManagerFactoryBeanCallback() { @Override public void execute(LocalContainerEntityManagerFactoryBean factory) { @@ -169,8 +169,8 @@ public class EntityManagerFactoryBuilder { } - private static class Delegate extends - org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder { + private static class Delegate + extends org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder { Delegate(JpaVendorAdapter jpaVendorAdapter, Map jpaProperties, PersistenceUnitManager persistenceUnitManager) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java index da78c88601..0e99bec10f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java @@ -152,7 +152,8 @@ public class AuthenticationManagerConfiguration { private final SecurityProperties securityProperties; - DefaultInMemoryUserDetailsManagerConfigurer(SecurityProperties securityProperties) { + DefaultInMemoryUserDetailsManagerConfigurer( + SecurityProperties securityProperties) { this.securityProperties = securityProperties; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java index 3da4911a26..89d4ec5845 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java @@ -62,7 +62,8 @@ public class SecurityProperties implements SecurityPrerequisite { * other filters registered with the container). There is no connection between this * and the @Order on a WebSecurityConfigurer. */ - public static final int DEFAULT_FILTER_ORDER = FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100; + public static final int DEFAULT_FILTER_ORDER = FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER + - 100; /** * Enable secure channel for all requests. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/authserver/OAuth2AuthorizationServerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/authserver/OAuth2AuthorizationServerConfiguration.java index d91b7bba74..76f4510c9f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/authserver/OAuth2AuthorizationServerConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/authserver/OAuth2AuthorizationServerConfiguration.java @@ -60,8 +60,8 @@ import org.springframework.security.oauth2.provider.token.TokenStore; @ConditionalOnMissingBean(AuthorizationServerConfigurer.class) @ConditionalOnBean(AuthorizationServerEndpointsConfiguration.class) @EnableConfigurationProperties -public class OAuth2AuthorizationServerConfiguration extends - AuthorizationServerConfigurerAdapter { +public class OAuth2AuthorizationServerConfiguration + extends AuthorizationServerConfigurerAdapter { private static final Log logger = LogFactory .getLog(OAuth2AuthorizationServerConfiguration.class); @@ -88,8 +88,8 @@ public class OAuth2AuthorizationServerConfiguration extends .toArray(new String[0])) .scopes(this.details.getScope().toArray(new String[0])); if (this.details.getRegisteredRedirectUri() != null) { - builder.redirectUris(this.details.getRegisteredRedirectUri().toArray( - new String[0])); + builder.redirectUris( + this.details.getRegisteredRedirectUri().toArray(new String[0])); } } @@ -140,8 +140,8 @@ public class OAuth2AuthorizationServerConfiguration extends details.setClientSecret(this.client.getClientSecret()); details.setAuthorizedGrantTypes(Arrays.asList("authorization_code", "password", "client_credentials", "implicit", "refresh_token")); - details.setAuthorities(AuthorityUtils - .commaSeparatedStringToAuthorityList("ROLE_USER")); + details.setAuthorities( + AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER")); details.setRegisteredRedirectUri(Collections.emptySet()); return details; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java index c8295e9f8e..7c762498d1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java @@ -72,7 +72,8 @@ public class OAuth2RestOperationsConfiguration { @Primary public OAuth2RestTemplate oauth2RestTemplate(OAuth2ClientContext oauth2ClientContext, OAuth2ProtectedResourceDetails details) { - OAuth2RestTemplate template = new OAuth2RestTemplate(details, oauth2ClientContext); + OAuth2RestTemplate template = new OAuth2RestTemplate(details, + oauth2ClientContext); return template; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2SsoCustomConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2SsoCustomConfiguration.java index 6b4077d185..84743e0d06 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2SsoCustomConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2SsoCustomConfiguration.java @@ -49,8 +49,8 @@ import org.springframework.util.ReflectionUtils; */ @Configuration @Conditional(WebSecurityEnhancerCondition.class) -public class OAuth2SsoCustomConfiguration implements ImportAware, BeanPostProcessor, - BeanFactoryAware { +public class OAuth2SsoCustomConfiguration + implements ImportAware, BeanPostProcessor, BeanFactoryAware { private Class configType; @@ -63,8 +63,8 @@ public class OAuth2SsoCustomConfiguration implements ImportAware, BeanPostProces @Override public void setImportMetadata(AnnotationMetadata importMetadata) { - this.configType = ClassUtils - .resolveClassName(importMetadata.getClassName(), null); + this.configType = ClassUtils.resolveClassName(importMetadata.getClassName(), + null); } @@ -98,8 +98,8 @@ public class OAuth2SsoCustomConfiguration implements ImportAware, BeanPostProces @Override public Object invoke(MethodInvocation invocation) throws Throwable { if (invocation.getMethod().getName().equals("init")) { - Method method = ReflectionUtils.findMethod( - WebSecurityConfigurerAdapter.class, "getHttp"); + Method method = ReflectionUtils + .findMethod(WebSecurityConfigurerAdapter.class, "getHttp"); ReflectionUtils.makeAccessible(method); HttpSecurity http = (HttpSecurity) ReflectionUtils.invokeMethod(method, invocation.getThis()); @@ -115,17 +115,17 @@ public class OAuth2SsoCustomConfiguration implements ImportAware, BeanPostProces @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - String[] enablers = context.getBeanFactory().getBeanNamesForAnnotation( - EnableOAuth2Sso.class); + String[] enablers = context.getBeanFactory() + .getBeanNamesForAnnotation(EnableOAuth2Sso.class); for (String name : enablers) { if (context.getBeanFactory().isTypeMatch(name, WebSecurityConfigurerAdapter.class)) { - return ConditionOutcome - .match("found @EnableOAuth2Sso on a WebSecurityConfigurerAdapter"); + return ConditionOutcome.match( + "found @EnableOAuth2Sso on a WebSecurityConfigurerAdapter"); } } - return ConditionOutcome - .noMatch("found no @EnableOAuth2Sso on a WebSecurityConfigurerAdapter"); + return ConditionOutcome.noMatch( + "found no @EnableOAuth2Sso on a WebSecurityConfigurerAdapter"); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2SsoDefaultConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2SsoDefaultConfiguration.java index 8e475b1508..6c67e5af76 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2SsoDefaultConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2SsoDefaultConfiguration.java @@ -42,8 +42,8 @@ import org.springframework.util.ClassUtils; */ @Configuration @Conditional(NeedsWebSecurityCondition.class) -public class OAuth2SsoDefaultConfiguration extends WebSecurityConfigurerAdapter implements - Ordered { +public class OAuth2SsoDefaultConfiguration extends WebSecurityConfigurerAdapter + implements Ordered { @Autowired BeanFactory beanFactory; @@ -62,10 +62,9 @@ public class OAuth2SsoDefaultConfiguration extends WebSecurityConfigurerAdapter if (this.sso.getFilterOrder() != null) { return this.sso.getFilterOrder(); } - if (ClassUtils - .isPresent( - "org.springframework.boot.actuate.autoconfigure.ManagementServerProperties", - null)) { + if (ClassUtils.isPresent( + "org.springframework.boot.actuate.autoconfigure.ManagementServerProperties", + null)) { // If > BASIC_AUTH_ORDER then the existing rules for the actuator // endpoints will take precedence. This value is < BASIC_AUTH_ORDER. return SecurityProperties.ACCESS_OVERRIDE_ORDER - 5; @@ -78,13 +77,13 @@ public class OAuth2SsoDefaultConfiguration extends WebSecurityConfigurerAdapter @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - String[] enablers = context.getBeanFactory().getBeanNamesForAnnotation( - EnableOAuth2Sso.class); + String[] enablers = context.getBeanFactory() + .getBeanNamesForAnnotation(EnableOAuth2Sso.class); for (String name : enablers) { if (context.getBeanFactory().isTypeMatch(name, WebSecurityConfigurerAdapter.class)) { - return ConditionOutcome - .noMatch("found @EnableOAuth2Sso on a WebSecurityConfigurerAdapter"); + return ConditionOutcome.noMatch( + "found @EnableOAuth2Sso on a WebSecurityConfigurerAdapter"); } } return ConditionOutcome diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/SsoSecurityConfigurer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/SsoSecurityConfigurer.java index 1aa149e7da..3681b4aab2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/SsoSecurityConfigurer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/SsoSecurityConfigurer.java @@ -57,8 +57,8 @@ class SsoSecurityConfigurer { return filter; } - private static class OAuth2ClientAuthenticationConfigurer extends - SecurityConfigurerAdapter { + private static class OAuth2ClientAuthenticationConfigurer + extends SecurityConfigurerAdapter { private OAuth2ClientAuthenticationProcessingFilter filter; @@ -70,8 +70,8 @@ class SsoSecurityConfigurer { @Override public void configure(HttpSecurity builder) throws Exception { OAuth2ClientAuthenticationProcessingFilter ssoFilter = this.filter; - ssoFilter.setSessionAuthenticationStrategy(builder - .getSharedObject(SessionAuthenticationStrategy.class)); + ssoFilter.setSessionAuthenticationStrategy( + builder.getSharedObject(SessionAuthenticationStrategy.class)); builder.addFilterAfter(ssoFilter, AbstractPreAuthenticatedProcessingFilter.class); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/method/OAuth2MethodSecurityConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/method/OAuth2MethodSecurityConfiguration.java index cb850dcf95..dddd54683f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/method/OAuth2MethodSecurityConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/method/OAuth2MethodSecurityConfiguration.java @@ -44,8 +44,8 @@ import org.springframework.security.oauth2.provider.expression.OAuth2MethodSecur @Configuration @ConditionalOnClass({ OAuth2AccessToken.class }) @ConditionalOnBean(GlobalMethodSecurityConfiguration.class) -public class OAuth2MethodSecurityConfiguration implements BeanFactoryPostProcessor, - ApplicationContextAware { +public class OAuth2MethodSecurityConfiguration + implements BeanFactoryPostProcessor, ApplicationContextAware { private ApplicationContext applicationContext; @@ -63,8 +63,8 @@ public class OAuth2MethodSecurityConfiguration implements BeanFactoryPostProcess beanFactory.addBeanPostProcessor(processor); } - private static class OAuth2ExpressionHandlerInjectionPostProcessor implements - BeanPostProcessor { + private static class OAuth2ExpressionHandlerInjectionPostProcessor + implements BeanPostProcessor { private ApplicationContext applicationContext; @@ -84,7 +84,8 @@ public class OAuth2MethodSecurityConfiguration implements BeanFactoryPostProcess throws BeansException { if (bean instanceof DefaultMethodSecurityExpressionHandler && !(bean instanceof OAuth2MethodSecurityExpressionHandler)) { - return getExpressionHandler((DefaultMethodSecurityExpressionHandler) bean); + return getExpressionHandler( + (DefaultMethodSecurityExpressionHandler) bean); } return bean; } @@ -93,7 +94,8 @@ public class OAuth2MethodSecurityConfiguration implements BeanFactoryPostProcess DefaultMethodSecurityExpressionHandler bean) { OAuth2MethodSecurityExpressionHandler handler = new OAuth2MethodSecurityExpressionHandler(); handler.setApplicationContext(this.applicationContext); - AuthenticationTrustResolver trustResolver = findInContext(AuthenticationTrustResolver.class); + AuthenticationTrustResolver trustResolver = findInContext( + AuthenticationTrustResolver.class); if (trustResolver != null) { handler.setTrustResolver(trustResolver); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/OAuth2ResourceServerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/OAuth2ResourceServerConfiguration.java index 94bfccc266..efd0b84ee4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/OAuth2ResourceServerConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/OAuth2ResourceServerConfiguration.java @@ -73,8 +73,8 @@ public class OAuth2ResourceServerConfiguration { return new ResourceSecurityConfigurer(this.resource); } - protected static class ResourceSecurityConfigurer extends - ResourceServerConfigurerAdapter { + protected static class ResourceSecurityConfigurer + extends ResourceServerConfigurerAdapter { private ResourceServerProperties resource; @@ -96,8 +96,8 @@ public class OAuth2ResourceServerConfiguration { } - protected static class ResourceServerCondition extends SpringBootCondition implements - ConfigurationCondition { + protected static class ResourceServerCondition extends SpringBootCondition + implements ConfigurationCondition { private static final String AUTHORIZATION_ANNOTATION = "org.springframework." + "security.oauth2.config.annotation.web.configuration." @@ -123,14 +123,14 @@ public class OAuth2ResourceServerConfiguration { return ConditionOutcome.match("found JWT resource configuration"); } if (StringUtils.hasText(resolver.getProperty("user-info-uri"))) { - return ConditionOutcome.match("found UserInfo " - + "URI resource configuration"); + return ConditionOutcome + .match("found UserInfo " + "URI resource configuration"); } if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) { if (AuthorizationServerEndpointsConfigurationBeanCondition .matches(context)) { - return ConditionOutcome.match("found authorization " - + "server endpoints configuration"); + return ConditionOutcome.match( + "found authorization " + "server endpoints configuration"); } } return ConditionOutcome.noMatch("found neither client id nor " diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerProperties.java index a354e078b5..0f97e93a1c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerProperties.java @@ -203,8 +203,8 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware { } private int countBeans(Class type) { - return BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.beanFactory, - type, true, false).length; + return BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.beanFactory, type, + true, false).length; } public class Jwt { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java index 7ca42b39a8..17592c462c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java @@ -91,10 +91,10 @@ public class ResourceServerTokenServicesConfiguration { static { DEFAULT_RESOURCE_DETAILS.setClientId(""); - DEFAULT_RESOURCE_DETAILS.setUserAuthorizationUri("Not a URI " - + "because there is no client"); - DEFAULT_RESOURCE_DETAILS.setAccessTokenUri("Not a URI " - + "because there is no client"); + DEFAULT_RESOURCE_DETAILS + .setUserAuthorizationUri("Not a URI " + "because there is no client"); + DEFAULT_RESOURCE_DETAILS + .setAccessTokenUri("Not a URI " + "because there is no client"); } @Autowired(required = false) @@ -113,8 +113,8 @@ public class ResourceServerTokenServicesConfiguration { this.details = DEFAULT_RESOURCE_DETAILS; } OAuth2RestTemplate template = getTemplate(); - template.setInterceptors(Arrays - .asList(new AcceptJsonRequestInterceptor())); + template.setInterceptors(Arrays.asList( + new AcceptJsonRequestInterceptor())); AuthorizationCodeAccessTokenProvider accessTokenProvider = new AuthorizationCodeAccessTokenProvider(); accessTokenProvider.setTokenRequestEnhancer(new AcceptJsonRequestEnhancer()); template.setAccessTokenProvider(accessTokenProvider); @@ -298,8 +298,9 @@ public class ResourceServerTokenServicesConfiguration { Boolean preferTokenInfo = resolver.getProperty("prefer-token-info", Boolean.class); if (preferTokenInfo == null) { - preferTokenInfo = environment.resolvePlaceholders( - "${OAUTH2_RESOURCE_PREFERTOKENINFO:true}").equals("true"); + preferTokenInfo = environment + .resolvePlaceholders("${OAUTH2_RESOURCE_PREFERTOKENINFO:true}") + .equals("true"); } String tokenInfoUri = resolver.getProperty("token-info-uri"); String userInfoUri = resolver.getProperty("user-info-uri"); @@ -307,8 +308,8 @@ public class ResourceServerTokenServicesConfiguration { return ConditionOutcome.match("No user info provided"); } if (StringUtils.hasLength(tokenInfoUri) && preferTokenInfo) { - return ConditionOutcome.match("Token info endpoint " - + "is preferred and user info provided"); + return ConditionOutcome.match( + "Token info endpoint " + "is preferred and user info provided"); } return ConditionOutcome.noMatch("Token info endpoint is not provided"); } @@ -339,8 +340,8 @@ public class ResourceServerTokenServicesConfiguration { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - return ConditionOutcome.inverse(this.tokenInfoCondition.getMatchOutcome( - context, metadata)); + return ConditionOutcome + .inverse(this.tokenInfoCondition.getMatchOutcome(context, metadata)); } } @@ -352,14 +353,14 @@ public class ResourceServerTokenServicesConfiguration { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - return ConditionOutcome.inverse(this.jwtTokenCondition.getMatchOutcome( - context, metadata)); + return ConditionOutcome + .inverse(this.jwtTokenCondition.getMatchOutcome(context, metadata)); } } - private static class AcceptJsonRequestInterceptor implements - ClientHttpRequestInterceptor { + private static class AcceptJsonRequestInterceptor + implements ClientHttpRequestInterceptor { @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/SpringSocialTokenServices.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/SpringSocialTokenServices.java index 87b3ff2a28..769c2ecfaa 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/SpringSocialTokenServices.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/SpringSocialTokenServices.java @@ -69,8 +69,8 @@ public class SpringSocialTokenServices implements ResourceServerTokenServices { .commaSeparatedStringToAuthorityList("ROLE_USER"); OAuth2Request request = new OAuth2Request(null, this.clientId, null, true, null, null, null, null, null); - return new OAuth2Authentication(request, new UsernamePasswordAuthenticationToken( - principal, "N/A", authorities)); + return new OAuth2Authentication(request, + new UsernamePasswordAuthenticationToken(principal, "N/A", authorities)); } @Override diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/ImportAutoConfigurationImportSelector.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/ImportAutoConfigurationImportSelector.java index 3e0fd6ca39..3a46aaa04d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/ImportAutoConfigurationImportSelector.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/ImportAutoConfigurationImportSelector.java @@ -30,7 +30,8 @@ import org.springframework.core.type.AnnotationMetadata; * * @author Phillip Webb */ -class ImportAutoConfigurationImportSelector extends EnableAutoConfigurationImportSelector { +class ImportAutoConfigurationImportSelector + extends EnableAutoConfigurationImportSelector { @Override protected Class getAnnotationClass() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/BasicErrorController.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/BasicErrorController.java index aadb01fa87..17df02b203 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/BasicErrorController.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/BasicErrorController.java @@ -100,7 +100,8 @@ public class BasicErrorController extends AbstractErrorController { * @param produces the media type produced (or {@code MediaType.ALL}) * @return if the stacktrace attribute should be included */ - protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces) { + protected boolean isIncludeStackTrace(HttpServletRequest request, + MediaType produces) { IncludeStacktrace include = getErrorProperties().getIncludeStacktrace(); if (include == IncludeStacktrace.ALWAYS) { return true; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java index f8fe51b2c5..4fde3d2d7c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java @@ -122,9 +122,10 @@ public class DispatcherServletAutoConfiguration { return checkServletRegistrations(beanFactory); } - private ConditionOutcome checkServlets(ConfigurableListableBeanFactory beanFactory) { - List servlets = Arrays.asList(beanFactory.getBeanNamesForType( - DispatcherServlet.class, false, false)); + private ConditionOutcome checkServlets( + ConfigurableListableBeanFactory beanFactory) { + List servlets = Arrays.asList(beanFactory + .getBeanNamesForType(DispatcherServlet.class, false, false)); boolean containsDispatcherBean = beanFactory .containsBean(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME); if (servlets.isEmpty()) { @@ -149,8 +150,8 @@ public class DispatcherServletAutoConfiguration { private ConditionOutcome checkServletRegistrations( ConfigurableListableBeanFactory beanFactory) { - List registrations = Arrays.asList(beanFactory.getBeanNamesForType( - ServletRegistrationBean.class, false, false)); + List registrations = Arrays.asList(beanFactory + .getBeanNamesForType(ServletRegistrationBean.class, false, false)); boolean containsDispatcherRegistrationBean = beanFactory .containsBean(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME); if (registrations.isEmpty()) { @@ -161,14 +162,14 @@ public class DispatcherServletAutoConfiguration { } return ConditionOutcome.match("no ServletRegistrationBean found"); } - if (registrations.contains(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME)) { + if (registrations + .contains(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME)) { return ConditionOutcome.noMatch("found ServletRegistrationBean named " + DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME); } if (containsDispatcherRegistrationBean) { - return ConditionOutcome - .noMatch("found non-ServletRegistrationBean named " - + DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME); + return ConditionOutcome.noMatch("found non-ServletRegistrationBean named " + + DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME); } return ConditionOutcome .match("one or more ServletRegistrationBeans is found and none is named " diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java index 42184b4959..48c3cf5013 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java @@ -220,8 +220,8 @@ public class ErrorMvcAutoConfiguration { * {@link EmbeddedServletContainerCustomizer} that configures the container's error * pages. */ - private static class ErrorPageCustomizer implements - EmbeddedServletContainerCustomizer, Ordered { + private static class ErrorPageCustomizer + implements EmbeddedServletContainerCustomizer, Ordered { private final ServerProperties properties; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/JacksonHttpMessageConvertersConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/JacksonHttpMessageConvertersConfiguration.java index 1ce8902699..d302be58d0 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/JacksonHttpMessageConvertersConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/JacksonHttpMessageConvertersConfiguration.java @@ -64,8 +64,8 @@ class JacksonHttpMessageConvertersConfiguration { @ConditionalOnMissingBean public MappingJackson2XmlHttpMessageConverter mappingJackson2XmlHttpMessageConverter( Jackson2ObjectMapperBuilder builder) { - return new MappingJackson2XmlHttpMessageConverter(builder.createXmlMapper( - true).build()); + return new MappingJackson2XmlHttpMessageConverter( + builder.createXmlMapper(true).build()); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/OnEnabledResourceChainCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/OnEnabledResourceChainCondition.java index 3cdd338e73..05a6dd43b4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/OnEnabledResourceChainCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/OnEnabledResourceChainCondition.java @@ -42,8 +42,8 @@ class OnEnabledResourceChainCondition extends SpringBootCondition { RelaxedDataBinder binder = new RelaxedDataBinder(properties, "spring.resources"); binder.bind(new PropertySourcesPropertyValues(environment.getPropertySources())); Boolean match = properties.getChain().getEnabled(); - return new ConditionOutcome(match, "Resource chain is " - + (match ? "enabled" : "disabled")); + return new ConditionOutcome(match, + "Resource chain is " + (match ? "enabled" : "disabled")); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java index deb2114f1f..c16398c3cc 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java @@ -46,6 +46,7 @@ public class ResourceProperties implements ResourceLoaderAware { "classpath:/static/", "classpath:/public/" }; private static final String[] RESOURCE_LOCATIONS; + static { RESOURCE_LOCATIONS = new String[CLASSPATH_RESOURCE_LOCATIONS.length + SERVLET_RESOURCE_LOCATIONS.length]; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 5e185e4d6b..3999b8443a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -73,8 +73,8 @@ import org.springframework.util.StringUtils; * @author Marcos Barbero */ @ConfigurationProperties(prefix = "server", ignoreUnknownFields = true) -public class ServerProperties implements EmbeddedServletContainerCustomizer, - EnvironmentAware, Ordered { +public class ServerProperties + implements EmbeddedServletContainerCustomizer, EnvironmentAware, Ordered { /** * Server HTTP port. @@ -735,7 +735,8 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, @Override public void customize(Context context) { - context.setBackgroundProcessorDelay(Tomcat.this.backgroundProcessorDelay); + context.setBackgroundProcessorDelay( + Tomcat.this.backgroundProcessorDelay); } }); @@ -746,12 +747,11 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, String protocolHeader = getProtocolHeader(); String remoteIpHeader = getRemoteIpHeader(); // For back compatibility the valve is also enabled if protocol-header is set - if (StringUtils.hasText(protocolHeader) - || StringUtils.hasText(remoteIpHeader) + if (StringUtils.hasText(protocolHeader) || StringUtils.hasText(remoteIpHeader) || properties.getOrDeduceUseForwardHeaders()) { RemoteIpValve valve = new RemoteIpValve(); - valve.setProtocolHeader(StringUtils.hasLength(protocolHeader) ? protocolHeader - : "X-Forwarded-Proto"); + valve.setProtocolHeader(StringUtils.hasLength(protocolHeader) + ? protocolHeader : "X-Forwarded-Proto"); if (StringUtils.hasLength(remoteIpHeader)) { valve.setRemoteIpHeader(remoteIpHeader); } @@ -1085,8 +1085,8 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, * {@link ServletContextInitializer} to apply appropriate parts of the {@link Session} * configuration. */ - private static class SessionConfiguringInitializer implements - ServletContextInitializer { + private static class SessionConfiguringInitializer + implements ServletContextInitializer { private final Session session; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java index 12b590277d..9ad77035ba 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java @@ -81,11 +81,9 @@ public class ServerPropertiesAutoConfiguration { // a single bean String[] serverPropertiesBeans = this.applicationContext .getBeanNamesForType(ServerProperties.class); - Assert.state( - serverPropertiesBeans.length == 1, - "Multiple ServerProperties beans registered " - + StringUtils - .arrayToCommaDelimitedString(serverPropertiesBeans)); + Assert.state(serverPropertiesBeans.length == 1, + "Multiple ServerProperties beans registered " + StringUtils + .arrayToCommaDelimitedString(serverPropertiesBeans)); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java index 5fa2ae4e4c..5d438bf427 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java @@ -180,8 +180,8 @@ public class WebMvcAutoConfiguration { @ConditionalOnMissingBean(name = "viewResolver", value = ContentNegotiatingViewResolver.class) public ContentNegotiatingViewResolver viewResolver(BeanFactory beanFactory) { ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver(); - resolver.setContentNegotiationManager(beanFactory - .getBean(ContentNegotiationManager.class)); + resolver.setContentNegotiationManager( + beanFactory.getBean(ContentNegotiationManager.class)); // ContentNegotiatingViewResolver uses all the other view resolvers to locate // a view so it should have a high precedence resolver.setOrder(Ordered.HIGHEST_PRECEDENCE); @@ -205,8 +205,8 @@ public class WebMvcAutoConfiguration { public MessageCodesResolver getMessageCodesResolver() { if (this.mvcProperties.getMessageCodesResolverFormat() != null) { DefaultMessageCodesResolver resolver = new DefaultMessageCodesResolver(); - resolver.setMessageCodeFormatter(this.mvcProperties - .getMessageCodesResolverFormat()); + resolver.setMessageCodeFormatter( + this.mvcProperties.getMessageCodesResolverFormat()); return resolver; } return null; @@ -242,8 +242,7 @@ public class WebMvcAutoConfiguration { .setCachePeriod(cachePeriod)); } if (!registry.hasMappingForPattern("/**")) { - registerResourceChain(registry - .addResourceHandler("/**") + registerResourceChain(registry.addResourceHandler("/**") .addResourceLocations( this.resourceProperties.getStaticLocations()) .setCachePeriod(cachePeriod)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfiguration.java index 0cbf8feef6..20b0acd594 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfiguration.java @@ -53,8 +53,8 @@ public class WebSocketMessagingAutoConfiguration { @ConditionalOnBean({ DelegatingWebSocketMessageBrokerConfiguration.class, ObjectMapper.class }) @ConditionalOnClass({ ObjectMapper.class, AbstractMessageBrokerConfiguration.class }) - static class WebSocketMessageConverterConfiguration extends - AbstractWebSocketMessageBrokerConfigurer { + static class WebSocketMessageConverterConfiguration + extends AbstractWebSocketMessageBrokerConfigurer { @Autowired private ObjectMapper objectMapper; @@ -65,7 +65,8 @@ public class WebSocketMessagingAutoConfiguration { } @Override - public boolean configureMessageConverters(List messageConverters) { + public boolean configureMessageConverters( + List messageConverters) { MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter(); converter.setObjectMapper(this.objectMapper); DefaultContentTypeResolver resolver = new DefaultContentTypeResolver(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelectorTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelectorTests.java index 8f92f45fd2..ce348b1ade 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelectorTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelectorTests.java @@ -76,10 +76,10 @@ public class EnableAutoConfigurationImportSelectorTests { public void importsAreSelected() { configureExclusions(new String[0], new String[0], new String[0]); String[] imports = this.importSelector.selectImports(this.annotationMetadata); - assertThat( - imports.length, - is(equalTo(SpringFactoriesLoader.loadFactoryNames( - EnableAutoConfiguration.class, getClass().getClassLoader()) + assertThat(imports.length, + is(equalTo(SpringFactoriesLoader + .loadFactoryNames(EnableAutoConfiguration.class, + getClass().getClassLoader()) .size()))); assertThat(ConditionEvaluationReport.get(this.beanFactory).getExclusions(), hasSize(0)); @@ -99,7 +99,8 @@ public class EnableAutoConfigurationImportSelectorTests { @Test public void classNamesExclusionsAreApplied() { configureExclusions(new String[0], - new String[] { VelocityAutoConfiguration.class.getName() }, new String[0]); + new String[] { VelocityAutoConfiguration.class.getName() }, + new String[0]); String[] imports = this.importSelector.selectImports(this.annotationMetadata); assertThat(imports.length, is(equalTo(getAutoConfigurationClassNames().size() - 1))); @@ -120,15 +121,14 @@ public class EnableAutoConfigurationImportSelectorTests { @Test public void severalPropertyExclusionsAreApplied() { - configureExclusions(new String[0], new String[0], new String[] { - FreeMarkerAutoConfiguration.class.getName(), - VelocityAutoConfiguration.class.getName() }); + configureExclusions(new String[0], new String[0], + new String[] { FreeMarkerAutoConfiguration.class.getName(), + VelocityAutoConfiguration.class.getName() }); String[] imports = this.importSelector.selectImports(this.annotationMetadata); assertThat(imports.length, is(equalTo(getAutoConfigurationClassNames().size() - 2))); - assertThat( - ConditionEvaluationReport.get(this.beanFactory).getExclusions(), + assertThat(ConditionEvaluationReport.get(this.beanFactory).getExclusions(), containsInAnyOrder(FreeMarkerAutoConfiguration.class.getName(), VelocityAutoConfiguration.class.getName())); } @@ -141,8 +141,7 @@ public class EnableAutoConfigurationImportSelectorTests { String[] imports = this.importSelector.selectImports(this.annotationMetadata); assertThat(imports.length, is(equalTo(getAutoConfigurationClassNames().size() - 3))); - assertThat( - ConditionEvaluationReport.get(this.beanFactory).getExclusions(), + assertThat(ConditionEvaluationReport.get(this.beanFactory).getExclusions(), containsInAnyOrder(FreeMarkerAutoConfiguration.class.getName(), VelocityAutoConfiguration.class.getName(), ThymeleafAutoConfiguration.class.getName())); @@ -150,14 +149,13 @@ public class EnableAutoConfigurationImportSelectorTests { private void configureExclusions(String[] classExclusion, String[] nameExclusion, String[] propertyExclusion) { - given( - this.annotationMetadata.getAnnotationAttributes( - EnableAutoConfiguration.class.getName(), true)).willReturn( - this.annotationAttributes); - given(this.annotationAttributes.getStringArray("exclude")).willReturn( - classExclusion); - given(this.annotationAttributes.getStringArray("excludeName")).willReturn( - nameExclusion); + given(this.annotationMetadata + .getAnnotationAttributes(EnableAutoConfiguration.class.getName(), true)) + .willReturn(this.annotationAttributes); + given(this.annotationAttributes.getStringArray("exclude")) + .willReturn(classExclusion); + given(this.annotationAttributes.getStringArray("excludeName")) + .willReturn(nameExclusion); if (propertyExclusion.length > 0) { String value = StringUtils.arrayToCommaDelimitedString(propertyExclusion); this.environment.setProperty("spring.autoconfigure.exclude", value); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java index 27e842b1ea..0abce810f4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java @@ -77,8 +77,8 @@ public class SpringApplicationAdminJmxAutoConfigurationTests { } @Test - public void notRegisteredByDefault() throws MalformedObjectNameException, - InstanceNotFoundException { + public void notRegisteredByDefault() + throws MalformedObjectNameException, InstanceNotFoundException { load(); this.thrown.expect(InstanceNotFoundException.class); this.mBeanServer.getObjectInstance(createDefaultObjectName()); @@ -114,12 +114,13 @@ public class SpringApplicationAdminJmxAutoConfigurationTests { @Test public void registerWithSimpleWebApp() throws Exception { - this.context = new SpringApplicationBuilder().sources( - EmbeddedServletContainerAutoConfiguration.class, - ServerPropertiesAutoConfiguration.class, - DispatcherServletAutoConfiguration.class, JmxAutoConfiguration.class, - SpringApplicationAdminJmxAutoConfiguration.class).run( - "--" + ENABLE_ADMIN_PROP, "--server.port=0"); + this.context = new SpringApplicationBuilder() + .sources(EmbeddedServletContainerAutoConfiguration.class, + ServerPropertiesAutoConfiguration.class, + DispatcherServletAutoConfiguration.class, + JmxAutoConfiguration.class, + SpringApplicationAdminJmxAutoConfiguration.class) + .run("--" + ENABLE_ADMIN_PROP, "--server.port=0"); assertTrue(this.context instanceof EmbeddedWebApplicationContext); assertEquals(true, this.mBeanServer.getAttribute(createDefaultObjectName(), "EmbeddedWebApplication")); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java index b5845a1866..fecce8c122 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java @@ -112,7 +112,8 @@ public class CacheAutoConfigurationTests { @Test public void cacheManagerBackOff() { load(CustomCacheManagerConfiguration.class); - ConcurrentMapCacheManager cacheManager = validateCacheManager(ConcurrentMapCacheManager.class); + ConcurrentMapCacheManager cacheManager = validateCacheManager( + ConcurrentMapCacheManager.class); assertThat(cacheManager.getCacheNames(), contains("custom1")); assertThat(cacheManager.getCacheNames(), hasSize(1)); } @@ -120,7 +121,8 @@ public class CacheAutoConfigurationTests { @Test public void cacheManagerFromSupportBackOff() { load(CustomCacheManagerFromSupportConfiguration.class); - ConcurrentMapCacheManager cacheManager = validateCacheManager(ConcurrentMapCacheManager.class); + ConcurrentMapCacheManager cacheManager = validateCacheManager( + ConcurrentMapCacheManager.class); assertThat(cacheManager.getCacheNames(), contains("custom1")); assertThat(cacheManager.getCacheNames(), hasSize(1)); } @@ -143,7 +145,8 @@ public class CacheAutoConfigurationTests { @Test public void simpleCacheExplicit() { load(DefaultCacheConfiguration.class, "spring.cache.type=simple"); - ConcurrentMapCacheManager cacheManager = validateCacheManager(ConcurrentMapCacheManager.class); + ConcurrentMapCacheManager cacheManager = validateCacheManager( + ConcurrentMapCacheManager.class); assertThat(cacheManager.getCacheNames(), empty()); } @@ -151,7 +154,8 @@ public class CacheAutoConfigurationTests { public void simpleCacheExplicitWithCacheNames() { load(DefaultCacheConfiguration.class, "spring.cache.type=simple", "spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar"); - ConcurrentMapCacheManager cacheManager = validateCacheManager(ConcurrentMapCacheManager.class); + ConcurrentMapCacheManager cacheManager = validateCacheManager( + ConcurrentMapCacheManager.class); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foo", "bar")); assertThat(cacheManager.getCacheNames(), hasSize(2)); } @@ -302,7 +306,8 @@ public class CacheAutoConfigurationTests { @Test public void ehCacheCacheWithCaches() { load(DefaultCacheConfiguration.class, "spring.cache.type=ehcache"); - EhCacheCacheManager cacheManager = validateCacheManager(EhCacheCacheManager.class); + EhCacheCacheManager cacheManager = validateCacheManager( + EhCacheCacheManager.class); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("cacheTest1", "cacheTest2")); assertThat(cacheManager.getCacheNames(), hasSize(2)); @@ -314,7 +319,8 @@ public class CacheAutoConfigurationTests { public void ehCacheCacheWithConfig() { load(DefaultCacheConfiguration.class, "spring.cache.type=ehcache", "spring.cache.ehcache.config=cache/ehcache-override.xml"); - EhCacheCacheManager cacheManager = validateCacheManager(EhCacheCacheManager.class); + EhCacheCacheManager cacheManager = validateCacheManager( + EhCacheCacheManager.class); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("cacheOverrideTest1", "cacheOverrideTest2")); assertThat(cacheManager.getCacheNames(), hasSize(2)); @@ -323,7 +329,8 @@ public class CacheAutoConfigurationTests { @Test public void ehCacheCacheWithExistingCacheManager() { load(EhCacheCustomCacheManager.class, "spring.cache.type=ehcache"); - EhCacheCacheManager cacheManager = validateCacheManager(EhCacheCacheManager.class); + EhCacheCacheManager cacheManager = validateCacheManager( + EhCacheCacheManager.class); assertThat(cacheManager.getCacheManager(), equalTo(this.context.getBean("customEhCacheCacheManager"))); } @@ -331,7 +338,8 @@ public class CacheAutoConfigurationTests { @Test public void hazelcastCacheExplicit() { load(DefaultCacheConfiguration.class, "spring.cache.type=hazelcast"); - HazelcastCacheManager cacheManager = validateCacheManager(HazelcastCacheManager.class); + HazelcastCacheManager cacheManager = validateCacheManager( + HazelcastCacheManager.class); // NOTE: the hazelcast implementation knows about a cache in a lazy manner. cacheManager.getCache("defaultCache"); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("defaultCache")); @@ -343,10 +351,10 @@ public class CacheAutoConfigurationTests { @Test public void hazelcastCacheWithConfig() { - load(DefaultCacheConfiguration.class, - "spring.cache.type=hazelcast", + load(DefaultCacheConfiguration.class, "spring.cache.type=hazelcast", "spring.cache.hazelcast.config=org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml"); - HazelcastCacheManager cacheManager = validateCacheManager(HazelcastCacheManager.class); + HazelcastCacheManager cacheManager = validateCacheManager( + HazelcastCacheManager.class); cacheManager.getCache("foobar"); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foobar")); assertThat(cacheManager.getCacheNames(), hasSize(1)); @@ -363,7 +371,8 @@ public class CacheAutoConfigurationTests { @Test public void hazelcastCacheWithExistingHazelcastInstance() { load(HazelcastCustomHazelcastInstance.class, "spring.cache.type=hazelcast"); - HazelcastCacheManager cacheManager = validateCacheManager(HazelcastCacheManager.class); + HazelcastCacheManager cacheManager = validateCacheManager( + HazelcastCacheManager.class); assertThat( new DirectFieldAccessor(cacheManager) .getPropertyValue("hazelcastInstance"), @@ -376,15 +385,14 @@ public class CacheAutoConfigurationTests { configs.add(DefaultCacheConfiguration.class); configs.add(HazelcastAutoConfiguration.class); String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"; - doLoad(configs, "spring.cache.type=hazelcast", "spring.hazelcast.config=" - + mainConfig); - HazelcastCacheManager cacheManager = validateCacheManager(HazelcastCacheManager.class); + doLoad(configs, "spring.cache.type=hazelcast", + "spring.hazelcast.config=" + mainConfig); + HazelcastCacheManager cacheManager = validateCacheManager( + HazelcastCacheManager.class); HazelcastInstance hazelcastInstance = this.context .getBean(HazelcastInstance.class); - assertThat( - new DirectFieldAccessor(cacheManager) - .getPropertyValue("hazelcastInstance"), - equalTo((Object) hazelcastInstance)); + assertThat(new DirectFieldAccessor(cacheManager).getPropertyValue( + "hazelcastInstance"), equalTo((Object) hazelcastInstance)); assertThat(hazelcastInstance.getConfig().getConfigurationFile(), equalTo(new ClassPathResource(mainConfig).getFile())); } @@ -397,11 +405,13 @@ public class CacheAutoConfigurationTests { configs.add(HazelcastAutoConfiguration.class); String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"; String cacheConfig = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml"; - doLoad(configs, "spring.cache.type=hazelcast", "spring.cache.hazelcast.config=" - + cacheConfig, "spring.hazelcast.config=" + mainConfig); + doLoad(configs, "spring.cache.type=hazelcast", + "spring.cache.hazelcast.config=" + cacheConfig, + "spring.hazelcast.config=" + mainConfig); HazelcastInstance hazelcastInstance = this.context .getBean(HazelcastInstance.class); - HazelcastCacheManager cacheManager = validateCacheManager(HazelcastCacheManager.class); + HazelcastCacheManager cacheManager = validateCacheManager( + HazelcastCacheManager.class); HazelcastInstance cacheHazelcastInstance = (HazelcastInstance) new DirectFieldAccessor( cacheManager).getPropertyValue("hazelcastInstance"); assertThat(cacheHazelcastInstance, not(hazelcastInstance)); // Our custom @@ -440,7 +450,8 @@ public class CacheAutoConfigurationTests { public void infinispanCacheWithConfig() { load(DefaultCacheConfiguration.class, "spring.cache.type=infinispan", "spring.cache.infinispan.config=infinispan.xml"); - SpringEmbeddedCacheManager cacheManager = validateCacheManager(SpringEmbeddedCacheManager.class); + SpringEmbeddedCacheManager cacheManager = validateCacheManager( + SpringEmbeddedCacheManager.class); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foo", "bar")); } @@ -448,7 +459,8 @@ public class CacheAutoConfigurationTests { public void infinispanCacheWithCaches() { load(DefaultCacheConfiguration.class, "spring.cache.type=infinispan", "spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar"); - SpringEmbeddedCacheManager cacheManager = validateCacheManager(SpringEmbeddedCacheManager.class); + SpringEmbeddedCacheManager cacheManager = validateCacheManager( + SpringEmbeddedCacheManager.class); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foo", "bar")); assertThat(cacheManager.getCacheNames(), hasSize(2)); } @@ -457,7 +469,8 @@ public class CacheAutoConfigurationTests { public void infinispanCacheWithCachesAndCustomConfig() { load(InfinispanCustomConfiguration.class, "spring.cache.type=infinispan", "spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar"); - SpringEmbeddedCacheManager cacheManager = validateCacheManager(SpringEmbeddedCacheManager.class); + SpringEmbeddedCacheManager cacheManager = validateCacheManager( + SpringEmbeddedCacheManager.class); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foo", "bar")); assertThat(cacheManager.getCacheNames(), hasSize(2)); @@ -617,8 +630,8 @@ public class CacheAutoConfigurationTests { @Bean public javax.cache.CacheManager customJCacheCacheManager() { javax.cache.CacheManager cacheManager = mock(javax.cache.CacheManager.class); - given(cacheManager.getCacheNames()).willReturn( - Collections.emptyList()); + given(cacheManager.getCacheNames()) + .willReturn(Collections.emptyList()); return cacheManager; } @@ -634,8 +647,8 @@ public class CacheAutoConfigurationTests { @Override public void customize(javax.cache.CacheManager cacheManager) { MutableConfiguration config = new MutableConfiguration(); - config.setExpiryPolicyFactory(CreatedExpiryPolicy - .factoryOf(Duration.TEN_MINUTES)); + config.setExpiryPolicyFactory( + CreatedExpiryPolicy.factoryOf(Duration.TEN_MINUTES)); config.setStatisticsEnabled(true); cacheManager.createCache("custom1", config); cacheManager.destroyCache("bar"); @@ -651,7 +664,8 @@ public class CacheAutoConfigurationTests { @Bean public net.sf.ehcache.CacheManager customEhCacheCacheManager() { - net.sf.ehcache.CacheManager cacheManager = mock(net.sf.ehcache.CacheManager.class); + net.sf.ehcache.CacheManager cacheManager = mock( + net.sf.ehcache.CacheManager.class); given(cacheManager.getStatus()).willReturn(Status.STATUS_ALIVE); given(cacheManager.getCacheNames()).willReturn(new String[0]); return cacheManager; @@ -696,8 +710,8 @@ public class CacheAutoConfigurationTests { @Configuration @Import({ GenericCacheConfiguration.class, RedisCacheConfiguration.class }) - static class CustomCacheManagerFromSupportConfiguration extends - CachingConfigurerSupport { + static class CustomCacheManagerFromSupportConfiguration + extends CachingConfigurerSupport { @Override @Bean diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/support/MockCachingProvider.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/support/MockCachingProvider.java index dfc8a5ae03..6e3a8c594c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/support/MockCachingProvider.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/support/MockCachingProvider.java @@ -59,8 +59,8 @@ public class MockCachingProvider implements CachingProvider { return caches.get(cacheName); } }); - given(cacheManager.createCache(anyString(), any(Configuration.class))).will( - new Answer() { + given(cacheManager.createCache(anyString(), any(Configuration.class))) + .will(new Answer() { @Override public Cache answer(InvocationOnMock invocationOnMock) throws Throwable { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidateTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidateTests.java index a215ade28d..eca033f03b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidateTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidateTests.java @@ -88,8 +88,8 @@ public class ConditionalOnSingleCandidateTests { public void invalidAnnotationTwoTypes() { this.thrown.expect(IllegalStateException.class); this.thrown.expectCause(isA(IllegalArgumentException.class)); - this.thrown.expectMessage(OnBeanSingleCandidateTwoTypesConfiguration.class - .getName()); + this.thrown.expectMessage( + OnBeanSingleCandidateTwoTypesConfiguration.class.getName()); load(OnBeanSingleCandidateTwoTypesConfiguration.class); } @@ -97,8 +97,8 @@ public class ConditionalOnSingleCandidateTests { public void invalidAnnotationNoType() { this.thrown.expect(IllegalStateException.class); this.thrown.expectCause(isA(IllegalArgumentException.class)); - this.thrown.expectMessage(OnBeanSingleCandidateNoTypeConfiguration.class - .getName()); + this.thrown + .expectMessage(OnBeanSingleCandidateNoTypeConfiguration.class.getName()); load(OnBeanSingleCandidateNoTypeConfiguration.class); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ResourceConditionTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ResourceConditionTests.java index 45e27c5e35..b929e8a5ea 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ResourceConditionTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ResourceConditionTests.java @@ -98,8 +98,8 @@ public class ResourceConditionTests { } } - private static class UnknownDefaultLocationResourceCondition extends - ResourceCondition { + private static class UnknownDefaultLocationResourceCondition + extends ResourceCondition { UnknownDefaultLocationResourceCondition() { super("test", "spring.foo.test", "config", diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java index efc878e453..495f2db0c8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java @@ -59,7 +59,8 @@ public class CassandraDataAutoConfigurationTests { } @Configuration - @ComponentScan(excludeFilters = @ComponentScan.Filter(classes = { Session.class }, type = FilterType.ASSIGNABLE_TYPE)) + @ComponentScan(excludeFilters = @ComponentScan.Filter(classes = { + Session.class }, type = FilterType.ASSIGNABLE_TYPE) ) static class TestExcludeConfiguration { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java index ed535b4c34..ed4efb12ea 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java @@ -111,7 +111,8 @@ public class CassandraRepositoriesAutoConfigurationTests { } @Configuration - @ComponentScan(excludeFilters = @ComponentScan.Filter(classes = { Session.class }, type = FilterType.ASSIGNABLE_TYPE)) + @ComponentScan(excludeFilters = @ComponentScan.Filter(classes = { + Session.class }, type = FilterType.ASSIGNABLE_TYPE) ) static class TestExcludeConfiguration { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java index 28ddd09fc8..c184dc7ae4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java @@ -70,26 +70,27 @@ public class RedisAutoConfigurationTests { @Test public void testOverrideRedisConfiguration() throws Exception { load("spring.redis.host:foo", "spring.redis.database:1"); - assertEquals("foo", this.context.getBean(JedisConnectionFactory.class) - .getHostName()); + assertEquals("foo", + this.context.getBean(JedisConnectionFactory.class).getHostName()); assertEquals(1, this.context.getBean(JedisConnectionFactory.class).getDatabase()); } @Test public void testRedisConfigurationWithPool() throws Exception { load("spring.redis.host:foo", "spring.redis.pool.max-idle:1"); - assertEquals("foo", this.context.getBean(JedisConnectionFactory.class) - .getHostName()); - assertEquals(1, this.context.getBean(JedisConnectionFactory.class) - .getPoolConfig().getMaxIdle()); + assertEquals("foo", + this.context.getBean(JedisConnectionFactory.class).getHostName()); + assertEquals(1, this.context.getBean(JedisConnectionFactory.class).getPoolConfig() + .getMaxIdle()); } @Test public void testRedisConfigurationWithTimeout() throws Exception { load("spring.redis.host:foo", "spring.redis.timeout:100"); - assertEquals("foo", this.context.getBean(JedisConnectionFactory.class) - .getHostName()); - assertEquals(100, this.context.getBean(JedisConnectionFactory.class).getTimeout()); + assertEquals("foo", + this.context.getBean(JedisConnectionFactory.class).getHostName()); + assertEquals(100, + this.context.getBean(JedisConnectionFactory.class).getTimeout()); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java index f1fa0ec7e1..550089a461 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java @@ -170,8 +170,7 @@ public class FlywayAutoConfigurationTests { @Test public void customFlywayMigrationStrategy() throws Exception { registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class, + FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, MockFlywayMigrationStrategy.class); assertNotNull(this.context.getBean(Flyway.class)); this.context.getBean(MockFlywayMigrationStrategy.class).assertCalled(); @@ -248,7 +247,8 @@ public class FlywayAutoConfigurationTests { } @Component - protected static class MockFlywayMigrationStrategy implements FlywayMigrationStrategy { + protected static class MockFlywayMigrationStrategy + implements FlywayMigrationStrategy { private boolean called = false; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java index 6e6f59cd2f..1898d13226 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java @@ -148,7 +148,8 @@ public class GroovyTemplateAutoConfigurationTests { @Test public void customTemplateLoaderPath() throws Exception { - registerAndRefreshContext("spring.groovy.template.resource-loader-path:classpath:/custom-templates/"); + registerAndRefreshContext( + "spring.groovy.template.resource-loader-path:classpath:/custom-templates/"); MockHttpServletResponse response = render("custom"); String result = response.getContentAsString(); assertThat(result, containsString("custom")); @@ -168,14 +169,16 @@ public class GroovyTemplateAutoConfigurationTests { MarkupTemplateEngine engine = config.getTemplateEngine(); Writer writer = new StringWriter(); engine.createTemplate(new ClassPathResource("templates/message.tpl").getFile()) - .make(new HashMap(Collections.singletonMap("greeting", - "Hello World"))).writeTo(writer); + .make(new HashMap( + Collections.singletonMap("greeting", "Hello World"))) + .writeTo(writer); assertThat(writer.toString(), containsString("Hello World")); } @Test public void customConfiguration() throws Exception { - registerAndRefreshContext("spring.groovy.template.configuration.auto-indent:true"); + registerAndRefreshContext( + "spring.groovy.template.configuration.auto-indent:true"); assertThat(this.context.getBean(GroovyMarkupConfigurer.class).isAutoIndent(), is(true)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfigurationIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfigurationIntegrationTests.java index 46bdd9233d..c0071849b0 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfigurationIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfigurationIntegrationTests.java @@ -74,8 +74,8 @@ public class H2ConsoleAutoConfigurationIntegrationTests { public void someOtherPrincipal() throws Exception { MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context) .apply(springSecurity()).build(); - mockMvc.perform(get("/h2-console/").with(user("test").roles("FOO"))).andExpect( - status().isForbidden()); + mockMvc.perform(get("/h2-console/").with(user("test").roles("FOO"))) + .andExpect(status().isForbidden()); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java index eada0553fa..6d11ef3abf 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java @@ -98,9 +98,8 @@ public class HypermediaAutoConfigurationTests { this.context.refresh(); ObjectMapper objectMapper = this.context.getBean("_halObjectMapper", ObjectMapper.class); - assertThat( - objectMapper.getSerializationConfig().isEnabled( - SerializationFeature.INDENT_OUTPUT), is(false)); + assertThat(objectMapper.getSerializationConfig() + .isEnabled(SerializationFeature.INDENT_OUTPUT), is(false)); } @Test @@ -127,10 +126,8 @@ public class HypermediaAutoConfigurationTests { .getBean(RequestMappingHandlerAdapter.class); for (HttpMessageConverter converter : handlerAdapter.getMessageConverters()) { if (converter instanceof TypeConstrainedMappingJackson2HttpMessageConverter) { - assertThat( - converter.getSupportedMediaTypes(), - containsInAnyOrder(MediaType.APPLICATION_JSON, - MediaTypes.HAL_JSON)); + assertThat(converter.getSupportedMediaTypes(), containsInAnyOrder( + MediaType.APPLICATION_JSON, MediaTypes.HAL_JSON)); } } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java index d85aec2619..491eb378ea 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java @@ -155,10 +155,8 @@ public class JacksonAutoConfigurationTests { @Test public void customDateFormatClass() throws Exception { this.context.register(JacksonAutoConfiguration.class); - EnvironmentTestUtils - .addEnvironment( - this.context, - "spring.jackson.date-format:org.springframework.boot.autoconfigure.jackson.JacksonAutoConfigurationTests.MyDateFormat"); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.jackson.date-format:org.springframework.boot.autoconfigure.jackson.JacksonAutoConfigurationTests.MyDateFormat"); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(mapper.getDateFormat(), is(instanceOf(MyDateFormat.class))); @@ -175,9 +173,8 @@ public class JacksonAutoConfigurationTests { @Test public void customPropertyNamingStrategyField() throws Exception { this.context.register(JacksonAutoConfiguration.class); - EnvironmentTestUtils - .addEnvironment(this.context, - "spring.jackson.property-naming-strategy:CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES"); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.jackson.property-naming-strategy:CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES"); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(mapper.getPropertyNamingStrategy(), @@ -187,10 +184,8 @@ public class JacksonAutoConfigurationTests { @Test public void customPropertyNamingStrategyClass() throws Exception { this.context.register(JacksonAutoConfiguration.class); - EnvironmentTestUtils - .addEnvironment( - this.context, - "spring.jackson.property-naming-strategy:com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy"); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.jackson.property-naming-strategy:com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy"); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(mapper.getPropertyNamingStrategy(), @@ -205,8 +200,8 @@ public class JacksonAutoConfigurationTests { this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertFalse(SerializationFeature.INDENT_OUTPUT.enabledByDefault()); - assertTrue(mapper.getSerializationConfig().hasSerializationFeatures( - SerializationFeature.INDENT_OUTPUT.getMask())); + assertTrue(mapper.getSerializationConfig() + .hasSerializationFeatures(SerializationFeature.INDENT_OUTPUT.getMask())); } @Test @@ -253,10 +248,10 @@ public class JacksonAutoConfigurationTests { this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertFalse(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS.enabledByDefault()); - assertTrue(mapper.getSerializationConfig().hasMapperFeatures( - MapperFeature.REQUIRE_SETTERS_FOR_GETTERS.getMask())); - assertTrue(mapper.getDeserializationConfig().hasMapperFeatures( - MapperFeature.REQUIRE_SETTERS_FOR_GETTERS.getMask())); + assertTrue(mapper.getSerializationConfig() + .hasMapperFeatures(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS.getMask())); + assertTrue(mapper.getDeserializationConfig() + .hasMapperFeatures(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS.getMask())); } @Test @@ -267,10 +262,10 @@ public class JacksonAutoConfigurationTests { this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertTrue(MapperFeature.USE_ANNOTATIONS.enabledByDefault()); - assertFalse(mapper.getDeserializationConfig().hasMapperFeatures( - MapperFeature.USE_ANNOTATIONS.getMask())); - assertFalse(mapper.getSerializationConfig().hasMapperFeatures( - MapperFeature.USE_ANNOTATIONS.getMask())); + assertFalse(mapper.getDeserializationConfig() + .hasMapperFeatures(MapperFeature.USE_ANNOTATIONS.getMask())); + assertFalse(mapper.getSerializationConfig() + .hasMapperFeatures(MapperFeature.USE_ANNOTATIONS.getMask())); } @Test @@ -303,8 +298,8 @@ public class JacksonAutoConfigurationTests { this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertFalse(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS.enabledByDefault()); - assertTrue(mapper.getFactory().isEnabled( - JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS)); + assertTrue(mapper.getFactory() + .isEnabled(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS)); } @Test @@ -315,8 +310,8 @@ public class JacksonAutoConfigurationTests { this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertTrue(JsonGenerator.Feature.AUTO_CLOSE_TARGET.enabledByDefault()); - assertFalse(mapper.getFactory() - .isEnabled(JsonGenerator.Feature.AUTO_CLOSE_TARGET)); + assertFalse( + mapper.getFactory().isEnabled(JsonGenerator.Feature.AUTO_CLOSE_TARGET)); } @Test @@ -327,24 +322,24 @@ public class JacksonAutoConfigurationTests { .getBean(Jackson2ObjectMapperBuilder.class); ObjectMapper mapper = builder.build(); assertTrue(MapperFeature.DEFAULT_VIEW_INCLUSION.enabledByDefault()); - assertFalse(mapper.getDeserializationConfig().isEnabled( - MapperFeature.DEFAULT_VIEW_INCLUSION)); + assertFalse(mapper.getDeserializationConfig() + .isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)); assertTrue(MapperFeature.DEFAULT_VIEW_INCLUSION.enabledByDefault()); - assertFalse(mapper.getDeserializationConfig().isEnabled( - MapperFeature.DEFAULT_VIEW_INCLUSION)); - assertFalse(mapper.getSerializationConfig().isEnabled( - MapperFeature.DEFAULT_VIEW_INCLUSION)); + assertFalse(mapper.getDeserializationConfig() + .isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)); + assertFalse(mapper.getSerializationConfig() + .isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)); assertTrue(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES.enabledByDefault()); - assertFalse(mapper.getDeserializationConfig().isEnabled( - DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)); + assertFalse(mapper.getDeserializationConfig() + .isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)); } @Test public void moduleBeansAndWellKnownModulesAreRegisteredWithTheObjectMapperBuilder() { this.context.register(ModuleConfig.class, JacksonAutoConfiguration.class); this.context.refresh(); - ObjectMapper objectMapper = this.context.getBean( - Jackson2ObjectMapperBuilder.class).build(); + ObjectMapper objectMapper = this.context + .getBean(Jackson2ObjectMapperBuilder.class).build(); assertThat(this.context.getBean(CustomModule.class).getOwners(), hasItem((ObjectCodec) objectMapper)); assertThat(objectMapper.canSerialize(LocalDateTime.class), is(true)); @@ -354,8 +349,8 @@ public class JacksonAutoConfigurationTests { public void defaultSerializationInclusion() { this.context.register(JacksonAutoConfiguration.class); this.context.refresh(); - ObjectMapper objectMapper = this.context.getBean( - Jackson2ObjectMapperBuilder.class).build(); + ObjectMapper objectMapper = this.context + .getBean(Jackson2ObjectMapperBuilder.class).build(); assertThat(objectMapper.getSerializationConfig().getSerializationInclusion(), is(JsonInclude.Include.ALWAYS)); } @@ -366,8 +361,8 @@ public class JacksonAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "spring.jackson.serialization-inclusion:non_null"); this.context.refresh(); - ObjectMapper objectMapper = this.context.getBean( - Jackson2ObjectMapperBuilder.class).build(); + ObjectMapper objectMapper = this.context + .getBean(Jackson2ObjectMapperBuilder.class).build(); assertThat(objectMapper.getSerializationConfig().getSerializationInclusion(), is(JsonInclude.Include.NON_NULL)); } @@ -381,8 +376,8 @@ public class JacksonAutoConfigurationTests { "spring.jackson.date-format:zzzz"); EnvironmentTestUtils.addEnvironment(this.context, "spring.jackson.locale:en"); this.context.refresh(); - ObjectMapper objectMapper = this.context.getBean( - Jackson2ObjectMapperBuilder.class).build(); + ObjectMapper objectMapper = this.context + .getBean(Jackson2ObjectMapperBuilder.class).build(); DateTime dateTime = new DateTime(1436966242231L, DateTimeZone.UTC); assertEquals("\"Pacific Daylight Time\"", objectMapper.writeValueAsString(dateTime)); @@ -395,8 +390,8 @@ public class JacksonAutoConfigurationTests { "spring.jackson.time-zone:GMT+10"); EnvironmentTestUtils.addEnvironment(this.context, "spring.jackson.date-format:z"); this.context.refresh(); - ObjectMapper objectMapper = this.context.getBean( - Jackson2ObjectMapperBuilder.class).build(); + ObjectMapper objectMapper = this.context + .getBean(Jackson2ObjectMapperBuilder.class).build(); Date date = new Date(1436966242231L); assertEquals("\"GMT+10:00\"", objectMapper.writeValueAsString(date)); } @@ -408,8 +403,8 @@ public class JacksonAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "spring.jackson.date-format:zzzz"); this.context.refresh(); - ObjectMapper objectMapper = this.context.getBean( - Jackson2ObjectMapperBuilder.class).build(); + ObjectMapper objectMapper = this.context + .getBean(Jackson2ObjectMapperBuilder.class).build(); DateTime dateTime = new DateTime(1436966242231L, DateTimeZone.UTC); assertEquals("\"Koordinierte Universalzeit\"", @@ -475,8 +470,8 @@ public class JacksonAutoConfigurationTests { @Override public void serialize(Foo value, JsonGenerator jgen, - SerializerProvider provider) throws IOException, - JsonProcessingException { + SerializerProvider provider) + throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeStringField("foo", "bar"); jgen.writeEndObject(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java index 0a7b7ca327..a4d2557d01 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -159,8 +159,8 @@ public class DataSourceAutoConfigurationTests { public void explicitType() { EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.driverClassName:org.hsqldb.jdbcDriver", - "spring.datasource.url:jdbc:hsqldb:mem:testdb", "spring.datasource.type:" - + HikariDataSource.class.getName()); + "spring.datasource.url:jdbc:hsqldb:mem:testdb", + "spring.datasource.type:" + HikariDataSource.class.getName()); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java index 673bc61895..7e44aa2f28 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java @@ -78,8 +78,8 @@ public class DataSourceTransactionManagerAutoConfigurationTests { EmbeddedDataSourceConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class); this.context.refresh(); - assertEquals("No transaction manager should be been created", 1, this.context - .getBeansOfType(PlatformTransactionManager.class).size()); + assertEquals("No transaction manager should be been created", 1, + this.context.getBeansOfType(PlatformTransactionManager.class).size()); assertEquals("Wrong transaction manager", this.context.getBean("myTransactionManager"), this.context.getBean(PlatformTransactionManager.class)); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java index 143dadfa9f..e9d1755b0c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java @@ -150,8 +150,8 @@ public class JmsAutoConfigurationTests { "spring.jms.listener.acknowledgeMode=client", "spring.jms.listener.concurrency=2", "spring.jms.listener.maxConcurrency=10"); - JmsListenerContainerFactory jmsListenerContainerFactory = this.context - .getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class); + JmsListenerContainerFactory jmsListenerContainerFactory = this.context.getBean( + "jmsListenerContainerFactory", JmsListenerContainerFactory.class); assertEquals(DefaultJmsListenerContainerFactory.class, jmsListenerContainerFactory.getClass()); DefaultMessageListenerContainer listenerContainer = ((DefaultJmsListenerContainerFactory) jmsListenerContainerFactory) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java index f7c356e19f..47ab2506cb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java @@ -176,7 +176,8 @@ public class ArtemisAutoConfigurationTests { @Test public void embeddedServiceWithCustomJmsConfiguration() { // Ignored with custom config - load(CustomJmsConfiguration.class, "spring.artemis.embedded.queues=Queue1,Queue2"); + load(CustomJmsConfiguration.class, + "spring.artemis.embedded.queues=Queue1,Queue2"); DestinationChecker checker = new DestinationChecker(this.context); checker.checkQueue("custom", true); // See CustomJmsConfiguration checker.checkQueue("Queue1", true); @@ -270,7 +271,8 @@ public class ArtemisAutoConfigurationTests { private TransportConfiguration assertInVmConnectionFactory( ActiveMQConnectionFactory connectionFactory) { - TransportConfiguration transportConfig = getSingleTransportConfiguration(connectionFactory); + TransportConfiguration transportConfig = getSingleTransportConfiguration( + connectionFactory); assertEquals(InVMConnectorFactory.class.getName(), transportConfig.getFactoryClassName()); return transportConfig; @@ -278,7 +280,8 @@ public class ArtemisAutoConfigurationTests { private TransportConfiguration assertNettyConnectionFactory( ActiveMQConnectionFactory connectionFactory, String host, int port) { - TransportConfiguration transportConfig = getSingleTransportConfiguration(connectionFactory); + TransportConfiguration transportConfig = getSingleTransportConfiguration( + connectionFactory); assertEquals(NettyConnectorFactory.class.getName(), transportConfig.getFactoryClassName()); assertEquals(host, transportConfig.getParams().get("host")); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java index 9e70bf72e6..359ee3b4b1 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java @@ -92,21 +92,22 @@ public class JooqAutoConfigurationTests { @Test public void jooqWithoutTx() throws Exception { - registerAndRefresh(JooqDataSourceConfiguration.class, - JooqAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + registerAndRefresh(JooqDataSourceConfiguration.class, JooqAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); assertThat(getBeanNames(PlatformTransactionManager.class), equalTo(NO_BEANS)); assertThat(getBeanNames(SpringTransactionProvider.class), equalTo(NO_BEANS)); DSLContext dsl = this.context.getBean(DSLContext.class); dsl.execute("create table jooqtest (name varchar(255) primary key);"); dsl.transaction(new AssertFetch(dsl, "select count(*) as total from jooqtest;", equalTo("0"))); - dsl.transaction(new ExecuteSql(dsl, "insert into jooqtest (name) values ('foo');")); + dsl.transaction( + new ExecuteSql(dsl, "insert into jooqtest (name) values ('foo');")); dsl.transaction(new AssertFetch(dsl, "select count(*) as total from jooqtest;", equalTo("1"))); try { - dsl.transaction(new ExecuteSql(dsl, - "insert into jooqtest (name) values ('bar');", - "insert into jooqtest (name) values ('foo');")); + dsl.transaction( + new ExecuteSql(dsl, "insert into jooqtest (name) values ('bar');", + "insert into jooqtest (name) values ('foo');")); fail("An DataIntegrityViolationException should have been thrown."); } catch (DataIntegrityViolationException ex) { @@ -125,23 +126,23 @@ public class JooqAutoConfigurationTests { DSLContext dsl = this.context.getBean(DSLContext.class); assertEquals(SQLDialect.H2, dsl.configuration().dialect()); dsl.execute("create table jooqtest_tx (name varchar(255) primary key);"); - dsl.transaction(new AssertFetch(dsl, - "select count(*) as total from jooqtest_tx;", equalTo("0"))); - dsl.transaction(new ExecuteSql(dsl, - "insert into jooqtest_tx (name) values ('foo');")); - dsl.transaction(new AssertFetch(dsl, - "select count(*) as total from jooqtest_tx;", equalTo("1"))); + dsl.transaction(new AssertFetch(dsl, "select count(*) as total from jooqtest_tx;", + equalTo("0"))); + dsl.transaction( + new ExecuteSql(dsl, "insert into jooqtest_tx (name) values ('foo');")); + dsl.transaction(new AssertFetch(dsl, "select count(*) as total from jooqtest_tx;", + equalTo("1"))); try { - dsl.transaction(new ExecuteSql(dsl, - "insert into jooqtest (name) values ('bar');", - "insert into jooqtest (name) values ('foo');")); + dsl.transaction( + new ExecuteSql(dsl, "insert into jooqtest (name) values ('bar');", + "insert into jooqtest (name) values ('foo');")); fail("A DataIntegrityViolationException should have been thrown."); } catch (DataIntegrityViolationException ex) { // Ignore } - dsl.transaction(new AssertFetch(dsl, - "select count(*) as total from jooqtest_tx;", equalTo("1"))); + dsl.transaction(new AssertFetch(dsl, "select count(*) as total from jooqtest_tx;", + equalTo("1"))); } @Test @@ -152,8 +153,8 @@ public class JooqAutoConfigurationTests { TestExecuteListenerProvider.class, TestVisitListenerProvider.class, JooqAutoConfiguration.class); DSLContext dsl = this.context.getBean(DSLContext.class); - assertEquals(TestRecordMapperProvider.class, dsl.configuration() - .recordMapperProvider().getClass()); + assertEquals(TestRecordMapperProvider.class, + dsl.configuration().recordMapperProvider().getClass()); assertThat(dsl.configuration().recordListenerProviders().length, equalTo(1)); assertThat(dsl.configuration().executeListenerProviders().length, equalTo(2)); assertThat(dsl.configuration().visitListenerProviders().length, equalTo(1)); @@ -163,7 +164,8 @@ public class JooqAutoConfigurationTests { public void relaxedBindingOfSqlDialect() { EnvironmentTestUtils.addEnvironment(this.context, "spring.jooq.sql-dialect:PoSTGrES"); - registerAndRefresh(JooqDataSourceConfiguration.class, JooqAutoConfiguration.class); + registerAndRefresh(JooqDataSourceConfiguration.class, + JooqAutoConfiguration.class); assertThat(this.context.getBean(org.jooq.Configuration.class).dialect(), is(equalTo(SQLDialect.POSTGRES))); } @@ -258,7 +260,8 @@ public class JooqAutoConfigurationTests { } - protected static class TestExecuteListenerProvider implements ExecuteListenerProvider { + protected static class TestExecuteListenerProvider + implements ExecuteListenerProvider { @Override public ExecuteListener provide() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java index b0f42f3ff0..6bcdbb07d9 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java @@ -163,8 +163,8 @@ public class AutoConfigurationReportLoggingInitializerTests { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); this.initializer.initialize(context); context.register(Config.class); - ConditionEvaluationReport.get(context.getBeanFactory()).recordExclusions( - Arrays.asList("com.foo.Bar")); + ConditionEvaluationReport.get(context.getBeanFactory()) + .recordExclusions(Arrays.asList("com.foo.Bar")); context.refresh(); this.initializer.onApplicationEvent(new ContextRefreshedEvent(context)); for (String message : this.debugLog) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java index 0d1e8025e9..adb5485b4e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java @@ -151,8 +151,8 @@ public class MailSenderAutoConfigurationTests { load(EmptyConfig.class, "spring.mail.jndi-name:foo"); Session sessionBean = this.context.getBean(Session.class); assertEquals(session, sessionBean); - assertEquals(sessionBean, this.context.getBean(JavaMailSenderImpl.class) - .getSession()); + assertEquals(sessionBean, + this.context.getBean(JavaMailSenderImpl.class).getSession()); } @Test @@ -194,8 +194,8 @@ public class MailSenderAutoConfigurationTests { verify(mailSender, never()).testConnection(); } - private Session configureJndiSession(String name) throws IllegalStateException, - NamingException { + private Session configureJndiSession(String name) + throws IllegalStateException, NamingException { Properties properties = new Properties(); Session session = Session.getDefaultInstance(properties); TestableInitialContextFactory.bind(name, session); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfigurationTests.java index c3db3c0b85..6c0c777c83 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfigurationTests.java @@ -88,15 +88,16 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests { AbstractDeviceDelegatingViewResolver.class); assertNotNull(internalResourceViewResolver); assertNotNull(deviceDelegatingViewResolver); - assertTrue(deviceDelegatingViewResolver.getViewResolver() instanceof InternalResourceViewResolver); + assertTrue(deviceDelegatingViewResolver + .getViewResolver() instanceof InternalResourceViewResolver); try { this.context.getBean(ThymeleafViewResolver.class); } catch (NoSuchBeanDefinitionException ex) { // expected. ThymeleafViewResolver shouldn't be defined. } - assertTrue(deviceDelegatingViewResolver.getOrder() == internalResourceViewResolver - .getOrder() - 1); + assertTrue(deviceDelegatingViewResolver + .getOrder() == internalResourceViewResolver.getOrder() - 1); } @Test(expected = NoSuchBeanDefinitionException.class) @@ -138,11 +139,12 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests { AbstractDeviceDelegatingViewResolver.class); assertNotNull(thymeleafViewResolver); assertNotNull(deviceDelegatingViewResolver); - assertTrue(deviceDelegatingViewResolver.getViewResolver() instanceof ThymeleafViewResolver); + assertTrue(deviceDelegatingViewResolver + .getViewResolver() instanceof ThymeleafViewResolver); assertNotNull(this.context.getBean(InternalResourceViewResolver.class)); assertNotNull(this.context.getBean(ThymeleafViewResolver.class)); - assertTrue(deviceDelegatingViewResolver.getOrder() == thymeleafViewResolver - .getOrder() - 1); + assertTrue(deviceDelegatingViewResolver + .getOrder() == thymeleafViewResolver.getOrder() - 1); } @Test(expected = NoSuchBeanDefinitionException.class) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java index 7285b8c721..f3c4a539e8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java @@ -82,8 +82,8 @@ public class DeviceResolverAutoConfigurationTests { this.context.refresh(); RequestMappingHandlerMapping mapping = this.context .getBean(RequestMappingHandlerMapping.class); - HandlerInterceptor[] interceptors = mapping.getHandler( - new MockHttpServletRequest()).getInterceptors(); + HandlerInterceptor[] interceptors = mapping + .getHandler(new MockHttpServletRequest()).getInterceptors(); assertThat(interceptors, hasItemInArray(instanceOf(DeviceResolverHandlerInterceptor.class))); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java index 04c52e1141..67925f877d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java @@ -90,8 +90,8 @@ public class SitePreferenceAutoConfigurationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(SitePreferenceAutoConfiguration.class); this.context.refresh(); - assertNotNull(this.context - .getBean(SitePreferenceHandlerMethodArgumentResolver.class)); + assertNotNull( + this.context.getBean(SitePreferenceHandlerMethodArgumentResolver.class)); } @Test @@ -101,8 +101,8 @@ public class SitePreferenceAutoConfigurationTests { "spring.mobile.sitepreference.enabled:true"); this.context.register(SitePreferenceAutoConfiguration.class); this.context.refresh(); - assertNotNull(this.context - .getBean(SitePreferenceHandlerMethodArgumentResolver.class)); + assertNotNull( + this.context.getBean(SitePreferenceHandlerMethodArgumentResolver.class)); } @Test(expected = NoSuchBeanDefinitionException.class) @@ -126,8 +126,8 @@ public class SitePreferenceAutoConfigurationTests { this.context.refresh(); RequestMappingHandlerMapping mapping = this.context .getBean(RequestMappingHandlerMapping.class); - HandlerInterceptor[] interceptors = mapping.getHandler( - new MockHttpServletRequest()).getInterceptors(); + HandlerInterceptor[] interceptors = mapping + .getHandler(new MockHttpServletRequest()).getInterceptors(); assertThat(interceptors, hasItemInArray(instanceOf(SitePreferenceHandlerInterceptor.class))); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoPropertiesTests.java index 91cd8166a0..44692bbc37 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoPropertiesTests.java @@ -90,7 +90,8 @@ public class MongoPropertiesTests { properties.setUsername("user"); properties.setPassword("secret".toCharArray()); MongoClient client = properties.createMongoClient(null, null); - assertMongoCredential(client.getCredentialsList().get(0), "user", "secret", "foo"); + assertMongoCredential(client.getCredentialsList().get(0), "user", "secret", + "foo"); } @Test @@ -100,7 +101,8 @@ public class MongoPropertiesTests { properties.setUsername("user"); properties.setPassword("secret".toCharArray()); MongoClient client = properties.createMongoClient(null, null); - assertMongoCredential(client.getCredentialsList().get(0), "user", "secret", "foo"); + assertMongoCredential(client.getCredentialsList().get(0), "user", "secret", + "foo"); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java index e8011aacad..1f7ac04bd2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java @@ -36,6 +36,7 @@ import com.mongodb.CommandResult; import com.mongodb.MongoClient; import de.flapdoodle.embed.mongo.distribution.Feature; + import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.is; @@ -73,8 +74,9 @@ public class EmbeddedMongoAutoConfigurationTests { public void customFeatures() { this.context = new AnnotationConfigApplicationContext(); int mongoPort = SocketUtils.findAvailableTcpPort(); - EnvironmentTestUtils.addEnvironment(this.context, "spring.data.mongodb.port=" - + mongoPort, "spring.mongodb.embedded.features=TEXT_SEARCH, SYNC_DELAY"); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.data.mongodb.port=" + mongoPort, + "spring.mongodb.embedded.features=TEXT_SEARCH, SYNC_DELAY"); this.context.register(EmbeddedMongoAutoConfiguration.class); this.context.refresh(); assertThat(this.context.getBean(EmbeddedMongoProperties.class).getFeatures(), @@ -89,10 +91,9 @@ public class EmbeddedMongoAutoConfigurationTests { MongoClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - assertThat( - this.context.getBean(MongoClient.class).getAddress().getPort(), - equalTo(Integer.valueOf(this.context.getEnvironment().getProperty( - "local.mongo.port")))); + assertThat(this.context.getBean(MongoClient.class).getAddress().getPort(), + equalTo(Integer.valueOf( + this.context.getEnvironment().getProperty("local.mongo.port")))); } @Test @@ -120,8 +121,8 @@ public class EmbeddedMongoAutoConfigurationTests { String expectedVersion) { this.context = new AnnotationConfigApplicationContext(); int mongoPort = SocketUtils.findAvailableTcpPort(); - EnvironmentTestUtils.addEnvironment(this.context, "spring.data.mongodb.port=" - + mongoPort); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.data.mongodb.port=" + mongoPort); if (configuredVersion != null) { EnvironmentTestUtils.addEnvironment(this.context, "spring.mongodb.embedded.version=" + configuredVersion); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java index 3d9ae030a2..991f689c78 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java @@ -102,7 +102,8 @@ public abstract class AbstractJpaAutoConfigurationTests { setupTestConfiguration(); this.context.refresh(); assertNotNull(this.context.getBean(DataSource.class)); - assertTrue(this.context.getBean("transactionManager") instanceof JpaTransactionManager); + assertTrue(this.context + .getBean("transactionManager") instanceof JpaTransactionManager); } @Test @@ -157,7 +158,8 @@ public abstract class AbstractJpaAutoConfigurationTests { public void usesManuallyDefinedLocalContainerEntityManagerFactoryBeanIfAvailable() { EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.initialize:false"); - setupTestConfiguration(TestConfigurationWithLocalContainerEntityManagerFactoryBean.class); + setupTestConfiguration( + TestConfigurationWithLocalContainerEntityManagerFactoryBean.class); this.context.refresh(); LocalContainerEntityManagerFactoryBean factoryBean = this.context .getBean(LocalContainerEntityManagerFactoryBean.class); @@ -251,8 +253,8 @@ public abstract class AbstractJpaAutoConfigurationTests { } @Configuration - protected static class TestConfigurationWithEntityManagerFactory extends - TestConfiguration { + protected static class TestConfigurationWithEntityManagerFactory + extends TestConfiguration { @Bean public EntityManagerFactory entityManagerFactory(DataSource dataSource, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java index 85b03ce711..0c08965f20 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java @@ -50,7 +50,8 @@ import static org.junit.Assert.assertThat; * @author Phillip Webb * @author Andy Wilkinson */ -public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigurationTests { +public class HibernateJpaAutoConfigurationTests + extends AbstractJpaAutoConfigurationTests { @Override protected Class getAutoConfigureClass() { @@ -66,8 +67,8 @@ public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigura setupTestConfiguration(); this.context.refresh(); assertEquals(new Integer(1), - new JdbcTemplate(this.context.getBean(DataSource.class)).queryForObject( - "SELECT COUNT(*) from CITY", Integer.class)); + new JdbcTemplate(this.context.getBean(DataSource.class)) + .queryForObject("SELECT COUNT(*) from CITY", Integer.class)); } // This can't succeed because the data SQL is executed immediately after the schema @@ -79,8 +80,8 @@ public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigura setupTestConfiguration(); this.context.refresh(); assertEquals(new Integer(1), - new JdbcTemplate(this.context.getBean(DataSource.class)).queryForObject( - "SELECT COUNT(*) from CITY", Integer.class)); + new JdbcTemplate(this.context.getBean(DataSource.class)) + .queryForObject("SELECT COUNT(*) from CITY", Integer.class)); } @Test @@ -92,8 +93,8 @@ public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigura this.context.refresh(); LocalContainerEntityManagerFactoryBean bean = this.context .getBean(LocalContainerEntityManagerFactoryBean.class); - String actual = (String) bean.getJpaPropertyMap().get( - "hibernate.ejb.naming_strategy"); + String actual = (String) bean.getJpaPropertyMap() + .get("hibernate.ejb.naming_strategy"); assertThat(actual, equalTo("org.hibernate.cfg.EJB3NamingStrategy")); } @@ -106,8 +107,8 @@ public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigura this.context.refresh(); LocalContainerEntityManagerFactoryBean bean = this.context .getBean(LocalContainerEntityManagerFactoryBean.class); - String actual = (String) bean.getJpaPropertyMap().get( - "hibernate.ejb.naming_strategy"); + String actual = (String) bean.getJpaPropertyMap() + .get("hibernate.ejb.naming_strategy"); // You can't override this one from spring.jpa.properties because it has an // opinionated default assertThat(actual, not(equalTo("org.hibernate.cfg.EJB3NamingStrategy"))); @@ -140,8 +141,9 @@ public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigura this.context.register(JtaProperties.class, JtaAutoConfiguration.class); setupTestConfiguration(); this.context.refresh(); - Map jpaPropertyMap = this.context.getBean( - LocalContainerEntityManagerFactoryBean.class).getJpaPropertyMap(); + Map jpaPropertyMap = this.context + .getBean(LocalContainerEntityManagerFactoryBean.class) + .getJpaPropertyMap(); assertThat(jpaPropertyMap.get("hibernate.transaction.jta.platform"), instanceOf(SpringJtaPlatform.class)); } @@ -154,8 +156,9 @@ public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigura this.context.register(JtaProperties.class, JtaAutoConfiguration.class); setupTestConfiguration(); this.context.refresh(); - Map jpaPropertyMap = this.context.getBean( - LocalContainerEntityManagerFactoryBean.class).getJpaPropertyMap(); + Map jpaPropertyMap = this.context + .getBean(LocalContainerEntityManagerFactoryBean.class) + .getJpaPropertyMap(); assertThat((String) jpaPropertyMap.get("hibernate.transaction.jta.platform"), equalTo(TestJtaPlatform.class.getName())); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java index 26d300c657..77c3903c7d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java @@ -90,8 +90,8 @@ public class SecurityAutoConfigurationTests { this.context.refresh(); assertNotNull(this.context.getBean(AuthenticationManagerBuilder.class)); // 5 for static resources and one for the rest - List filterChains = this.context.getBean( - FilterChainProxy.class).getFilterChains(); + List filterChains = this.context + .getBean(FilterChainProxy.class).getFilterChains(); assertEquals(5, filterChains.size()); } @@ -104,8 +104,7 @@ public class SecurityAutoConfigurationTests { ServerPropertiesAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - assertEquals( - FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100, + assertEquals(FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100, this.context.getBean("securityFilterChainRegistration", FilterRegistrationBean.class).getOrder()); } @@ -135,8 +134,7 @@ public class SecurityAutoConfigurationTests { ServerPropertiesAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - assertEquals( - FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100, + assertEquals(FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100, this.context.getBean("securityFilterChainRegistration", FilterRegistrationBean.class).getOrder()); } @@ -151,10 +149,9 @@ public class SecurityAutoConfigurationTests { ServerPropertiesAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - assertEquals( - 12345, - this.context.getBean("securityFilterChainRegistration", - FilterRegistrationBean.class).getOrder()); + assertEquals(12345, this.context + .getBean("securityFilterChainRegistration", FilterRegistrationBean.class) + .getOrder()); } @Test @@ -167,8 +164,8 @@ public class SecurityAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "security.ignored:none"); this.context.refresh(); // Just the application endpoints now - assertEquals(1, this.context.getBean(FilterChainProxy.class).getFilterChains() - .size()); + assertEquals(1, + this.context.getBean(FilterChainProxy.class).getFilterChains().size()); } @Test @@ -225,7 +222,8 @@ public class SecurityAutoConfigurationTests { PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertEquals( - this.context.getBean(TestAuthenticationConfiguration.class).authenticationManager, + this.context.getBean( + TestAuthenticationConfiguration.class).authenticationManager, this.context.getBean(AuthenticationManager.class)); } @@ -253,7 +251,8 @@ public class SecurityAutoConfigurationTests { PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertEquals( - this.context.getBean(TestAuthenticationConfiguration.class).authenticationManager, + this.context.getBean( + TestAuthenticationConfiguration.class).authenticationManager, this.context.getBean(AuthenticationManager.class)); } @@ -270,8 +269,8 @@ public class SecurityAutoConfigurationTests { UsernamePasswordAuthenticationToken user = new UsernamePasswordAuthenticationToken( "foo", "bar", AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER")); - assertNotNull(this.context.getBean(AuthenticationManager.class) - .authenticate(user)); + assertNotNull( + this.context.getBean(AuthenticationManager.class).authenticate(user)); pingAuthenticationListener(); } @@ -288,8 +287,8 @@ public class SecurityAutoConfigurationTests { UsernamePasswordAuthenticationToken user = new UsernamePasswordAuthenticationToken( "foo", "bar", AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER")); - assertNotNull(this.context.getBean(AuthenticationManager.class) - .authenticate(user)); + assertNotNull( + this.context.getBean(AuthenticationManager.class).authenticate(user)); } @Test @@ -364,8 +363,8 @@ public class SecurityAutoConfigurationTests { assertNotNull(this.context.getBean(SecurityEvaluationContextExtension.class)); } - private static final class AuthenticationListener implements - ApplicationListener { + private static final class AuthenticationListener + implements ApplicationListener { private ApplicationEvent event; @@ -410,8 +409,8 @@ public class SecurityAutoConfigurationTests { } @Configuration - protected static class WorkaroundSecurityCustomizer extends - WebSecurityConfigurerAdapter { + protected static class WorkaroundSecurityCustomizer + extends WebSecurityConfigurerAdapter { @Autowired private AuthenticationManagerBuilder builder; @@ -435,8 +434,8 @@ public class SecurityAutoConfigurationTests { @Configuration @Order(-1) - protected static class AuthenticationManagerCustomizer extends - GlobalAuthenticationConfigurerAdapter { + protected static class AuthenticationManagerCustomizer + extends GlobalAuthenticationConfigurerAdapter { @Override public void init(AuthenticationManagerBuilder auth) throws Exception { @@ -446,8 +445,8 @@ public class SecurityAutoConfigurationTests { } @Configuration - protected static class UserDetailsSecurityCustomizer extends - WebSecurityConfigurerAdapter { + protected static class UserDetailsSecurityCustomizer + extends WebSecurityConfigurerAdapter { private UserDetailsService userDetails; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java index 96184c4371..bd575f19b3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java @@ -82,8 +82,8 @@ public class SpringBootWebSecurityConfigurationTests { @Test public void testDefaultIgnores() { - assertTrue(SpringBootWebSecurityConfiguration - .getIgnored(new SecurityProperties()).contains("/css/**")); + assertTrue(SpringBootWebSecurityConfiguration.getIgnored(new SecurityProperties()) + .contains("/css/**")); } @Test @@ -91,8 +91,8 @@ public class SpringBootWebSecurityConfigurationTests { this.context = SpringApplication.run(TestWebConfiguration.class, "--server.port=0"); assertNotNull(this.context.getBean(AuthenticationManagerBuilder.class)); - assertNotNull(this.context.getBean(AuthenticationManager.class).authenticate( - new UsernamePasswordAuthenticationToken("dave", "secret"))); + assertNotNull(this.context.getBean(AuthenticationManager.class) + .authenticate(new UsernamePasswordAuthenticationToken("dave", "secret"))); } @Test @@ -106,9 +106,8 @@ public class SpringBootWebSecurityConfigurationTests { .build(); mockMvc.perform(MockMvcRequestBuilders.get("/")) .andExpect(MockMvcResultMatchers.status().isUnauthorized()) - .andExpect( - MockMvcResultMatchers.header().string("www-authenticate", - Matchers.containsString("realm=\"Spring\""))); + .andExpect(MockMvcResultMatchers.header().string("www-authenticate", + Matchers.containsString("realm=\"Spring\""))); } @Test @@ -121,8 +120,8 @@ public class SpringBootWebSecurityConfigurationTests { .addFilters( this.context.getBean("springSecurityFilterChain", Filter.class)) .build(); - mockMvc.perform(MockMvcRequestBuilders.get("/")).andExpect( - MockMvcResultMatchers.status().isNotFound()); + mockMvc.perform(MockMvcRequestBuilders.get("/")) + .andExpect(MockMvcResultMatchers.status().isNotFound()); } @Test @@ -137,9 +136,8 @@ public class SpringBootWebSecurityConfigurationTests { .build(); mockMvc.perform(MockMvcRequestBuilders.get("/")) .andExpect(MockMvcResultMatchers.status().isUnauthorized()) - .andExpect( - MockMvcResultMatchers.header().string("www-authenticate", - Matchers.containsString("realm=\"Spring\""))); + .andExpect(MockMvcResultMatchers.header().string("www-authenticate", + Matchers.containsString("realm=\"Spring\""))); } @Test @@ -154,9 +152,8 @@ public class SpringBootWebSecurityConfigurationTests { mockMvc.perform( MockMvcRequestBuilders.get("/").header("authorization", "Basic xxx")) .andExpect(MockMvcResultMatchers.status().isUnauthorized()) - .andExpect( - MockMvcResultMatchers.header().string("www-authenticate", - Matchers.containsString("realm=\"Spring\""))); + .andExpect(MockMvcResultMatchers.header().string("www-authenticate", + Matchers.containsString("realm=\"Spring\""))); } @Test @@ -164,8 +161,8 @@ public class SpringBootWebSecurityConfigurationTests { this.context = SpringApplication.run(TestInjectWebConfiguration.class, "--server.port=0"); assertNotNull(this.context.getBean(AuthenticationManagerBuilder.class)); - assertNotNull(this.context.getBean(AuthenticationManager.class).authenticate( - new UsernamePasswordAuthenticationToken("dave", "secret"))); + assertNotNull(this.context.getBean(AuthenticationManager.class) + .authenticate(new UsernamePasswordAuthenticationToken("dave", "secret"))); } // gh-3447 @@ -173,15 +170,15 @@ public class SpringBootWebSecurityConfigurationTests { public void testHiddenHttpMethodFilterOrderedFirst() throws Exception { this.context = SpringApplication.run(DenyPostRequestConfig.class, "--server.port=0"); - int port = Integer.parseInt(this.context.getEnvironment().getProperty( - "local.server.port")); + int port = Integer + .parseInt(this.context.getEnvironment().getProperty("local.server.port")); TestRestTemplate rest = new TestRestTemplate(); // not overriding causes forbidden MultiValueMap form = new LinkedMultiValueMap(); - ResponseEntity result = rest.postForEntity("http://localhost:" + port - + "/", form, Object.class); + ResponseEntity result = rest + .postForEntity("http://localhost:" + port + "/", form, Object.class); assertEquals(HttpStatus.FORBIDDEN, result.getStatusCode()); // override method with GET @@ -195,8 +192,8 @@ public class SpringBootWebSecurityConfigurationTests { @Configuration @Import(TestWebConfiguration.class) @Order(Ordered.LOWEST_PRECEDENCE) - protected static class TestInjectWebConfiguration extends - WebSecurityConfigurerAdapter { + protected static class TestInjectWebConfiguration + extends WebSecurityConfigurerAdapter { // It's a bad idea to inject an AuthenticationManager into a // WebSecurityConfigurerAdapter because it can cascade early instantiation, @@ -245,8 +242,8 @@ public class SpringBootWebSecurityConfigurationTests { @Import({ EmbeddedServletContainerAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - ErrorMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) protected @interface MinimalWebConfiguration { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java index 06f5ef2b9f..66a32f0e00 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java @@ -124,12 +124,12 @@ public class OAuth2AutoConfigurationTests { ClientDetails config = this.context.getBean(BaseClientDetails.class); AuthorizationEndpoint endpoint = this.context .getBean(AuthorizationEndpoint.class); - UserApprovalHandler handler = (UserApprovalHandler) ReflectionTestUtils.getField( - endpoint, "userApprovalHandler"); + UserApprovalHandler handler = (UserApprovalHandler) ReflectionTestUtils + .getField(endpoint, "userApprovalHandler"); ClientDetailsService clientDetailsService = this.context .getBean(ClientDetailsService.class); - ClientDetails clientDetails = clientDetailsService.loadClientByClientId(config - .getClientId()); + ClientDetails clientDetails = clientDetailsService + .loadClientByClientId(config.getClientId()); assertThat(AopUtils.isJdkDynamicProxy(clientDetailsService), equalTo(true)); assertThat(AopUtils.getTargetClass(clientDetailsService).getName(), is(equalTo(InMemoryClientDetailsService.class.getName()))); @@ -279,8 +279,8 @@ public class OAuth2AutoConfigurationTests { @Test public void testMethodSecurityBackingOff() { this.context = new AnnotationConfigEmbeddedWebApplicationContext(); - this.context.register(CustomMethodSecurity.class, - TestSecurityConfiguration.class, MinimalSecureWebApplication.class); + this.context.register(CustomMethodSecurity.class, TestSecurityConfiguration.class, + MinimalSecureWebApplication.class); this.context.refresh(); DelegatingMethodSecurityMetadataSource source = this.context .getBean(DelegatingMethodSecurityMetadataSource.class); @@ -319,12 +319,12 @@ public class OAuth2AutoConfigurationTests { assertThat(scope, equalTo("\"read\"")); // Now we should be able to see that endpoint. headers.set("Authorization", "BEARER " + authorizationToken); - ResponseEntity securedResponse = rest.exchange(new RequestEntity( - headers, HttpMethod.GET, URI.create(baseUrl + "/securedFind")), - String.class); + ResponseEntity securedResponse = rest + .exchange(new RequestEntity(headers, HttpMethod.GET, + URI.create(baseUrl + "/securedFind")), String.class); assertThat(securedResponse.getStatusCode(), equalTo(HttpStatus.OK)); - assertThat(securedResponse.getBody(), equalTo("You reached an endpoint " - + "secured by Spring Security OAuth2")); + assertThat(securedResponse.getBody(), equalTo( + "You reached an endpoint " + "secured by Spring Security OAuth2")); ResponseEntity entity = rest.exchange(new RequestEntity(headers, HttpMethod.POST, URI.create(baseUrl + "/securedSave")), String.class); assertThat(entity.getStatusCode(), equalTo(finalStatus)); @@ -332,8 +332,8 @@ public class OAuth2AutoConfigurationTests { private HttpHeaders getHeaders(ClientDetails config) { HttpHeaders headers = new HttpHeaders(); - String token = new String(Base64.encode((config.getClientId() + ":" + config - .getClientSecret()).getBytes())); + String token = new String(Base64.encode( + (config.getClientId() + ":" + config.getClientSecret()).getBytes())); headers.set("Authorization", "Basic " + token); return headers; } @@ -349,8 +349,8 @@ public class OAuth2AutoConfigurationTests { private void assertEndpointUnauthorized(String baseUrl, RestTemplate rest) { URI uri = URI.create(baseUrl + "/secured"); - ResponseEntity entity = rest.exchange(new RequestEntity( - HttpMethod.GET, uri), String.class); + ResponseEntity entity = rest + .exchange(new RequestEntity(HttpMethod.GET, uri), String.class); assertThat(entity.getStatusCode(), equalTo(HttpStatus.UNAUTHORIZED)); } @@ -368,7 +368,8 @@ public class OAuth2AutoConfigurationTests { } @Configuration - protected static class TestSecurityConfiguration extends WebSecurityConfigurerAdapter { + protected static class TestSecurityConfiguration + extends WebSecurityConfigurerAdapter { @Override @Bean @@ -397,8 +398,8 @@ public class OAuth2AutoConfigurationTests { @EnableAuthorizationServer @EnableResourceServer @EnableGlobalMethodSecurity(prePostEnabled = true) - protected static class AuthorizationAndResourceServerConfiguration extends - TestSecurityConfiguration { + protected static class AuthorizationAndResourceServerConfiguration + extends TestSecurityConfiguration { } @@ -420,8 +421,8 @@ public class OAuth2AutoConfigurationTests { @Configuration @EnableAuthorizationServer - protected static class AuthorizationServerConfiguration extends - TestSecurityConfiguration { + protected static class AuthorizationServerConfiguration + extends TestSecurityConfiguration { } @@ -483,8 +484,8 @@ public class OAuth2AutoConfigurationTests { @Configuration @EnableAuthorizationServer - protected static class CustomAuthorizationServer extends - AuthorizationServerConfigurerAdapter { + protected static class CustomAuthorizationServer + extends AuthorizationServerConfigurerAdapter { @Autowired private AuthenticationManager authenticationManager; @@ -512,15 +513,16 @@ public class OAuth2AutoConfigurationTests { @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { - endpoints.tokenStore(tokenStore()).authenticationManager( - this.authenticationManager); + endpoints.tokenStore(tokenStore()) + .authenticationManager(this.authenticationManager); } } @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true) - protected static class CustomMethodSecurity extends GlobalMethodSecurityConfiguration { + protected static class CustomMethodSecurity + extends GlobalMethodSecurityConfiguration { @Override protected MethodSecurityExpressionHandler createExpressionHandler() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerPropertiesTests.java index 7a21a4c49b..aa79fff8d3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerPropertiesTests.java @@ -48,8 +48,8 @@ public class ResourceServerPropertiesTests { @Test public void tokenKeyDerived() throws Exception { this.properties.setUserInfoUri("http://example.com/userinfo"); - assertNotNull("Wrong properties: " + this.properties, this.properties.getJwt() - .getKeyUri()); + assertNotNull("Wrong properties: " + this.properties, + this.properties.getJwt().getKeyUri()); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java index 43b5053579..263241f03f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java @@ -73,8 +73,8 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void defaultIsRemoteTokenServices() { - this.context = new SpringApplicationBuilder(ResourceConfiguration.class).web( - false).run(); + this.context = new SpringApplicationBuilder(ResourceConfiguration.class) + .web(false).run(); RemoteTokenServices services = this.context.getBean(RemoteTokenServices.class); assertNotNull(services); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java index 5ee098f1f1..1d83838659 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java @@ -62,13 +62,13 @@ public class UserInfoTokenServicesTests { @Before public void init() { this.resource.setClientId("foo"); - given(this.template.getForEntity(any(String.class), eq(Map.class))).willReturn( - new ResponseEntity(this.map, HttpStatus.OK)); - given(this.template.getAccessToken()).willReturn( - new DefaultOAuth2AccessToken("FOO")); + given(this.template.getForEntity(any(String.class), eq(Map.class))) + .willReturn(new ResponseEntity(this.map, HttpStatus.OK)); + given(this.template.getAccessToken()) + .willReturn(new DefaultOAuth2AccessToken("FOO")); given(this.template.getResource()).willReturn(this.resource); - given(this.template.getOAuth2ClientContext()).willReturn( - mock(OAuth2ClientContext.class)); + given(this.template.getOAuth2ClientContext()) + .willReturn(mock(OAuth2ClientContext.class)); } @Test @@ -80,9 +80,9 @@ public class UserInfoTokenServicesTests { @Test public void badToken() { this.services.setRestTemplate(this.template); - given(this.template.getForEntity(any(String.class), eq(Map.class))).willThrow( - new UserRedirectRequiredException("foo:bar", Collections - .emptyMap())); + given(this.template.getForEntity(any(String.class), eq(Map.class))) + .willThrow(new UserRedirectRequiredException("foo:bar", + Collections.emptyMap())); this.expected.expect(InvalidTokenException.class); assertEquals("unknown", this.services.loadAuthentication("FOO").getName()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/MinimalSecureWebConfiguration.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/MinimalSecureWebConfiguration.java index 625265ab16..b38b0f1afe 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/MinimalSecureWebConfiguration.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/MinimalSecureWebConfiguration.java @@ -38,10 +38,10 @@ import org.springframework.context.annotation.Import; @Retention(RetentionPolicy.RUNTIME) @Documented @Import({ EmbeddedServletContainerAutoConfiguration.class, - ServerPropertiesAutoConfiguration.class, - DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class, SecurityAutoConfiguration.class }) + ServerPropertiesAutoConfiguration.class, DispatcherServletAutoConfiguration.class, + WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, + ErrorMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, + SecurityAutoConfiguration.class }) public @interface MinimalSecureWebConfiguration { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/sendgrid/SendGridAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/sendgrid/SendGridAutoConfigurationTests.java index 28c32092ef..f50e72ad24 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/sendgrid/SendGridAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/sendgrid/SendGridAutoConfigurationTests.java @@ -76,12 +76,13 @@ public class SendGridAutoConfigurationTests { @Test public void expectedSendGridBeanWithProxyCreated() { loadContext("spring.sendgrid.username:user", "spring.sendgrid.password:secret", - "spring.sendgrid.proxy.host:localhost", "spring.sendgrid.proxy.port:5678"); + "spring.sendgrid.proxy.host:localhost", + "spring.sendgrid.proxy.port:5678"); SendGrid sendGrid = this.context.getBean(SendGrid.class); - CloseableHttpClient client = (CloseableHttpClient) ReflectionTestUtils.getField( - sendGrid, "client"); - HttpRoutePlanner routePlanner = (HttpRoutePlanner) ReflectionTestUtils.getField( - client, "routePlanner"); + CloseableHttpClient client = (CloseableHttpClient) ReflectionTestUtils + .getField(sendGrid, "client"); + HttpRoutePlanner routePlanner = (HttpRoutePlanner) ReflectionTestUtils + .getField(client, "routePlanner"); assertThat(routePlanner, instanceOf(DefaultProxyRoutePlanner.class)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/test/ImportAutoConfigurationImportSelectorTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/test/ImportAutoConfigurationImportSelectorTests.java index 80eff536b6..c3625f2b6c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/test/ImportAutoConfigurationImportSelectorTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/test/ImportAutoConfigurationImportSelectorTests.java @@ -79,8 +79,8 @@ public class ImportAutoConfigurationImportSelectorTests { private void configureValue(String... value) { String name = ImportAutoConfiguration.class.getName(); - given(this.annotationMetadata.getAnnotationAttributes(name, true)).willReturn( - this.annotationAttributes); + given(this.annotationMetadata.getAnnotationAttributes(name, true)) + .willReturn(this.annotationAttributes); given(this.annotationAttributes.getStringArray("value")).willReturn(value); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java index 84a0b875f5..e877f5deed 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java @@ -205,8 +205,8 @@ public class ThymeleafAutoConfigurationTests { this.context.register(ThymeleafAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - assertEquals(0, this.context.getBeansOfType(ResourceUrlEncodingFilter.class) - .size()); + assertEquals(0, + this.context.getBeansOfType(ResourceUrlEncodingFilter.class).size()); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfigurationTests.java index 4a7d0d694d..71350a1101 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfigurationTests.java @@ -88,8 +88,8 @@ public class VelocityAutoConfigurationTests { @Test public void nonExistentTemplateLocation() { - registerAndRefreshContext("spring.velocity.resourceLoaderPath:" - + "classpath:/does-not-exist/"); + registerAndRefreshContext( + "spring.velocity.resourceLoaderPath:" + "classpath:/does-not-exist/"); this.output.expect(containsString("Cannot find template location")); } @@ -143,7 +143,8 @@ public class VelocityAutoConfigurationTests { @Test public void customTemplateLoaderPath() throws Exception { - registerAndRefreshContext("spring.velocity.resourceLoaderPath:classpath:/custom-templates/"); + registerAndRefreshContext( + "spring.velocity.resourceLoaderPath:classpath:/custom-templates/"); MockHttpServletResponse response = render("custom"); String result = response.getContentAsString(); assertThat(result, containsString("custom")); @@ -158,9 +159,12 @@ public class VelocityAutoConfigurationTests { @Test public void customVelocitySettings() { - registerAndRefreshContext("spring.velocity.properties.directive.parse.max.depth:10"); - assertThat(this.context.getBean(VelocityConfigurer.class).getVelocityEngine() - .getProperty("directive.parse.max.depth"), equalTo((Object) "10")); + registerAndRefreshContext( + "spring.velocity.properties.directive.parse.max.depth:10"); + assertThat( + this.context.getBean(VelocityConfigurer.class).getVelocityEngine() + .getProperty("directive.parse.max.depth"), + equalTo((Object) "10")); } @Test @@ -205,8 +209,8 @@ public class VelocityAutoConfigurationTests { @Test public void registerResourceHandlingFilterDisabledByDefault() throws Exception { registerAndRefreshContext(); - assertEquals(0, this.context.getBeansOfType(ResourceUrlEncodingFilter.class) - .size()); + assertEquals(0, + this.context.getBeansOfType(ResourceUrlEncodingFilter.class).size()); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerDirectMockMvcTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerDirectMockMvcTests.java index 7cc4717937..c8907e520b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerDirectMockMvcTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerDirectMockMvcTests.java @@ -75,8 +75,8 @@ public class BasicErrorControllerDirectMockMvcTests { @Test public void errorPageAvailableWithParentContext() throws Exception { setup((ConfigurableWebApplicationContext) new SpringApplicationBuilder( - ParentConfiguration.class).child(ChildConfiguration.class).run( - "--server.port=0")); + ParentConfiguration.class).child(ChildConfiguration.class) + .run("--server.port=0")); MvcResult response = this.mockMvc .perform(get("/error").accept(MediaType.TEXT_HTML)) .andExpect(status().isOk()).andReturn(); @@ -99,7 +99,7 @@ public class BasicErrorControllerDirectMockMvcTests { public void errorPageNotAvailableWithWhitelabelDisabled() throws Exception { setup((ConfigurableWebApplicationContext) new SpringApplication( WebMvcIncludedConfiguration.class).run("--server.port=0", - "--server.error.whitelabel.enabled=false")); + "--server.error.whitelabel.enabled=false")); this.thrown.expect(ServletException.class); this.mockMvc.perform(get("/error").accept(MediaType.TEXT_HTML)); @@ -111,8 +111,8 @@ public class BasicErrorControllerDirectMockMvcTests { @Import({ EmbeddedServletContainerAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - ErrorMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) protected @interface MinimalWebConfiguration { } @@ -148,8 +148,8 @@ public class BasicErrorControllerDirectMockMvcTests { protected static class ChildConfiguration { // For manual testing public static void main(String[] args) { - new SpringApplicationBuilder(ParentConfiguration.class).child( - ChildConfiguration.class).run(args); + new SpringApplicationBuilder(ParentConfiguration.class) + .child(ChildConfiguration.class).run(args); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java index 74ef7dfede..1041828f83 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java @@ -84,8 +84,8 @@ public class BasicErrorControllerIntegrationTests { @SuppressWarnings("rawtypes") public void testErrorForMachineClient() throws Exception { load(); - ResponseEntity entity = new TestRestTemplate().getForEntity( - createUrl("?trace=true"), Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity(createUrl("?trace=true"), Map.class); assertErrorAttributes(entity.getBody(), "500", "" + "Internal Server Error", IllegalStateException.class, "Expected!", "/"); assertFalse("trace parameter should not be set", @@ -96,19 +96,20 @@ public class BasicErrorControllerIntegrationTests { @SuppressWarnings("rawtypes") public void testErrorForMachineClientTraceParamStacktrace() throws Exception { load("--server.error.include-stacktrace=on-trace-param"); - ResponseEntity entity = new TestRestTemplate().getForEntity( - createUrl("?trace=true"), Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity(createUrl("?trace=true"), Map.class); assertErrorAttributes(entity.getBody(), "500", "" + "Internal Server Error", IllegalStateException.class, "Expected!", "/"); - assertTrue("trace parameter should be set", entity.getBody().containsKey("trace")); + assertTrue("trace parameter should be set", + entity.getBody().containsKey("trace")); } @Test @SuppressWarnings("rawtypes") public void testErrorForMachineClientNoStacktrace() throws Exception { load("--server.error.include-stacktrace=never"); - ResponseEntity entity = new TestRestTemplate().getForEntity( - createUrl("?trace=true"), Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity(createUrl("?trace=true"), Map.class); assertErrorAttributes(entity.getBody(), "500", "" + "Internal Server Error", IllegalStateException.class, "Expected!", "/"); assertFalse("trace parameter should not be set", @@ -119,19 +120,20 @@ public class BasicErrorControllerIntegrationTests { @SuppressWarnings("rawtypes") public void testErrorForMachineClientAlwaysStacktrace() throws Exception { load("--server.error.include-stacktrace=always"); - ResponseEntity entity = new TestRestTemplate().getForEntity( - createUrl("?trace=false"), Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity(createUrl("?trace=false"), Map.class); assertErrorAttributes(entity.getBody(), "500", "" + "Internal Server Error", IllegalStateException.class, "Expected!", "/"); - assertTrue("trace parameter should be set", entity.getBody().containsKey("trace")); + assertTrue("trace parameter should be set", + entity.getBody().containsKey("trace")); } @Test @SuppressWarnings("rawtypes") public void testErrorForAnnotatedException() throws Exception { load(); - ResponseEntity entity = new TestRestTemplate().getForEntity( - createUrl("/annotated"), Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity(createUrl("/annotated"), Map.class); assertErrorAttributes(entity.getBody(), "400", "Bad Request", TestConfiguration.Errors.ExpectedException.class, "Expected!", "/annotated"); @@ -140,8 +142,8 @@ public class BasicErrorControllerIntegrationTests { @Test public void testErrorForAnnotatedNoReasonException() throws Exception { load(); - ResponseEntity entity = new TestRestTemplate().getForEntity( - createUrl("/annotatedNoReason"), Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity(createUrl("/annotatedNoReason"), Map.class); assertErrorAttributes(entity.getBody(), "406", "Not Acceptable", TestConfiguration.Errors.NoReasonExpectedException.class, "Expected message", "/annotatedNoReason"); @@ -201,7 +203,7 @@ public class BasicErrorControllerIntegrationTests { @Override protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws Exception { response.getWriter().write("ERROR_BEAN"); } }; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java index 53852e2672..ed22b1947b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java @@ -132,8 +132,8 @@ public class BasicErrorControllerMockMvcTests { EmbeddedServletContainerAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - ErrorMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) protected @interface MinimalWebConfiguration { } @@ -152,7 +152,7 @@ public class BasicErrorControllerMockMvcTests { @Override protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws Exception { response.getWriter().write("ERROR_BEAN"); } }; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewIntegrationTests.java index 90ed83401d..b034dd98da 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewIntegrationTests.java @@ -77,13 +77,12 @@ public class DefaultErrorViewIntegrationTests { @Test public void testErrorWithEscape() throws Exception { MvcResult response = this.mockMvc - .perform( - get("/error").requestAttr( - "javax.servlet.error.exception", + .perform(get("/error") + .requestAttr("javax.servlet.error.exception", new RuntimeException( - "")).accept( - MediaType.TEXT_HTML)).andExpect(status().isOk()) - .andReturn(); + "")) + .accept(MediaType.TEXT_HTML)) + .andExpect(status().isOk()).andReturn(); String content = response.getResponse().getContentAsString(); assertTrue("Wrong content: " + content, content.contains("<script>")); assertTrue("Wrong content: " + content, content.contains("Hello World")); @@ -96,8 +95,8 @@ public class DefaultErrorViewIntegrationTests { @Import({ EmbeddedServletContainerAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - ErrorMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) protected @interface MinimalWebConfiguration { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 1dcae8c618..2ef2f65353 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -79,8 +79,8 @@ public class ServerPropertiesTests { @Test public void testAddressBinding() throws Exception { RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server"); - binder.bind(new MutablePropertyValues(Collections.singletonMap("server.address", - "127.0.0.1"))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("server.address", "127.0.0.1"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(InetAddress.getByName("127.0.0.1"), this.properties.getAddress()); } @@ -95,8 +95,8 @@ public class ServerPropertiesTests { @Test public void testServletPathAsMapping() throws Exception { RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server"); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "server.servletPath", "/foo/*"))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("server.servletPath", "/foo/*"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals("/foo/*", this.properties.getServletMapping()); assertEquals("/foo", this.properties.getServletPrefix()); @@ -105,8 +105,8 @@ public class ServerPropertiesTests { @Test public void testServletPathAsPrefix() throws Exception { RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server"); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "server.servletPath", "/foo"))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("server.servletPath", "/foo"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals("/foo/*", this.properties.getServletMapping()); assertEquals("/foo", this.properties.getServletPrefix()); @@ -147,21 +147,24 @@ public class ServerPropertiesTests { @Test public void testCustomizeTomcat() throws Exception { - ConfigurableEmbeddedServletContainer factory = mock(ConfigurableEmbeddedServletContainer.class); + ConfigurableEmbeddedServletContainer factory = mock( + ConfigurableEmbeddedServletContainer.class); this.properties.customize(factory); verify(factory, never()).setContextPath(""); } @Test public void testDefaultDisplayName() throws Exception { - ConfigurableEmbeddedServletContainer factory = mock(ConfigurableEmbeddedServletContainer.class); + ConfigurableEmbeddedServletContainer factory = mock( + ConfigurableEmbeddedServletContainer.class); this.properties.customize(factory); verify(factory).setDisplayName("application"); } @Test public void testCustomizeDisplayName() throws Exception { - ConfigurableEmbeddedServletContainer factory = mock(ConfigurableEmbeddedServletContainer.class); + ConfigurableEmbeddedServletContainer factory = mock( + ConfigurableEmbeddedServletContainer.class); this.properties.setDisplayName("TestName"); this.properties.customize(factory); verify(factory).setDisplayName("TestName"); @@ -180,7 +183,8 @@ public class ServerPropertiesTests { map.put("server.session.cookie.secure", "true"); map.put("server.session.cookie.max-age", "60"); bindProperties(map); - ConfigurableEmbeddedServletContainer factory = mock(ConfigurableEmbeddedServletContainer.class); + ConfigurableEmbeddedServletContainer factory = mock( + ConfigurableEmbeddedServletContainer.class); ServletContext servletContext = mock(ServletContext.class); SessionCookieConfig sessionCookieConfig = mock(SessionCookieConfig.class); given(servletContext.getSessionCookieConfig()).willReturn(sessionCookieConfig); @@ -200,8 +204,8 @@ public class ServerPropertiesTests { private void triggerInitializers(ConfigurableEmbeddedServletContainer container, ServletContext servletContext) throws ServletException { - verify(container, atLeastOnce()).addInitializers( - this.initializersCaptor.capture()); + verify(container, atLeastOnce()) + .addInitializers(this.initializersCaptor.capture()); for (Object initializers : this.initializersCaptor.getAllValues()) { if (initializers instanceof ServletContextInitializer) { ((ServletContextInitializer) initializers).onStartup(servletContext); @@ -216,7 +220,8 @@ public class ServerPropertiesTests { @Test public void testCustomizeTomcatPort() throws Exception { - ConfigurableEmbeddedServletContainer factory = mock(ConfigurableEmbeddedServletContainer.class); + ConfigurableEmbeddedServletContainer factory = mock( + ConfigurableEmbeddedServletContainer.class); this.properties.setPort(8080); this.properties.customize(factory); verify(factory).setPort(8080); @@ -227,8 +232,8 @@ public class ServerPropertiesTests { Map map = new HashMap(); map.put("server.tomcat.uriEncoding", "US-ASCII"); bindProperties(map); - assertEquals(Charset.forName("US-ASCII"), this.properties.getTomcat() - .getUriEncoding()); + assertEquals(Charset.forName("US-ASCII"), + this.properties.getTomcat().getUriEncoding()); } @Test @@ -329,7 +334,8 @@ public class ServerPropertiesTests { @Test public void defaultUseForwardHeadersUndertow() throws Exception { - UndertowEmbeddedServletContainerFactory container = spy(new UndertowEmbeddedServletContainerFactory()); + UndertowEmbeddedServletContainerFactory container = spy( + new UndertowEmbeddedServletContainerFactory()); this.properties.customize(container); verify(container).setUseForwardHeaders(false); } @@ -337,7 +343,8 @@ public class ServerPropertiesTests { @Test public void setUseForwardHeadersUndertow() throws Exception { this.properties.setUseForwardHeaders(true); - UndertowEmbeddedServletContainerFactory container = spy(new UndertowEmbeddedServletContainerFactory()); + UndertowEmbeddedServletContainerFactory container = spy( + new UndertowEmbeddedServletContainerFactory()); this.properties.customize(container); verify(container).setUseForwardHeaders(true); } @@ -345,14 +352,16 @@ public class ServerPropertiesTests { @Test public void deduceUseForwardHeadersUndertow() throws Exception { this.properties.setEnvironment(new MockEnvironment().withProperty("DYNO", "-")); - UndertowEmbeddedServletContainerFactory container = spy(new UndertowEmbeddedServletContainerFactory()); + UndertowEmbeddedServletContainerFactory container = spy( + new UndertowEmbeddedServletContainerFactory()); this.properties.customize(container); verify(container).setUseForwardHeaders(true); } @Test public void defaultUseForwardHeadersJetty() throws Exception { - JettyEmbeddedServletContainerFactory container = spy(new JettyEmbeddedServletContainerFactory()); + JettyEmbeddedServletContainerFactory container = spy( + new JettyEmbeddedServletContainerFactory()); this.properties.customize(container); verify(container).setUseForwardHeaders(false); } @@ -360,7 +369,8 @@ public class ServerPropertiesTests { @Test public void setUseForwardHeadersJetty() throws Exception { this.properties.setUseForwardHeaders(true); - JettyEmbeddedServletContainerFactory container = spy(new JettyEmbeddedServletContainerFactory()); + JettyEmbeddedServletContainerFactory container = spy( + new JettyEmbeddedServletContainerFactory()); this.properties.customize(container); verify(container).setUseForwardHeaders(true); } @@ -368,14 +378,15 @@ public class ServerPropertiesTests { @Test public void deduceUseForwardHeadersJetty() throws Exception { this.properties.setEnvironment(new MockEnvironment().withProperty("DYNO", "-")); - JettyEmbeddedServletContainerFactory container = spy(new JettyEmbeddedServletContainerFactory()); + JettyEmbeddedServletContainerFactory container = spy( + new JettyEmbeddedServletContainerFactory()); this.properties.customize(container); verify(container).setUseForwardHeaders(true); } private void bindProperties(Map map) { - new RelaxedDataBinder(this.properties, "server").bind(new MutablePropertyValues( - map)); + new RelaxedDataBinder(this.properties, "server") + .bind(new MutablePropertyValues(map)); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java index 0d02deb71e..4fda7771f2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java @@ -138,8 +138,8 @@ public class WebMvcAutoConfigurationTests { Map> mappingLocations = getResourceMappingLocations(); assertThat(mappingLocations.get("/**").size(), equalTo(5)); assertThat(mappingLocations.get("/webjars/**").size(), equalTo(1)); - assertThat(mappingLocations.get("/webjars/**").get(0), - equalTo((Resource) new ClassPathResource("/META-INF/resources/webjars/"))); + assertThat(mappingLocations.get("/webjars/**").get(0), equalTo( + (Resource) new ClassPathResource("/META-INF/resources/webjars/"))); assertThat(getResourceResolvers("/webjars/**").size(), equalTo(1)); assertThat(getResourceTransformers("/webjars/**").size(), equalTo(0)); assertThat(getResourceResolvers("/**").size(), equalTo(1)); @@ -178,10 +178,8 @@ public class WebMvcAutoConfigurationTests { assertThat(getResourceTransformers("/webjars/**").size(), equalTo(1)); assertThat(getResourceResolvers("/**").size(), equalTo(2)); assertThat(getResourceTransformers("/**").size(), equalTo(1)); - assertThat( - getResourceResolvers("/**"), - containsInstances(CachingResourceResolver.class, - PathResourceResolver.class)); + assertThat(getResourceResolvers("/**"), containsInstances( + CachingResourceResolver.class, PathResourceResolver.class)); assertThat(getResourceTransformers("/**"), contains(instanceOf(CachingResourceTransformer.class))); } @@ -195,14 +193,11 @@ public class WebMvcAutoConfigurationTests { assertThat(getResourceTransformers("/webjars/**").size(), equalTo(2)); assertThat(getResourceResolvers("/**").size(), equalTo(3)); assertThat(getResourceTransformers("/**").size(), equalTo(2)); - assertThat( - getResourceResolvers("/**"), + assertThat(getResourceResolvers("/**"), containsInstances(CachingResourceResolver.class, VersionResourceResolver.class, PathResourceResolver.class)); - assertThat( - getResourceTransformers("/**"), - containsInstances(CachingResourceTransformer.class, - CssLinkResourceTransformer.class)); + assertThat(getResourceTransformers("/**"), containsInstances( + CachingResourceTransformer.class, CssLinkResourceTransformer.class)); VersionResourceResolver resolver = (VersionResourceResolver) getResourceResolvers( "/**").get(1); assertThat(resolver.getStrategyMap().get("/**/*.js"), @@ -217,14 +212,11 @@ public class WebMvcAutoConfigurationTests { assertThat(getResourceTransformers("/webjars/**").size(), equalTo(2)); assertThat(getResourceResolvers("/**").size(), equalTo(3)); assertThat(getResourceTransformers("/**").size(), equalTo(2)); - assertThat( - getResourceResolvers("/**"), + assertThat(getResourceResolvers("/**"), containsInstances(CachingResourceResolver.class, VersionResourceResolver.class, PathResourceResolver.class)); - assertThat( - getResourceTransformers("/**"), - containsInstances(CachingResourceTransformer.class, - CssLinkResourceTransformer.class)); + assertThat(getResourceTransformers("/**"), containsInstances( + CachingResourceTransformer.class, CssLinkResourceTransformer.class)); VersionResourceResolver resolver = (VersionResourceResolver) getResourceResolvers( "/**").get(1); assertThat(resolver.getStrategyMap().get("/*.png"), @@ -244,14 +236,10 @@ public class WebMvcAutoConfigurationTests { assertThat(getResourceTransformers("/webjars/**").size(), equalTo(2)); assertThat(getResourceResolvers("/**").size(), equalTo(2)); assertThat(getResourceTransformers("/**").size(), equalTo(2)); - assertThat( - getResourceResolvers("/**"), - containsInstances(VersionResourceResolver.class, - PathResourceResolver.class)); - assertThat( - getResourceTransformers("/**"), - containsInstances(CssLinkResourceTransformer.class, - AppCacheManifestTransformer.class)); + assertThat(getResourceResolvers("/**"), containsInstances( + VersionResourceResolver.class, PathResourceResolver.class)); + assertThat(getResourceTransformers("/**"), containsInstances( + CssLinkResourceTransformer.class, AppCacheManifestTransformer.class)); VersionResourceResolver resolver = (VersionResourceResolver) getResourceResolvers( "/**").get(0); assertThat(resolver.getStrategyMap().get("/*.png"), @@ -350,8 +338,8 @@ public class WebMvcAutoConfigurationTests { throws IllegalAccessException { Map> mappingLocations = new LinkedHashMap>(); if (mapping instanceof SimpleUrlHandlerMapping) { - Field locationsField = ReflectionUtils.findField( - ResourceHttpRequestHandler.class, "locations"); + Field locationsField = ReflectionUtils + .findField(ResourceHttpRequestHandler.class, "locations"); locationsField.setAccessible(true); for (Map.Entry entry : ((SimpleUrlHandlerMapping) mapping) .getHandlerMap().entrySet()) { @@ -391,7 +379,8 @@ public class WebMvcAutoConfigurationTests { @Test public void customViewResolver() throws Exception { load(CustomViewResolver.class); - assertThat(this.context.getBean("viewResolver"), instanceOf(MyViewResolver.class)); + assertThat(this.context.getBean("viewResolver"), + instanceOf(MyViewResolver.class)); } @Test @@ -406,12 +395,10 @@ public class WebMvcAutoConfigurationTests { @Test public void faviconMapping() throws IllegalAccessException { load(); - assertThat( - this.context.getBeansOfType(ResourceHttpRequestHandler.class).get( - "faviconRequestHandler"), is(notNullValue())); - assertThat( - this.context.getBeansOfType(SimpleUrlHandlerMapping.class).get( - "faviconHandlerMapping"), is(notNullValue())); + assertThat(this.context.getBeansOfType(ResourceHttpRequestHandler.class) + .get("faviconRequestHandler"), is(notNullValue())); + assertThat(this.context.getBeansOfType(SimpleUrlHandlerMapping.class) + .get("faviconHandlerMapping"), is(notNullValue())); Map> mappingLocations = getFaviconMappingLocations(); assertThat(mappingLocations.get("/**/favicon.ico").size(), equalTo(5)); } @@ -419,12 +406,10 @@ public class WebMvcAutoConfigurationTests { @Test public void faviconMappingDisabled() throws IllegalAccessException { load("spring.mvc.favicon.enabled:false"); - assertThat( - this.context.getBeansOfType(ResourceHttpRequestHandler.class).get( - "faviconRequestHandler"), is(nullValue())); - assertThat( - this.context.getBeansOfType(SimpleUrlHandlerMapping.class).get( - "faviconHandlerMapping"), is(nullValue())); + assertThat(this.context.getBeansOfType(ResourceHttpRequestHandler.class) + .get("faviconRequestHandler"), is(nullValue())); + assertThat(this.context.getBeansOfType(SimpleUrlHandlerMapping.class) + .get("faviconHandlerMapping"), is(nullValue())); } @Test @@ -447,15 +432,17 @@ public class WebMvcAutoConfigurationTests { @Test public void httpPutFormContentFilterIsAutoConfigured() { load(); - assertThat(this.context.getBeansOfType(OrderedHttpPutFormContentFilter.class) - .size(), is(equalTo(1))); + assertThat( + this.context.getBeansOfType(OrderedHttpPutFormContentFilter.class).size(), + is(equalTo(1))); } @Test public void httpPutFormContentFilterCanBeOverridden() { load(CustomHttpPutFormContentFilter.class); - assertThat(this.context.getBeansOfType(OrderedHttpPutFormContentFilter.class) - .size(), is(equalTo(0))); + assertThat( + this.context.getBeansOfType(OrderedHttpPutFormContentFilter.class).size(), + is(equalTo(0))); assertThat(this.context.getBeansOfType(HttpPutFormContentFilter.class).size(), is(equalTo(1))); } @@ -463,8 +450,9 @@ public class WebMvcAutoConfigurationTests { @Test public void customConfigurableWebBindingInitializer() { load(CustomConfigurableWebBindingInitializer.class); - assertThat(this.context.getBean(RequestMappingHandlerAdapter.class) - .getWebBindingInitializer(), + assertThat( + this.context.getBean(RequestMappingHandlerAdapter.class) + .getWebBindingInitializer(), is(instanceOf(CustomWebBindingInitializer.class))); } @@ -505,7 +493,7 @@ public class WebMvcAutoConfigurationTests { @Override protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws Exception { response.getOutputStream().write("Hello World".getBytes()); } }; @@ -518,8 +506,8 @@ public class WebMvcAutoConfigurationTests { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/webjars/**").addResourceLocations( - "classpath:/foo/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/foo/"); } } @@ -589,8 +577,8 @@ public class WebMvcAutoConfigurationTests { } - private static class CustomWebBindingInitializer extends - ConfigurableWebBindingInitializer { + private static class CustomWebBindingInitializer + extends ConfigurableWebBindingInitializer { } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WelcomePageMockMvcTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WelcomePageMockMvcTests.java index b5f72c314b..8b73e81edd 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WelcomePageMockMvcTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WelcomePageMockMvcTests.java @@ -68,8 +68,9 @@ public class WelcomePageMockMvcTests { @Test public void homePageCustomLocation() throws Exception { this.wac = (ConfigurableWebApplicationContext) new SpringApplicationBuilder( - TestConfiguration.class).properties( - "spring.resources.staticLocations:classpath:/custom/").run(); + TestConfiguration.class) + .properties("spring.resources.staticLocations:classpath:/custom/") + .run(); this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); this.mockMvc.perform(get("/")).andExpect(status().isOk()).andReturn(); } @@ -77,8 +78,9 @@ public class WelcomePageMockMvcTests { @Test public void homePageCustomLocationNoTrailingSlash() throws Exception { this.wac = (ConfigurableWebApplicationContext) new SpringApplicationBuilder( - TestConfiguration.class).properties( - "spring.resources.staticLocations:classpath:/custom").run(); + TestConfiguration.class) + .properties("spring.resources.staticLocations:classpath:/custom") + .run(); this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); this.mockMvc.perform(get("/")).andExpect(status().isOk()).andReturn(); } @@ -88,8 +90,8 @@ public class WelcomePageMockMvcTests { @Documented @Import({ ServerPropertiesAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - ErrorMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) protected @interface MinimalWebConfiguration { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java index 54dbf471fa..eefbbf4343 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java @@ -78,9 +78,9 @@ public class WebSocketMessagingAutoConfigurationTests { @Before public void setup() { - List transports = Arrays.asList(new WebSocketTransport( - new StandardWebSocketClient()), new RestTemplateXhrTransport( - new RestTemplate())); + List transports = Arrays.asList( + new WebSocketTransport(new StandardWebSocketClient()), + new RestTemplateXhrTransport(new RestTemplate())); this.sockJsClient = new SockJsClient(transports); } @@ -104,7 +104,8 @@ public class WebSocketMessagingAutoConfigurationTests { StompSessionHandler handler = new StompSessionHandlerAdapter() { @Override - public void afterConnected(StompSession session, StompHeaders connectedHeaders) { + public void afterConnected(StompSession session, + StompHeaders connectedHeaders) { session.subscribe("/app/data", new StompFrameHandler() { @Override @@ -142,8 +143,8 @@ public class WebSocketMessagingAutoConfigurationTests { }; stompClient.setMessageConverter(new SimpleMessageConverter()); - stompClient.connect("ws://localhost:{port}/messaging", handler, this.context - .getEnvironment().getProperty("local.server.port")); + stompClient.connect("ws://localhost:{port}/messaging", handler, + this.context.getEnvironment().getProperty("local.server.port")); if (!latch.await(30, TimeUnit.SECONDS)) { if (failure.get() != null) { @@ -166,8 +167,8 @@ public class WebSocketMessagingAutoConfigurationTests { ServerPropertiesAutoConfiguration.class, WebSocketMessagingAutoConfiguration.class, DispatcherServletAutoConfiguration.class }) - static class WebSocketMessagingConfiguration extends - AbstractWebSocketMessageBrokerConfigurer { + static class WebSocketMessagingConfiguration + extends AbstractWebSocketMessageBrokerConfigurer { @Override public void registerStompEndpoints(StompEndpointRegistry registry) { diff --git a/spring-boot-cli/src/it/java/org/springframework/boot/cli/CommandLineIT.java b/spring-boot-cli/src/it/java/org/springframework/boot/cli/CommandLineIT.java index d0e3c97c46..0a6e14fe44 100644 --- a/spring-boot-cli/src/it/java/org/springframework/boot/cli/CommandLineIT.java +++ b/spring-boot-cli/src/it/java/org/springframework/boot/cli/CommandLineIT.java @@ -42,8 +42,8 @@ public class CommandLineIT { throws IOException, InterruptedException { Invocation cli = this.cli.invoke("hint"); assertThat(cli.await(), equalTo(0)); - assertThat("Unexpected error: \n" + cli.getErrorOutput(), cli.getErrorOutput() - .length(), equalTo(0)); + assertThat("Unexpected error: \n" + cli.getErrorOutput(), + cli.getErrorOutput().length(), equalTo(0)); assertThat(cli.getStandardOutputLines().size(), equalTo(10)); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java index e278faa768..d714c44406 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java @@ -47,8 +47,9 @@ public class InitCommand extends OptionParsingCommand { } public InitCommand(InitOptionHandler handler) { - super("init", "Initialize a new project using Spring " - + "Initialzr (start.spring.io)", handler); + super("init", + "Initialize a new project using Spring " + "Initialzr (start.spring.io)", + handler); } @Override @@ -124,8 +125,8 @@ public class InitCommand extends OptionParsingCommand { @Override protected void options() { this.target = option(Arrays.asList("target"), "URL of the service to use") - .withRequiredArg().defaultsTo( - ProjectGenerationRequest.DEFAULT_SERVICE_URL); + .withRequiredArg() + .defaultsTo(ProjectGenerationRequest.DEFAULT_SERVICE_URL); this.listCapabilities = option(Arrays.asList("list", "l"), "List the capabilities of the service. Use it to discover the " + "dependencies and the types that are available"); @@ -138,7 +139,7 @@ public class InitCommand extends OptionParsingCommand { "Project coordinates (for example 'org.test')").withRequiredArg(); this.artifactId = option(Arrays.asList("artifactId", "a"), "Project coordinates; infer archive name (for example 'test')") - .withRequiredArg(); + .withRequiredArg(); this.version = option(Arrays.asList("version", "v"), "Project version (for example '0.0.1-SNAPSHOT')").withRequiredArg(); this.name = option(Arrays.asList("name", "n"), @@ -146,8 +147,7 @@ public class InitCommand extends OptionParsingCommand { this.description = option("description", "Project description") .withRequiredArg(); this.packageName = option("package-name", "Package name").withRequiredArg(); - this.type = option( - Arrays.asList("type", "t"), + this.type = option(Arrays.asList("type", "t"), "Project type. Not normally needed if you use --build " + "and/or --format. Check the capabilities of the service " + "(--list) for more details").withRequiredArg(); @@ -155,21 +155,19 @@ public class InitCommand extends OptionParsingCommand { "Project packaging (for example 'jar')").withRequiredArg(); this.build = option("build", "Build system to use (for example 'maven' or 'gradle')") - .withRequiredArg().defaultsTo("maven"); - this.format = option( - "format", + .withRequiredArg().defaultsTo("maven"); + this.format = option("format", "Format of the generated content (for example 'build' for a build file, " + "'project' for a project archive)").withRequiredArg() - .defaultsTo("project"); + .defaultsTo("project"); this.javaVersion = option(Arrays.asList("java-version", "j"), "Language level (for example '1.8')").withRequiredArg(); this.language = option(Arrays.asList("language", "l"), "Programming language (for example 'java')").withRequiredArg(); this.bootVersion = option(Arrays.asList("boot-version", "b"), "Spring Boot version (for example '1.2.0.RELEASE')") - .withRequiredArg(); - this.dependencies = option( - Arrays.asList("dependencies", "d"), + .withRequiredArg(); + this.dependencies = option(Arrays.asList("dependencies", "d"), "Comma-separated list of dependency identifiers to include in the " + "generated project").withRequiredArg(); } @@ -203,7 +201,8 @@ public class InitCommand extends OptionParsingCommand { } private void generateReport(OptionSet options) throws IOException { - Log.info(this.serviceCapabilitiesReport.generate(options.valueOf(this.target))); + Log.info(this.serviceCapabilitiesReport + .generate(options.valueOf(this.target))); } protected void generateProject(OptionSet options) throws IOException { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java index 02dc60d240..8142772ea6 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java @@ -73,8 +73,9 @@ import joptsimple.OptionSpec; public class JarCommand extends OptionParsingCommand { public JarCommand() { - super("jar", "Create a self-contained " - + "executable jar file from a Spring Groovy script", + super("jar", + "Create a self-contained " + + "executable jar file from a Spring Groovy script", new JarOptionHandler()); } @@ -91,14 +92,12 @@ public class JarCommand extends OptionParsingCommand { @Override protected void doOptions() { - this.includeOption = option( - "include", + this.includeOption = option("include", "Pattern applied to directories on the classpath to find files to include in the resulting jar") - .withRequiredArg().withValuesSeparatedBy(",").defaultsTo(""); - this.excludeOption = option( - "exclude", + .withRequiredArg().withValuesSeparatedBy(",").defaultsTo(""); + this.excludeOption = option("exclude", "Pattern applied to directories on the claspath to find files to exclude from the resulting jar") - .withRequiredArg().withValuesSeparatedBy(",").defaultsTo(""); + .withRequiredArg().withValuesSeparatedBy(",").defaultsTo(""); } @Override @@ -109,8 +108,8 @@ public class JarCommand extends OptionParsingCommand { "The name of the resulting jar and at least one source file must be specified"); File output = new File((String) nonOptionArguments.remove(0)); - Assert.isTrue(output.getName().toLowerCase().endsWith(".jar"), "The output '" - + output + "' is not a JAR file."); + Assert.isTrue(output.getName().toLowerCase().endsWith(".jar"), + "The output '" + output + "' is not a JAR file."); deleteIfExists(output); GroovyCompiler compiler = createCompiler(options); @@ -131,8 +130,8 @@ public class JarCommand extends OptionParsingCommand { private void deleteIfExists(File file) { if (file.exists() && !file.delete()) { - throw new IllegalStateException("Failed to delete existing file " - + file.getPath()); + throw new IllegalStateException( + "Failed to delete existing file " + file.getPath()); } } @@ -164,7 +163,7 @@ public class JarCommand extends OptionParsingCommand { private void writeJar(File file, Class[] compiledClasses, List classpathEntries, List dependencies) - throws FileNotFoundException, IOException, URISyntaxException { + throws FileNotFoundException, IOException, URISyntaxException { final List libraries; JarWriter writer = new JarWriter(file); try { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/CompilerOptionHandler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/CompilerOptionHandler.java index 00d64f2a60..dede2c1962 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/CompilerOptionHandler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/CompilerOptionHandler.java @@ -45,7 +45,7 @@ public class CompilerOptionHandler extends OptionHandler { "Do not attempt to guess dependencies"); this.autoconfigureOption = option("autoconfigure", "Add autoconfigure compiler transformations").withOptionalArg() - .ofType(Boolean.class).defaultsTo(true); + .ofType(Boolean.class).defaultsTo(true); this.classpathOption = option(Arrays.asList("classpath", "cp"), "Additional classpath entries").withRequiredArg(); doOptions(); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AnnotatedNodeASTTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AnnotatedNodeASTTransformation.java index 2ee0051baf..4ec8408506 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AnnotatedNodeASTTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AnnotatedNodeASTTransformation.java @@ -103,8 +103,8 @@ public abstract class AnnotatedNodeASTTransformation implements ASTTransformatio .iterator(); while (annotationNodes.hasNext()) { AnnotationNode annotationNode = annotationNodes.next(); - if (this.interestingAnnotationNames.contains(annotationNode - .getClassNode().getName())) { + if (this.interestingAnnotationNames + .contains(annotationNode.getClassNode().getName())) { this.annotationNodes.add(annotationNode); if (this.removeAnnotations) { annotationNodes.remove(); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java index 5a490b2ee7..140ca266ca 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java @@ -164,7 +164,8 @@ public abstract class AstUtils { return null; } - private static List getExpressionStatements(BlockStatement block) { + private static List getExpressionStatements( + BlockStatement block) { ArrayList statements = new ArrayList(); for (Statement statement : block.getStatements()) { if (statement instanceof ExpressionStatement) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java index 5e9d5d7603..2370c4e064 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java @@ -61,7 +61,8 @@ import groovy.grape.Grape; * @since 1.3.0 */ @Order(DependencyManagementBomTransformation.ORDER) -public class DependencyManagementBomTransformation extends AnnotatedNodeASTTransformation { +public class DependencyManagementBomTransformation + extends AnnotatedNodeASTTransformation { /** * The order of the transformation. @@ -69,9 +70,9 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans public static final int ORDER = Ordered.HIGHEST_PRECEDENCE + 100; private static final Set DEPENDENCY_MANAGEMENT_BOM_ANNOTATION_NAMES = Collections - .unmodifiableSet(new HashSet(Arrays.asList( - DependencyManagementBom.class.getName(), - DependencyManagementBom.class.getSimpleName()))); + .unmodifiableSet(new HashSet( + Arrays.asList(DependencyManagementBom.class.getName(), + DependencyManagementBom.class.getSimpleName()))); private final DependencyResolutionContext resolutionContext; @@ -103,7 +104,8 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans private List> createDependencyMaps(Expression valueExpression) { Map dependency = null; - List constantExpressions = getConstantExpressions(valueExpression); + List constantExpressions = getConstantExpressions( + valueExpression); List> dependencies = new ArrayList>( constantExpressions.size()); for (ConstantExpression expression : constantExpressions) { @@ -139,7 +141,8 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans return Collections.emptyList(); } - private List getConstantExpressions(ListExpression valueExpression) { + private List getConstantExpressions( + ListExpression valueExpression) { List expressions = new ArrayList(); for (Expression expression : valueExpression.getExpressions()) { if (expression instanceof ConstantExpression @@ -147,8 +150,9 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans expressions.add((ConstantExpression) expression); } else { - reportError("Each entry in the array must be an " - + "inline string constant", expression); + reportError( + "Each entry in the array must be an " + "inline string constant", + expression); } } return expressions; @@ -172,8 +176,8 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans request.setModelSource(new UrlModelSource(uri.toURL())); request.setSystemProperties(System.getProperties()); Model model = modelBuilder.build(request).getEffectiveModel(); - this.resolutionContext - .addDependencyManagement(new MavenModelDependencyManagement(model)); + this.resolutionContext.addDependencyManagement( + new MavenModelDependencyManagement(model)); } catch (Exception ex) { throw new IllegalStateException("Failed to build model for '" + uri @@ -191,14 +195,15 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans } private void reportError(String message, ASTNode node) { - getSourceUnit().getErrorCollector().addErrorAndContinue( - createSyntaxErrorMessage(message, node)); + getSourceUnit().getErrorCollector() + .addErrorAndContinue(createSyntaxErrorMessage(message, node)); } private Message createSyntaxErrorMessage(String message, ASTNode node) { - return new SyntaxErrorMessage(new SyntaxException(message, node.getLineNumber(), - node.getColumnNumber(), node.getLastLineNumber(), - node.getLastColumnNumber()), getSourceUnit()); + return new SyntaxErrorMessage( + new SyntaxException(message, node.getLineNumber(), node.getColumnNumber(), + node.getLastLineNumber(), node.getLastColumnNumber()), + getSourceUnit()); } private static class GrapeModelResolver implements ModelResolver { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java index 705c4c4a7a..b674e5314b 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java @@ -56,9 +56,11 @@ import groovy.lang.GroovyCodeSource; *
    *
  • {@link CompilerAutoConfiguration} strategies will be read from * {@code META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration} - * (per the standard java {@link ServiceLoader} contract) and applied during compilation
  • + * (per the standard java {@link ServiceLoader} contract) and applied during compilation + * * - *
  • Multiple classes can be returned if the Groovy source defines more than one Class
  • + *
  • Multiple classes can be returned if the Groovy source defines more than one Class + *
  • * *
  • Generated class files can also be loaded using * {@link ClassLoader#getResource(String)}
  • @@ -94,8 +96,8 @@ public class GroovyCompiler { GrapeEngineInstaller.install(grapeEngine); - this.loader.getConfiguration().addCompilationCustomizers( - new CompilerAutoConfigureCustomizer()); + this.loader.getConfiguration() + .addCompilationCustomizers(new CompilerAutoConfigureCustomizer()); if (configuration.isAutoconfigure()) { this.compilerAutoConfigurations = ServiceLoader .load(CompilerAutoConfiguration.class); @@ -105,14 +107,14 @@ public class GroovyCompiler { } this.transformations = new ArrayList(); - this.transformations.add(new DependencyManagementBomTransformation( - resolutionContext)); + this.transformations + .add(new DependencyManagementBomTransformation(resolutionContext)); this.transformations.add(new DependencyAutoConfigurationTransformation( this.loader, resolutionContext, this.compilerAutoConfigurations)); this.transformations.add(new GroovyBeansTransformation()); if (this.configuration.isGuessDependencies()) { - this.transformations.add(new ResolveDependencyCoordinatesTransformation( - resolutionContext)); + this.transformations.add( + new ResolveDependencyCoordinatesTransformation(resolutionContext)); } for (ASTTransformation transformation : ServiceLoader .load(SpringBootAstTransformation.class)) { @@ -175,8 +177,8 @@ public class GroovyCompiler { * @throws IOException in case of I/O errors * @throws CompilationFailedException in case of compilation errors */ - public Class[] compile(String... sources) throws CompilationFailedException, - IOException { + public Class[] compile(String... sources) + throws CompilationFailedException, IOException { this.loader.clearCache(); List> classes = new ArrayList>(); @@ -274,8 +276,8 @@ public class GroovyCompiler { public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException { - ImportCustomizer importCustomizer = new SmartImportCustomizer(source, - context, classNode); + ImportCustomizer importCustomizer = new SmartImportCustomizer(source, context, + classNode); ClassNode mainClassNode = MainClass.get(source.getAST().getClasses()); // Additional auto configuration @@ -290,10 +292,9 @@ public class GroovyCompiler { GroovyCompiler.this.configuration, context, source, classNode); } - autoConfiguration - .apply(GroovyCompiler.this.loader, - GroovyCompiler.this.configuration, context, source, - classNode); + autoConfiguration.apply(GroovyCompiler.this.loader, + GroovyCompiler.this.configuration, context, source, + classNode); } } importCustomizer.call(source, context, classNode); @@ -313,9 +314,8 @@ public class GroovyCompiler { if (AstUtils.hasAtLeastOneAnnotation(node, "Enable*AutoConfiguration")) { return null; // No need to enhance this } - if (AstUtils - .hasAtLeastOneAnnotation(node, "*Controller", "Configuration", - "Component", "*Service", "Repository", "Enable*")) { + if (AstUtils.hasAtLeastOneAnnotation(node, "*Controller", "Configuration", + "Component", "*Service", "Repository", "Enable*")) { return node; } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettings.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettings.java index fd7c6062c3..a589c49b99 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettings.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettings.java @@ -108,15 +108,17 @@ public class MavenSettings { return new ConservativeAuthenticationSelector(selector); } - private ProxySelector createProxySelector(SettingsDecryptionResult decryptedSettings) { + private ProxySelector createProxySelector( + SettingsDecryptionResult decryptedSettings) { DefaultProxySelector selector = new DefaultProxySelector(); for (Proxy proxy : decryptedSettings.getProxies()) { Authentication authentication = new AuthenticationBuilder() .addUsername(proxy.getUsername()).addPassword(proxy.getPassword()) .build(); - selector.add(new org.eclipse.aether.repository.Proxy(proxy.getProtocol(), - proxy.getHost(), proxy.getPort(), authentication), proxy - .getNonProxyHosts()); + selector.add( + new org.eclipse.aether.repository.Proxy(proxy.getProtocol(), + proxy.getHost(), proxy.getPort(), authentication), + proxy.getNonProxyHosts()); } return selector; } @@ -124,10 +126,10 @@ public class MavenSettings { private List determineActiveProfiles(Settings settings) { SpringBootCliModelProblemCollector problemCollector = new SpringBootCliModelProblemCollector(); List activeModelProfiles = createProfileSelector() - .getActiveProfiles( - createModelProfiles(settings.getProfiles()), - new SpringBootCliProfileActivationContext(settings - .getActiveProfiles()), problemCollector); + .getActiveProfiles(createModelProfiles(settings.getProfiles()), + new SpringBootCliProfileActivationContext( + settings.getActiveProfiles()), + problemCollector); if (!problemCollector.getProblems().isEmpty()) { throw new IllegalStateException(createFailureMessage(problemCollector)); } @@ -145,8 +147,8 @@ public class MavenSettings { PrintWriter printer = new PrintWriter(message); printer.println("Failed to determine active profiles:"); for (ModelProblemCollectorRequest problem : problemCollector.getProblems()) { - printer.println(" " + problem.getMessage() + " at " - + problem.getLocation()); + printer.println( + " " + problem.getMessage() + " at " + problem.getLocation()); } return message.toString(); } @@ -175,7 +177,8 @@ public class MavenSettings { return modelProfiles; } - private org.apache.maven.model.Activation createModelActivation(Activation activation) { + private org.apache.maven.model.Activation createModelActivation( + Activation activation) { org.apache.maven.model.Activation modelActivation = new org.apache.maven.model.Activation(); modelActivation.setActiveByDefault(activation.isActiveByDefault()); if (activation.getFile() != null) { @@ -226,8 +229,8 @@ public class MavenSettings { return this.activeProfiles; } - private static final class SpringBootCliProfileActivationContext implements - ProfileActivationContext { + private static final class SpringBootCliProfileActivationContext + implements ProfileActivationContext { private final List activeProfiles; @@ -268,8 +271,8 @@ public class MavenSettings { } - private static final class SpringBootCliModelProblemCollector implements - ModelProblemCollector { + private static final class SpringBootCliModelProblemCollector + implements ModelProblemCollector { private final List problems = new ArrayList(); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettingsReader.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettingsReader.java index 6368d1c2f3..ec4c7902df 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettingsReader.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettingsReader.java @@ -56,7 +56,8 @@ public class MavenSettingsReader { Settings settings = loadSettings(); SettingsDecryptionResult decrypted = decryptSettings(settings); if (!decrypted.getProblems().isEmpty()) { - Log.error("Maven settings decryption failed. Some Maven repositories may be inaccessible"); + Log.error( + "Maven settings decryption failed. Some Maven repositories may be inaccessible"); // Continue - the encrypted credentials may not be used } return new MavenSettings(settings, decrypted); @@ -72,8 +73,8 @@ public class MavenSettingsReader { .getEffectiveSettings(); } catch (SettingsBuildingException ex) { - throw new IllegalStateException("Failed to build settings from " - + settingsFile, ex); + throw new IllegalStateException( + "Failed to build settings from " + settingsFile, ex); } } @@ -99,8 +100,8 @@ public class MavenSettingsReader { field.set(target, value); } catch (Exception ex) { - throw new IllegalStateException("Failed to set field '" + fieldName - + "' on '" + target + "'", ex); + throw new IllegalStateException( + "Failed to set field '" + fieldName + "' on '" + target + "'", ex); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java index d242aaa21d..cbf255032e 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java @@ -78,10 +78,10 @@ public final class RepositoryConfigurationFactory { List repositoryConfiguration) { for (Profile activeProfile : activeProfiles) { for (Repository repository : activeProfile.getRepositories()) { - repositoryConfiguration.add(new RepositoryConfiguration(repository - .getId(), URI.create(repository.getUrl()), repository - .getSnapshots() != null ? repository.getSnapshots().isEnabled() - : false)); + repositoryConfiguration.add(new RepositoryConfiguration( + repository.getId(), URI.create(repository.getUrl()), + repository.getSnapshots() != null + ? repository.getSnapshots().isEnabled() : false)); } } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java index 45a1fd5761..3b6a814617 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java @@ -33,7 +33,8 @@ class SmartImportCustomizer extends ImportCustomizer { private SourceUnit source; - SmartImportCustomizer(SourceUnit source, GeneratorContext context, ClassNode classNode) { + SmartImportCustomizer(SourceUnit source, GeneratorContext context, + ClassNode classNode) { this.source = source; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/ReactorCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/ReactorCompilerAutoConfiguration.java index d4e8ce188a..cafdbe9674 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/ReactorCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/ReactorCompilerAutoConfiguration.java @@ -44,10 +44,10 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration @Override public void applyImports(ImportCustomizer imports) { - imports.addImports("reactor.bus.Bus", "reactor.bus.Event", - "reactor.bus.EventBus", "reactor.fn.Function", "reactor.fn.Functions", - "reactor.fn.Predicate", "reactor.fn.Predicates", "reactor.fn.Supplier", - "reactor.fn.Suppliers", "reactor.spring.context.annotation.Consumer", + imports.addImports("reactor.bus.Bus", "reactor.bus.Event", "reactor.bus.EventBus", + "reactor.fn.Function", "reactor.fn.Functions", "reactor.fn.Predicate", + "reactor.fn.Predicates", "reactor.fn.Supplier", "reactor.fn.Suppliers", + "reactor.spring.context.annotation.Consumer", "reactor.spring.context.annotation.ReplyTo", "reactor.spring.context.annotation.Selector", "reactor.spring.context.annotation.SelectorType", diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringRetryCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringRetryCompilerAutoConfiguration.java index 66b2dd97f1..72ffacd30c 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringRetryCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringRetryCompilerAutoConfiguration.java @@ -38,9 +38,9 @@ public class SpringRetryCompilerAutoConfiguration extends CompilerAutoConfigurat @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses( - "org.springframework.retry.annotation.EnableRetry").add("spring-retry", - "spring-boot-starter-aop"); + dependencies + .ifAnyMissingClasses("org.springframework.retry.annotation.EnableRetry") + .add("spring-retry", "spring-boot-starter-aop"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSecurityCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSecurityCompilerAutoConfiguration.java index 6424a073e0..3405f1c174 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSecurityCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSecurityCompilerAutoConfiguration.java @@ -45,8 +45,7 @@ public class SpringSecurityCompilerAutoConfiguration extends CompilerAutoConfigu @Override public void applyImports(ImportCustomizer imports) { - imports.addImports( - "org.springframework.security.core.Authentication", + imports.addImports("org.springframework.security.core.Authentication", "org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity", "org.springframework.security.core.authority.AuthorityUtils") .addStarImports( diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSecurityOAuth2CompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSecurityOAuth2CompilerAutoConfiguration.java index 8ee150dee4..9f1c4efd5b 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSecurityOAuth2CompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSecurityOAuth2CompilerAutoConfiguration.java @@ -30,8 +30,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Dave Syer * @since 1.3.0 */ -public class SpringSecurityOAuth2CompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class SpringSecurityOAuth2CompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -48,7 +48,8 @@ public class SpringSecurityOAuth2CompilerAutoConfiguration extends @Override public void applyImports(ImportCustomizer imports) throws CompilationFailedException { - imports.addImports("org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso"); + imports.addImports( + "org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso"); imports.addStarImports( "org.springframework.security.oauth2.config.annotation.web.configuration", "org.springframework.security.access.prepost"); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolver.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolver.java index 0517e1a99b..fbacab3433 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolver.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolver.java @@ -25,8 +25,8 @@ import org.springframework.util.StringUtils; * @author Phillip Webb * @author Andy Wilkinson */ -public class DependencyManagementArtifactCoordinatesResolver implements - ArtifactCoordinatesResolver { +public class DependencyManagementArtifactCoordinatesResolver + implements ArtifactCoordinatesResolver { private final DependencyManagement dependencyManagement; diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/MavenModelDependencyManagement.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/MavenModelDependencyManagement.java index 6a379c70f4..7797ea5c72 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/MavenModelDependencyManagement.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/MavenModelDependencyManagement.java @@ -50,8 +50,8 @@ public class MavenModelDependencyManagement implements DependencyManagement { List exclusions = new ArrayList(); for (org.apache.maven.model.Exclusion mavenExclusion : mavenDependency .getExclusions()) { - exclusions.add(new Exclusion(mavenExclusion.getGroupId(), mavenExclusion - .getArtifactId())); + exclusions.add(new Exclusion(mavenExclusion.getGroupId(), + mavenExclusion.getArtifactId())); } Dependency dependency = new Dependency(mavenDependency.getGroupId(), mavenDependency.getArtifactId(), mavenDependency.getVersion(), diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/SpringBootDependenciesDependencyManagement.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/SpringBootDependenciesDependencyManagement.java index 7bca1317a4..008fabadc2 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/SpringBootDependenciesDependencyManagement.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/SpringBootDependenciesDependencyManagement.java @@ -30,8 +30,8 @@ import org.apache.maven.model.locator.DefaultModelLocator; * @author Andy Wilkinson * @since 1.3.0 */ -public class SpringBootDependenciesDependencyManagement extends - MavenModelDependencyManagement { +public class SpringBootDependenciesDependencyManagement + extends MavenModelDependencyManagement { public SpringBootDependenciesDependencyManagement() { super(readModel()); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfiguration.java index 9d9d164ae6..3793dd4df7 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfiguration.java @@ -28,8 +28,8 @@ import org.springframework.boot.cli.compiler.MavenSettingsReader; * * @author Andy Wilkinson */ -public class SettingsXmlRepositorySystemSessionAutoConfiguration implements - RepositorySystemSessionAutoConfiguration { +public class SettingsXmlRepositorySystemSessionAutoConfiguration + implements RepositorySystemSessionAutoConfiguration { @Override public void apply(DefaultRepositorySystemSession session, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/SummaryProgressReporter.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/SummaryProgressReporter.java index bc3f07a31b..6ad5ca9d81 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/SummaryProgressReporter.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/SummaryProgressReporter.java @@ -76,13 +76,15 @@ final class SummaryProgressReporter implements ProgressReporter { } private void reportProgress() { - if (!this.finished && System.currentTimeMillis() - this.startTime > INITIAL_DELAY) { + if (!this.finished + && System.currentTimeMillis() - this.startTime > INITIAL_DELAY) { if (!this.started) { this.started = true; this.out.print("Resolving dependencies.."); this.lastProgressTime = System.currentTimeMillis(); } - else if (System.currentTimeMillis() - this.lastProgressTime > PROGRESS_DELAY) { + else if (System.currentTimeMillis() + - this.lastProgressTime > PROGRESS_DELAY) { this.out.print("."); this.lastProgressTime = System.currentTimeMillis(); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java index 66fe9f873c..7ba40eab7f 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java @@ -78,9 +78,9 @@ public class GrabCommandIntegrationTests { @Test public void customMetadata() throws Exception { System.setProperty("grape.root", "target"); - FileSystemUtils.copyRecursively(new File( - "src/test/resources/grab-samples/repository"), new File( - "target/repository")); + FileSystemUtils.copyRecursively( + new File("src/test/resources/grab-samples/repository"), + new File("target/repository")); this.cli.grab("customDependencyManagement.groovy", "--autoconfigure=false"); assertTrue(new File("target/repository/javax/ejb/ejb-api/3.0").isDirectory()); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java index ff06115d30..98d82f3725 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java @@ -136,8 +136,9 @@ public class ProjectGenerationRequestTests { this.request.setVersion("1.0.1-SNAPSHOT"); this.request.setDescription("Spring Boot Test"); assertEquals( - createDefaultUrl("?groupId=org.acme&artifactId=sample&version=1.0.1-SNAPSHOT" - + "&description=Spring+Boot+Test&type=test-type"), + createDefaultUrl( + "?groupId=org.acme&artifactId=sample&version=1.0.1-SNAPSHOT" + + "&description=Spring+Boot+Test&type=test-type"), this.request.generateUrl(createDefaultMetadata())); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/DependencyCustomizerTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/DependencyCustomizerTests.java index d7c880fab6..80e49782cf 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/DependencyCustomizerTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/DependencyCustomizerTests.java @@ -56,13 +56,13 @@ public class DependencyCustomizerTests { @Before public void setUp() { MockitoAnnotations.initMocks(this); - given(this.resolver.getGroupId("spring-boot-starter-logging")).willReturn( - "org.springframework.boot"); - given(this.resolver.getArtifactId("spring-boot-starter-logging")).willReturn( - "spring-boot-starter-logging"); + given(this.resolver.getGroupId("spring-boot-starter-logging")) + .willReturn("org.springframework.boot"); + given(this.resolver.getArtifactId("spring-boot-starter-logging")) + .willReturn("spring-boot-starter-logging"); this.moduleNode.addClass(this.classNode); - this.dependencyCustomizer = new DependencyCustomizer(new GroovyClassLoader( - getClass().getClassLoader()), this.moduleNode, + this.dependencyCustomizer = new DependencyCustomizer( + new GroovyClassLoader(getClass().getClassLoader()), this.moduleNode, new DependencyResolutionContext() { @Override @@ -104,48 +104,52 @@ public class DependencyCustomizerTests { assertEquals(1, grabAnnotations.size()); AnnotationNode annotationNode = grabAnnotations.get(0); assertGrabAnnotation(annotationNode, "org.springframework.boot", - "spring-boot-starter-logging", "1.2.3", "my-classifier", "my-type", false); + "spring-boot-starter-logging", "1.2.3", "my-classifier", "my-type", + false); } @Test public void anyMissingClassesWithMissingClassesPerformsAdd() { - this.dependencyCustomizer.ifAnyMissingClasses("does.not.Exist").add( - "spring-boot-starter-logging"); + this.dependencyCustomizer.ifAnyMissingClasses("does.not.Exist") + .add("spring-boot-starter-logging"); assertEquals(1, this.classNode.getAnnotations(new ClassNode(Grab.class)).size()); } @Test public void anyMissingClassesWithMixtureOfClassesPerformsAdd() { - this.dependencyCustomizer.ifAnyMissingClasses(getClass().getName(), - "does.not.Exist").add("spring-boot-starter-logging"); + this.dependencyCustomizer + .ifAnyMissingClasses(getClass().getName(), "does.not.Exist") + .add("spring-boot-starter-logging"); assertEquals(1, this.classNode.getAnnotations(new ClassNode(Grab.class)).size()); } @Test public void anyMissingClassesWithNoMissingClassesDoesNotPerformAdd() { - this.dependencyCustomizer.ifAnyMissingClasses(getClass().getName()).add( - "spring-boot-starter-logging"); + this.dependencyCustomizer.ifAnyMissingClasses(getClass().getName()) + .add("spring-boot-starter-logging"); assertEquals(0, this.classNode.getAnnotations(new ClassNode(Grab.class)).size()); } @Test public void allMissingClassesWithNoMissingClassesDoesNotPerformAdd() { - this.dependencyCustomizer.ifAllMissingClasses(getClass().getName()).add( - "spring-boot-starter-logging"); + this.dependencyCustomizer.ifAllMissingClasses(getClass().getName()) + .add("spring-boot-starter-logging"); assertEquals(0, this.classNode.getAnnotations(new ClassNode(Grab.class)).size()); } @Test public void allMissingClassesWithMixtureOfClassesDoesNotPerformAdd() { - this.dependencyCustomizer.ifAllMissingClasses(getClass().getName(), - "does.not.Exist").add("spring-boot-starter-logging"); + this.dependencyCustomizer + .ifAllMissingClasses(getClass().getName(), "does.not.Exist") + .add("spring-boot-starter-logging"); assertEquals(0, this.classNode.getAnnotations(new ClassNode(Grab.class)).size()); } @Test public void allMissingClassesWithAllClassesMissingPerformsAdd() { - this.dependencyCustomizer.ifAllMissingClasses("does.not.Exist", - "does.not.exist.Either").add("spring-boot-starter-logging"); + this.dependencyCustomizer + .ifAllMissingClasses("does.not.Exist", "does.not.exist.Either") + .add("spring-boot-starter-logging"); assertEquals(1, this.classNode.getAnnotations(new ClassNode(Grab.class)).size()); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactoryTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactoryTests.java index 66ef44d31e..208454ca55 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactoryTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactoryTests.java @@ -42,24 +42,23 @@ public class RepositoryConfigurationFactoryTests { public void run() { List repositoryConfiguration = RepositoryConfigurationFactory .createDefaultRepositoryConfiguration(); - assertRepositoryConfiguration(repositoryConfiguration, "central", - "local", "spring-snapshot", "spring-milestone"); + assertRepositoryConfiguration(repositoryConfiguration, "central", "local", + "spring-snapshot", "spring-milestone"); } }, "user.home:src/test/resources/maven-settings/basic"); } @Test public void snapshotRepositoriesDisabled() { - SystemProperties.doWithSystemProperties( - new Runnable() { - @Override - public void run() { - List repositoryConfiguration = RepositoryConfigurationFactory - .createDefaultRepositoryConfiguration(); - assertRepositoryConfiguration(repositoryConfiguration, "central", - "local"); - } - }, "user.home:src/test/resources/maven-settings/basic", + SystemProperties.doWithSystemProperties(new Runnable() { + @Override + public void run() { + List repositoryConfiguration = RepositoryConfigurationFactory + .createDefaultRepositoryConfiguration(); + assertRepositoryConfiguration(repositoryConfiguration, "central", + "local"); + } + }, "user.home:src/test/resources/maven-settings/basic", "disableSpringSnapshotRepos:true"); } @@ -70,27 +69,23 @@ public class RepositoryConfigurationFactoryTests { public void run() { List repositoryConfiguration = RepositoryConfigurationFactory .createDefaultRepositoryConfiguration(); - assertRepositoryConfiguration(repositoryConfiguration, "central", - "local", "spring-snapshot", "spring-milestone", - "active-by-default"); + assertRepositoryConfiguration(repositoryConfiguration, "central", "local", + "spring-snapshot", "spring-milestone", "active-by-default"); } }, "user.home:src/test/resources/maven-settings/active-profile-repositories"); } @Test public void activeByPropertyProfileRepositories() { - SystemProperties.doWithSystemProperties( - new Runnable() { - @Override - public void run() { - List repositoryConfiguration = RepositoryConfigurationFactory - .createDefaultRepositoryConfiguration(); - assertRepositoryConfiguration(repositoryConfiguration, "central", - "local", "spring-snapshot", "spring-milestone", - "active-by-property"); - } - }, - "user.home:src/test/resources/maven-settings/active-profile-repositories", + SystemProperties.doWithSystemProperties(new Runnable() { + @Override + public void run() { + List repositoryConfiguration = RepositoryConfigurationFactory + .createDefaultRepositoryConfiguration(); + assertRepositoryConfiguration(repositoryConfiguration, "central", "local", + "spring-snapshot", "spring-milestone", "active-by-property"); + } + }, "user.home:src/test/resources/maven-settings/active-profile-repositories", "foo:bar"); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformationTests.java index 8497b23f8e..26ff69b116 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformationTests.java @@ -63,7 +63,8 @@ public final class ResolveDependencyCoordinatesTransformationTests { private final AnnotationNode grabAnnotation = createGrabAnnotation(); - private final ArtifactCoordinatesResolver coordinatesResolver = mock(ArtifactCoordinatesResolver.class); + private final ArtifactCoordinatesResolver coordinatesResolver = mock( + ArtifactCoordinatesResolver.class); private final DependencyResolutionContext resolutionContext = new DependencyResolutionContext() { @@ -79,8 +80,8 @@ public final class ResolveDependencyCoordinatesTransformationTests { @Before public void setupExpectations() { - given(this.coordinatesResolver.getGroupId("spring-core")).willReturn( - "org.springframework"); + given(this.coordinatesResolver.getGroupId("spring-core")) + .willReturn("org.springframework"); } @Test @@ -233,8 +234,8 @@ public final class ResolveDependencyCoordinatesTransformationTests { return null; } else { - throw new IllegalStateException("Member '" + memberName - + "' is not a ConstantExpression"); + throw new IllegalStateException( + "Member '" + memberName + "' is not a ConstantExpression"); } } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/CompositeDependencyManagementTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/CompositeDependencyManagementTests.java index c725646534..6b14c89e19 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/CompositeDependencyManagementTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/CompositeDependencyManagementTests.java @@ -47,8 +47,10 @@ public class CompositeDependencyManagementTests { public void unknownSpringBootVersion() { given(this.dependencyManagement1.getSpringBootVersion()).willReturn(null); given(this.dependencyManagement2.getSpringBootVersion()).willReturn(null); - assertThat(new CompositeDependencyManagement(this.dependencyManagement1, - this.dependencyManagement2).getSpringBootVersion(), is(nullValue())); + assertThat( + new CompositeDependencyManagement(this.dependencyManagement1, + this.dependencyManagement2).getSpringBootVersion(), + is(nullValue())); } @Test @@ -69,26 +71,27 @@ public class CompositeDependencyManagementTests { @Test public void knownDependency() { - given(this.dependencyManagement1.find("artifact")).willReturn( - new Dependency("test", "artifact", "1.2.3")); - given(this.dependencyManagement2.find("artifact")).willReturn( - new Dependency("test", "artifact", "1.2.4")); - assertThat(new CompositeDependencyManagement(this.dependencyManagement1, - this.dependencyManagement2).find("artifact"), is(new Dependency("test", - "artifact", "1.2.3"))); + given(this.dependencyManagement1.find("artifact")) + .willReturn(new Dependency("test", "artifact", "1.2.3")); + given(this.dependencyManagement2.find("artifact")) + .willReturn(new Dependency("test", "artifact", "1.2.4")); + assertThat( + new CompositeDependencyManagement(this.dependencyManagement1, + this.dependencyManagement2).find("artifact"), + is(new Dependency("test", "artifact", "1.2.3"))); } @Test public void getDependencies() { - given(this.dependencyManagement1.getDependencies()).willReturn( - Arrays.asList(new Dependency("test", "artifact", "1.2.3"))); - given(this.dependencyManagement2.getDependencies()).willReturn( - Arrays.asList(new Dependency("test", "artifact", "1.2.4"))); + given(this.dependencyManagement1.getDependencies()) + .willReturn(Arrays.asList(new Dependency("test", "artifact", "1.2.3"))); + given(this.dependencyManagement2.getDependencies()) + .willReturn(Arrays.asList(new Dependency("test", "artifact", "1.2.4"))); assertThat( new CompositeDependencyManagement(this.dependencyManagement1, this.dependencyManagement2).getDependencies(), - contains(new Dependency("test", "artifact", "1.2.3"), new Dependency( - "test", "artifact", "1.2.4"))); + contains(new Dependency("test", "artifact", "1.2.3"), + new Dependency("test", "artifact", "1.2.4"))); } } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolverTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolverTests.java index 51d9f9a128..689969b2ad 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolverTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolverTests.java @@ -43,8 +43,8 @@ public class DependencyManagementArtifactCoordinatesResolverTests { @Before public void setup() { this.dependencyManagement = mock(DependencyManagement.class); - given(this.dependencyManagement.find("a1")).willReturn( - new Dependency("g1", "a1", "0")); + given(this.dependencyManagement.find("a1")) + .willReturn(new Dependency("g1", "a1", "0")); given(this.dependencyManagement.getSpringBootVersion()).willReturn("1"); this.resolver = new DependencyManagementArtifactCoordinatesResolver( this.dependencyManagement); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java index 93c15db073..cd1f2699a6 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java @@ -53,8 +53,8 @@ public class AetherGrapeEngineTests { private AetherGrapeEngine createGrapeEngine( RepositoryConfiguration... additionalRepositories) { List repositoryConfigurations = new ArrayList(); - repositoryConfigurations.add(new RepositoryConfiguration("central", URI - .create("http://repo1.maven.org/maven2"), false)); + repositoryConfigurations.add(new RepositoryConfiguration("central", + URI.create("http://repo1.maven.org/maven2"), false)); repositoryConfigurations.addAll(Arrays.asList(additionalRepositories)); return AetherGrapeEngineFactory.create(this.groovyClassLoader, repositoryConfigurations, new DependencyResolutionContext()); @@ -138,10 +138,8 @@ public class AetherGrapeEngineTests { public void nonTransitiveDependencyResolution() { Map args = new HashMap(); - createGrapeEngine().grab( - args, - createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE", - false)); + createGrapeEngine().grab(args, createDependency("org.springframework", + "spring-jdbc", "3.2.4.RELEASE", false)); assertEquals(1, this.groovyClassLoader.getURLs().length); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfigurationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfigurationTests.java index e3764b0345..3a769ef3fe 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfigurationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfigurationTests.java @@ -75,30 +75,27 @@ public class SettingsXmlRepositorySystemSessionAutoConfigurationTests { public void propertyInterpolation() throws SettingsBuildingException { final DefaultRepositorySystemSession session = MavenRepositorySystemUtils .newSession(); - given( - this.repositorySystem.newLocalRepositoryManager(eq(session), - any(LocalRepository.class))).willAnswer( - new Answer() { + given(this.repositorySystem.newLocalRepositoryManager(eq(session), + any(LocalRepository.class))) + .willAnswer(new Answer() { - @Override - public LocalRepositoryManager answer(InvocationOnMock invocation) - throws Throwable { - LocalRepository localRepository = invocation.getArgumentAt(1, - LocalRepository.class); - return new SimpleLocalRepositoryManagerFactory().newInstance( - session, localRepository); - } - }); + @Override + public LocalRepositoryManager answer( + InvocationOnMock invocation) throws Throwable { + LocalRepository localRepository = invocation + .getArgumentAt(1, LocalRepository.class); + return new SimpleLocalRepositoryManagerFactory() + .newInstance(session, localRepository); + } + }); - SystemProperties.doWithSystemProperties( - new Runnable() { - @Override - public void run() { - new SettingsXmlRepositorySystemSessionAutoConfiguration() - .apply(session, - SettingsXmlRepositorySystemSessionAutoConfigurationTests.this.repositorySystem); - } - }, "user.home:src/test/resources/maven-settings/property-interpolation", + SystemProperties.doWithSystemProperties(new Runnable() { + @Override + public void run() { + new SettingsXmlRepositorySystemSessionAutoConfiguration().apply(session, + SettingsXmlRepositorySystemSessionAutoConfigurationTests.this.repositorySystem); + } + }, "user.home:src/test/resources/maven-settings/property-interpolation", "foo:bar"); assertThat(session.getLocalRepository().getBasedir().getAbsolutePath(), @@ -112,14 +109,13 @@ public class SettingsXmlRepositorySystemSessionAutoConfigurationTests { SystemProperties.doWithSystemProperties(new Runnable() { @Override public void run() { - new SettingsXmlRepositorySystemSessionAutoConfiguration() - .apply(session, - SettingsXmlRepositorySystemSessionAutoConfigurationTests.this.repositorySystem); + new SettingsXmlRepositorySystemSessionAutoConfiguration().apply(session, + SettingsXmlRepositorySystemSessionAutoConfigurationTests.this.repositorySystem); } }, "user.home:" + userHome); - RemoteRepository repository = new RemoteRepository.Builder("my-server", - "default", "http://maven.example.com").build(); + RemoteRepository repository = new RemoteRepository.Builder("my-server", "default", + "http://maven.example.com").build(); assertMirrorSelectorConfiguration(session, repository); assertProxySelectorConfiguration(session, repository); @@ -130,8 +126,8 @@ public class SettingsXmlRepositorySystemSessionAutoConfigurationTests { RemoteRepository repository) { Proxy proxy = session.getProxySelector().getProxy(repository); repository = new RemoteRepository.Builder(repository).setProxy(proxy).build(); - AuthenticationContext authenticationContext = AuthenticationContext.forProxy( - session, repository); + AuthenticationContext authenticationContext = AuthenticationContext + .forProxy(session, repository); assertEquals("proxy.example.com", proxy.getHost()); assertEquals("proxyuser", authenticationContext.get(AuthenticationContext.USERNAME)); @@ -139,10 +135,11 @@ public class SettingsXmlRepositorySystemSessionAutoConfigurationTests { authenticationContext.get(AuthenticationContext.PASSWORD)); } - private void assertMirrorSelectorConfiguration( - DefaultRepositorySystemSession session, RemoteRepository repository) { + private void assertMirrorSelectorConfiguration(DefaultRepositorySystemSession session, + RemoteRepository repository) { RemoteRepository mirror = session.getMirrorSelector().getMirror(repository); - assertNotNull("No mirror configured for repository " + repository.getId(), mirror); + assertNotNull("No mirror configured for repository " + repository.getId(), + mirror); assertEquals("maven.example.com", mirror.getHost()); } @@ -151,8 +148,8 @@ public class SettingsXmlRepositorySystemSessionAutoConfigurationTests { Authentication authentication = session.getAuthenticationSelector() .getAuthentication(repository); - repository = new RemoteRepository.Builder(repository).setAuthentication( - authentication).build(); + repository = new RemoteRepository.Builder(repository) + .setAuthentication(authentication).build(); AuthenticationContext authenticationContext = AuthenticationContext .forRepository(session, repository); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteUrlPropertyExtractor.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteUrlPropertyExtractor.java index 2c1331c331..46ebf6dc82 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteUrlPropertyExtractor.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteUrlPropertyExtractor.java @@ -38,8 +38,8 @@ import org.springframework.util.StringUtils; * @author Phillip Webb * @author Andy Wilkinson */ -class RemoteUrlPropertyExtractor implements - ApplicationListener, Ordered { +class RemoteUrlPropertyExtractor + implements ApplicationListener, Ordered { private static final String NON_OPTION_ARGS = CommandLinePropertySource.DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME; diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java index afeb9ea51a..5d9db5b9b5 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java @@ -117,8 +117,8 @@ public class DevToolsProperties { allExclude.addAll(StringUtils.commaDelimitedListToSet(this.exclude)); } if (StringUtils.hasText(this.additionalExclude)) { - allExclude.addAll(StringUtils - .commaDelimitedListToSet(this.additionalExclude)); + allExclude.addAll( + StringUtils.commaDelimitedListToSet(this.additionalExclude)); } return allExclude.toArray(new String[allExclude.size()]); } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/FileWatchingFailureHandler.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/FileWatchingFailureHandler.java index 45c4fa0b60..4bc6fa130b 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/FileWatchingFailureHandler.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/FileWatchingFailureHandler.java @@ -45,8 +45,8 @@ class FileWatchingFailureHandler implements FailureHandler { failure.printStackTrace(); CountDownLatch latch = new CountDownLatch(1); FileSystemWatcher watcher = this.fileSystemWatcherFactory.getFileSystemWatcher(); - watcher.addSourceFolders(new ClassPathFolders(Restarter.getInstance() - .getInitialUrls())); + watcher.addSourceFolders( + new ClassPathFolders(Restarter.getInstance().getInitialUrls())); watcher.addListener(new Listener(latch)); watcher.start(); try { diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java index c33748f8b7..fd67a78460 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java @@ -122,8 +122,8 @@ public class LocalDevToolsAutoConfiguration { @Bean @ConditionalOnMissingBean public ClassPathRestartStrategy classPathRestartStrategy() { - return new PatternClassPathRestartStrategy(this.properties.getRestart() - .getAllExclude()); + return new PatternClassPathRestartStrategy( + this.properties.getRestart().getAllExclude()); } @Bean diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java index 736ce246b8..5e4f725daf 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java @@ -54,8 +54,8 @@ public class OptionalLiveReloadServer { if (!this.server.isStarted()) { this.server.start(); } - logger.info("LiveReload server is running on port " - + this.server.getPort()); + logger.info( + "LiveReload server is running on port " + this.server.getPort()); } catch (Exception ex) { logger.warn("Unable to start LiveReload server"); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java index 588467fac3..924a50e033 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java @@ -86,7 +86,8 @@ public class RemoteDevToolsAutoConfiguration { @Bean public HandlerMapper remoteDevToolsHealthCheckHandlerMapper() { Handler handler = new HttpStatusHandler(); - return new UrlHandlerMapper(this.properties.getRemote().getContextPath(), handler); + return new UrlHandlerMapper(this.properties.getRemote().getContextPath(), + handler); } @Bean @@ -152,8 +153,8 @@ public class RemoteDevToolsAutoConfiguration { @Bean @ConditionalOnMissingBean(name = "remoteDebugHttpTunnelServer") public HttpTunnelServer remoteDebugHttpTunnelServer() { - return new HttpTunnelServer(new SocketTargetServerConnection( - new RemoteDebugPortProvider())); + return new HttpTunnelServer( + new SocketTargetServerConnection(new RemoteDebugPortProvider())); } } @@ -169,8 +170,8 @@ public class RemoteDevToolsAutoConfiguration { } @Order(SecurityProperties.IGNORED_ORDER + 2) - static class RemoteRestartWebSecurityConfigurer extends - WebSecurityConfigurerAdapter { + static class RemoteRestartWebSecurityConfigurer + extends WebSecurityConfigurerAdapter { @Autowired private DevToolsProperties properties; diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcher.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcher.java index 02f81d5601..ade5cf066b 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcher.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcher.java @@ -35,8 +35,8 @@ import org.springframework.util.Assert; * @since 1.3.0 * @see ClassPathFileChangeListener */ -public class ClassPathFileSystemWatcher implements InitializingBean, DisposableBean, - ApplicationContextAware { +public class ClassPathFileSystemWatcher + implements InitializingBean, DisposableBean, ApplicationContextAware { private final FileSystemWatcher fileSystemWatcher; diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java index acda258670..6ea1be8ae2 100755 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java @@ -40,6 +40,7 @@ import org.springframework.core.env.PropertySource; public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostProcessor { private static final Map PROPERTIES; + static { Map properties = new HashMap(); properties.put("spring.thymeleaf.cache", "false"); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java index 0f46a0c0e9..ea0c78e336 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java @@ -114,8 +114,8 @@ public class FileSystemWatcher { */ public synchronized void addSourceFolder(File folder) { Assert.notNull(folder, "Folder must not be null"); - Assert.isTrue(folder.isDirectory(), "Folder '" + folder + "' must exist and must" - + " be a directory"); + Assert.isTrue(folder.isDirectory(), + "Folder '" + folder + "' must exist and must" + " be a directory"); checkNotStarted(); this.folders.put(folder, null); } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java index e02dd0d640..1ea0f697bc 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java @@ -74,11 +74,12 @@ class FolderSnapshot { } } - public ChangedFiles getChangedFiles(FolderSnapshot snapshot, FileFilter triggerFilter) { + public ChangedFiles getChangedFiles(FolderSnapshot snapshot, + FileFilter triggerFilter) { Assert.notNull(snapshot, "Snapshot must not be null"); File folder = this.folder; - Assert.isTrue(snapshot.folder.equals(folder), "Snapshot source folder must be '" - + folder + "'"); + Assert.isTrue(snapshot.folder.equals(folder), + "Snapshot source folder must be '" + folder + "'"); Set changes = new LinkedHashSet(); Map previousFiles = getFilesMap(); for (FileSnapshot currentFile : snapshot.files) { @@ -88,8 +89,8 @@ class FolderSnapshot { changes.add(new ChangedFile(folder, currentFile.getFile(), Type.ADD)); } else if (!previousFile.equals(currentFile)) { - changes.add(new ChangedFile(folder, currentFile.getFile(), - Type.MODIFY)); + changes.add( + new ChangedFile(folder, currentFile.getFile(), Type.MODIFY)); } } } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/Connection.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/Connection.java index 947eda4313..e1aa3d16d5 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/Connection.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/Connection.java @@ -38,8 +38,8 @@ class Connection { private static Log logger = LogFactory.getLog(Connection.class); - private static final Pattern WEBSOCKET_KEY_PATTERN = Pattern.compile( - "^Sec-WebSocket-Key:(.*)$", Pattern.MULTILINE); + private static final Pattern WEBSOCKET_KEY_PATTERN = Pattern + .compile("^Sec-WebSocket-Key:(.*)$", Pattern.MULTILINE); public final static String WEBSOCKET_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; @@ -89,8 +89,8 @@ class Connection { private void runWebSocket(String header) throws Exception { String accept = getWebsocketAcceptResponse(); this.outputStream.writeHeaders("HTTP/1.1 101 Switching Protocols", - "Upgrade: websocket", "Connection: Upgrade", "Sec-WebSocket-Accept: " - + accept); + "Upgrade: websocket", "Connection: Upgrade", + "Sec-WebSocket-Accept: " + accept); new Frame("{\"command\":\"hello\",\"protocols\":" + "[\"http://livereload.com/protocols/official-7\"]," + "\"serverName\":\"spring-boot\"}").write(this.outputStream); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java index 35896d01b4..8182c91872 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java @@ -52,10 +52,11 @@ import org.springframework.util.FileCopyUtils; * @author Phillip Webb * @since 1.3.0 */ -public class ClassPathChangeUploader implements - ApplicationListener { +public class ClassPathChangeUploader + implements ApplicationListener { private static final Map TYPE_MAPPINGS; + static { Map map = new HashMap(); map.put(ChangedFile.Type.ADD, ClassLoaderFile.Kind.ADDED); @@ -108,8 +109,8 @@ public class ClassPathChangeUploader implements private void logUpload(ClassLoaderFiles classLoaderFiles) { int size = classLoaderFiles.size(); - logger.info("Uploaded " + size + " class " - + (size == 1 ? "resource" : "resources")); + logger.info( + "Uploaded " + size + " class " + (size == 1 ? "resource" : "resources")); } private byte[] serialize(ClassLoaderFiles classLoaderFiles) throws IOException { @@ -133,10 +134,11 @@ public class ClassPathChangeUploader implements return files; } - private ClassLoaderFile asClassLoaderFile(ChangedFile changedFile) throws IOException { + private ClassLoaderFile asClassLoaderFile(ChangedFile changedFile) + throws IOException { ClassLoaderFile.Kind kind = TYPE_MAPPINGS.get(changedFile.getType()); - byte[] bytes = (kind == Kind.DELETED ? null : FileCopyUtils - .copyToByteArray(changedFile.getFile())); + byte[] bytes = (kind == Kind.DELETED ? null + : FileCopyUtils.copyToByteArray(changedFile.getFile())); long lastModified = (kind == Kind.DELETED ? System.currentTimeMillis() : changedFile.getFile().lastModified()); return new ClassLoaderFile(kind, lastModified, bytes); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java index 57ce85dfa2..4f24a50a86 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java @@ -97,8 +97,8 @@ public class RemoteClientConfiguration { SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); Proxy proxy = this.properties.getRemote().getProxy(); if (proxy.getHost() != null && proxy.getPort() != null) { - requestFactory.setProxy(new java.net.Proxy(Type.HTTP, new InetSocketAddress( - proxy.getHost(), proxy.getPort()))); + requestFactory.setProxy(new java.net.Proxy(Type.HTTP, + new InetSocketAddress(proxy.getHost(), proxy.getPort()))); } return new InterceptingClientHttpRequestFactory(requestFactory, interceptors); } @@ -157,8 +157,8 @@ public class RemoteClientConfiguration { @EventListener public void onClassPathChanged(ClassPathChangedEvent event) { String url = this.remoteUrl + this.properties.getRemote().getContextPath(); - this.executor.execute(new DelayedLiveReloadTrigger( - optionalLiveReloadServer(), this.clientHttpRequestFactory, url)); + this.executor.execute(new DelayedLiveReloadTrigger(optionalLiveReloadServer(), + this.clientHttpRequestFactory, url)); } @Bean @@ -221,8 +221,8 @@ public class RemoteClientConfiguration { @Bean public ClassPathRestartStrategy classPathRestartStrategy() { - return new PatternClassPathRestartStrategy(this.properties.getRestart() - .getAllExclude()); + return new PatternClassPathRestartStrategy( + this.properties.getRestart().getAllExclude()); } @Bean diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java index 697ffd9521..e70092aac8 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java @@ -33,6 +33,7 @@ import java.util.Set; public class DefaultRestartInitializer implements RestartInitializer { private static final Set SKIPPED_STACK_ELEMENTS; + static { Set skipped = new LinkedHashSet(); skipped.add("org.junit.runners."); @@ -60,9 +61,8 @@ public class DefaultRestartInitializer implements RestartInitializer { * @return {@code true} if the thread is a main invocation */ protected boolean isMain(Thread thread) { - return thread.getName().equals("main") - && thread.getContextClassLoader().getClass().getName() - .contains("AppClassLoader"); + return thread.getName().equals("main") && thread.getContextClassLoader() + .getClass().getName().contains("AppClassLoader"); } /** @@ -87,8 +87,9 @@ public class DefaultRestartInitializer implements RestartInitializer { * @return the URLs */ protected URL[] getUrls(Thread thread) { - return ChangeableUrls.fromUrlClassLoader( - (URLClassLoader) thread.getContextClassLoader()).toArray(); + return ChangeableUrls + .fromUrlClassLoader((URLClassLoader) thread.getContextClassLoader()) + .toArray(); } } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartApplicationListener.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartApplicationListener.java index 4ed4ba58c5..0b8e718bea 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartApplicationListener.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartApplicationListener.java @@ -30,8 +30,8 @@ import org.springframework.core.Ordered; * @since 1.3.0 * @see Restarter */ -public class RestartApplicationListener implements ApplicationListener, - Ordered { +public class RestartApplicationListener + implements ApplicationListener, Ordered { private int order = HIGHEST_PRECEDENCE; diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartScopeInitializer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartScopeInitializer.java index 0ddd5ea23c..894117f419 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartScopeInitializer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartScopeInitializer.java @@ -27,8 +27,8 @@ import org.springframework.context.ConfigurableApplicationContext; * @author Phillip Webb * @since 1.3.0 */ -public class RestartScopeInitializer implements - ApplicationContextInitializer { +public class RestartScopeInitializer + implements ApplicationContextInitializer { @Override public void initialize(ConfigurableApplicationContext applicationContext) { diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java index f60b9fcf26..19aad9ee5a 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java @@ -282,8 +282,8 @@ public class Restarter { ClassLoader classLoader = new RestartClassLoader(parent, urls, updatedFiles, this.logger); if (this.logger.isDebugEnabled()) { - this.logger.debug("Starting application " + this.mainClassName - + " with URLs " + Arrays.asList(urls)); + this.logger.debug("Starting application " + this.mainClassName + " with URLs " + + Arrays.asList(urls)); } return relaunch(classLoader); } @@ -374,8 +374,8 @@ public class Restarter { Map map = ((Map) instance); for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) { Object value = iterator.next(); - if (value instanceof Class - && ((Class) value).getClassLoader() instanceof RestartClassLoader) { + if (value instanceof Class && ((Class) value) + .getClassLoader() instanceof RestartClassLoader) { iterator.remove(); } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java index 538fee79ef..38b472056e 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java @@ -134,7 +134,8 @@ public class RestartClassLoader extends URLClassLoader implements SmartClassLoad } @Override - public Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + public Class loadClass(String name, boolean resolve) + throws ClassNotFoundException { String path = name.replace('.', '/').concat(".class"); ClassLoaderFile file = this.updatedFiles.getFile(path); if (file != null && file.getKind() == Kind.DELETED) { diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/HttpRestartServer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/HttpRestartServer.java index 9421de9e82..7aeea08821 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/HttpRestartServer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/HttpRestartServer.java @@ -70,7 +70,8 @@ public class HttpRestartServer { throws IOException { try { Assert.state(request.getHeaders().getContentLength() > 0, "No content"); - ObjectInputStream objectInputStream = new ObjectInputStream(request.getBody()); + ObjectInputStream objectInputStream = new ObjectInputStream( + request.getBody()); ClassLoaderFiles files = (ClassLoaderFiles) objectInputStream.readObject(); objectInputStream.close(); this.server.updateAndRestart(files); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java index 948162db7c..3e716347e2 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java @@ -95,7 +95,8 @@ public class RestartServer { restart(urls, files); } - private boolean updateFileSystem(URL url, String name, ClassLoaderFile classLoaderFile) { + private boolean updateFileSystem(URL url, String name, + ClassLoaderFile classLoaderFile) { if (!isFolderUrl(url.toString())) { return false; } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java index af7bb908ad..f91e3f86b2 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java @@ -88,8 +88,8 @@ public class HttpTunnelConnection implements TunnelConnection { throw new IllegalArgumentException("Malformed URL '" + url + "'"); } this.requestFactory = requestFactory; - this.executor = (executor == null ? Executors - .newCachedThreadPool(new TunnelThreadFactory()) : executor); + this.executor = (executor == null + ? Executors.newCachedThreadPool(new TunnelThreadFactory()) : executor); } @Override @@ -141,8 +141,8 @@ public class HttpTunnelConnection implements TunnelConnection { public int write(ByteBuffer src) throws IOException { int size = src.remaining(); if (size > 0) { - openNewConnection(new HttpTunnelPayload( - this.requestSeq.incrementAndGet(), src)); + openNewConnection( + new HttpTunnelPayload(this.requestSeq.incrementAndGet(), src)); } return size; } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClient.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClient.java index 34c68e955b..6a9edb721a 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClient.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClient.java @@ -154,8 +154,8 @@ public class TunnelClient implements SmartInitializingSingleton { private void handleConnection(SocketChannel socketChannel) throws Exception { Closeable closeable = new SocketCloseable(socketChannel); - WritableByteChannel outputChannel = TunnelClient.this.tunnelConnection.open( - socketChannel, closeable); + WritableByteChannel outputChannel = TunnelClient.this.tunnelConnection + .open(socketChannel, closeable); TunnelClient.this.listeners.fireOpenEvent(socketChannel); try { logger.trace("Accepted connection to tunnel client from " diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java index 6bae66bc5f..bca2df5141 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java @@ -37,11 +37,11 @@ import org.springframework.http.server.ServerHttpResponse; import org.springframework.util.Assert; /** - * A server that can be used to tunnel TCP traffic over HTTP. Similar in design to the Bidirectional-streams Over Synchronous - * HTTP (BOSH) XMPP extension protocol, the server uses long polling with HTTP - * requests held open until a response is available. A typical traffic pattern would be as - * follows: + * A server that can be used to tunnel TCP traffic over HTTP. Similar in design to the + * Bidirectional-streams Over + * Synchronous HTTP (BOSH) XMPP extension protocol, the server uses long polling with + * HTTP requests held open until a response is available. A typical traffic pattern would + * be as follows: * *
      * [ CLIENT ]                      [ SERVER ]
    @@ -193,7 +193,8 @@ public class HttpTunnelServer {
     	 * @param disconnectTimeout the disconnect timeout in milliseconds
     	 */
     	public void setDisconnectTimeout(long disconnectTimeout) {
    -		Assert.isTrue(disconnectTimeout > 0, "DisconnectTimeout must be a positive value");
    +		Assert.isTrue(disconnectTimeout > 0,
    +				"DisconnectTimeout must be a positive value");
     		this.disconnectTimeout = disconnectTimeout;
     	}
     
    @@ -277,7 +278,8 @@ public class HttpTunnelServer {
     				Iterator iterator = this.httpConnections.iterator();
     				while (iterator.hasNext()) {
     					HttpConnection httpConnection = iterator.next();
    -					if (httpConnection.isOlderThan(HttpTunnelServer.this.longPollTimeout)) {
    +					if (httpConnection
    +							.isOlderThan(HttpTunnelServer.this.longPollTimeout)) {
     						httpConnection.respond(HttpStatus.NO_CONTENT);
     						iterator.remove();
     					}
    @@ -324,8 +326,8 @@ public class HttpTunnelServer {
     			}
     			synchronized (this.httpConnections) {
     				while (this.httpConnections.size() > 1) {
    -					this.httpConnections.removeFirst().respond(
    -							HttpStatus.TOO_MANY_REQUESTS);
    +					this.httpConnections.removeFirst()
    +							.respond(HttpStatus.TOO_MANY_REQUESTS);
     				}
     				this.lastHttpRequestTime = System.currentTimeMillis();
     				this.httpConnections.addLast(httpConnection);
    @@ -439,8 +441,8 @@ public class HttpTunnelServer {
     		 * @return if the request is a signal to disconnect
     		 */
     		public boolean isDisconnectRequest() {
    -			return DISCONNECT_MEDIA_TYPE.equals(this.request.getHeaders()
    -					.getContentType());
    +			return DISCONNECT_MEDIA_TYPE
    +					.equals(this.request.getHeaders().getContentType());
     		}
     
     		/**
    diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/RemoteDebugPortProvider.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/RemoteDebugPortProvider.java
    index 00e3829cf7..02c35082b4 100644
    --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/RemoteDebugPortProvider.java
    +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/RemoteDebugPortProvider.java
    @@ -45,15 +45,16 @@ public class RemoteDebugPortProvider implements PortProvider {
     	@UsesUnsafeJava
     	@SuppressWarnings("restriction")
     	private static int getRemoteDebugPort() {
    -		String property = sun.misc.VMSupport.getAgentProperties().getProperty(
    -				JDWP_ADDRESS_PROPERTY);
    +		String property = sun.misc.VMSupport.getAgentProperties()
    +				.getProperty(JDWP_ADDRESS_PROPERTY);
     		try {
     			if (property != null && property.contains(":")) {
     				return Integer.valueOf(property.split(":")[1]);
     			}
     		}
     		catch (Exception ex) {
    -			logger.trace("Unable to get JDWP port from property value '" + property + "'");
    +			logger.trace(
    +					"Unable to get JDWP port from property value '" + property + "'");
     		}
     		return -1;
     	}
    diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/SocketTargetServerConnection.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/SocketTargetServerConnection.java
    index ad392136d6..4023279370 100644
    --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/SocketTargetServerConnection.java
    +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/SocketTargetServerConnection.java
    @@ -72,8 +72,8 @@ public class SocketTargetServerConnection implements TargetServerConnection {
     
     		TimeoutAwareChannel(SocketChannel socketChannel) throws IOException {
     			this.socketChannel = socketChannel;
    -			this.readChannel = Channels.newChannel(socketChannel.socket()
    -					.getInputStream());
    +			this.readChannel = Channels
    +					.newChannel(socketChannel.socket().getInputStream());
     		}
     
     		@Override
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/DevToolsPropertiesTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/DevToolsPropertiesTests.java
    index fa50316407..888ca9dc70 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/DevToolsPropertiesTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/DevToolsPropertiesTests.java
    @@ -34,8 +34,7 @@ public class DevToolsPropertiesTests {
     	public void additionalExcludeKeepsDefaults() {
     		DevToolsProperties.Restart restart = this.devToolsProperties.getRestart();
     		restart.setAdditionalExclude("foo/**,bar/**");
    -		assertThat(
    -				restart.getAllExclude(),
    +		assertThat(restart.getAllExclude(),
     				arrayContaining("META-INF/maven/**", "META-INF/resources/**",
     						"resources/**", "static/**", "public/**", "templates/**",
     						"**/*Test.class", "**/*Tests.class", "git.properties", "foo/**",
    @@ -55,7 +54,8 @@ public class DevToolsPropertiesTests {
     		DevToolsProperties.Restart restart = this.devToolsProperties.getRestart();
     		restart.setExclude("biz/**");
     		restart.setAdditionalExclude("foo/**,bar/**");
    -		assertThat(restart.getAllExclude(), arrayContaining("biz/**", "foo/**", "bar/**"));
    +		assertThat(restart.getAllExclude(),
    +				arrayContaining("biz/**", "foo/**", "bar/**"));
     	}
     
     }
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java
    index f52e554ab7..dfd19e9f47 100755
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java
    @@ -227,8 +227,8 @@ public class LocalDevToolsAutoConfigurationTests {
     		Object watcher = ReflectionTestUtils.getField(classPathWatcher,
     				"fileSystemWatcher");
     		@SuppressWarnings("unchecked")
    -		Map folders = (Map) ReflectionTestUtils.getField(
    -				watcher, "folders");
    +		Map folders = (Map) ReflectionTestUtils
    +				.getField(watcher, "folders");
     		assertThat(folders.size(), is(equalTo(2)));
     		assertThat(folders, hasKey(new File("src/main/java").getAbsoluteFile()));
     		assertThat(folders, hasKey(new File("src/test/java").getAbsoluteFile()));
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java
    index 1954a0f7d0..aa9e655928 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java
    @@ -209,13 +209,14 @@ public class RemoteDevToolsAutoConfigurationTests {
     
     		@Bean
     		public HttpTunnelServer remoteDebugHttpTunnelServer() {
    -			return new MockHttpTunnelServer(new SocketTargetServerConnection(
    -					new RemoteDebugPortProvider()));
    +			return new MockHttpTunnelServer(
    +					new SocketTargetServerConnection(new RemoteDebugPortProvider()));
     		}
     
     		@Bean
     		public HttpRestartServer remoteRestartHttpRestartServer() {
    -			SourceFolderUrlFilter sourceFolderUrlFilter = mock(SourceFolderUrlFilter.class);
    +			SourceFolderUrlFilter sourceFolderUrlFilter = mock(
    +					SourceFolderUrlFilter.class);
     			return new MockHttpRestartServer(sourceFolderUrlFilter);
     		}
     
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java
    index 656f5f1226..cb3679e4a5 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java
    @@ -80,7 +80,8 @@ public class ClassPathFileChangeListenerTests {
     	public void restartStrategyMustNotBeNull() throws Exception {
     		this.thrown.expect(IllegalArgumentException.class);
     		this.thrown.expectMessage("RestartStrategy must not be null");
    -		new ClassPathFileChangeListener(this.eventPublisher, null, this.fileSystemWatcher);
    +		new ClassPathFileChangeListener(this.eventPublisher, null,
    +				this.fileSystemWatcher);
     	}
     
     	@Test
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java
    index da7a29aec7..32be2063eb 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java
    @@ -99,8 +99,8 @@ public class ClassPathFileSystemWatcherTests {
     		public ClassPathFileSystemWatcher watcher() {
     			FileSystemWatcher watcher = new FileSystemWatcher(false, 100, 10);
     			URL[] urls = this.environemnt.getProperty("urls", URL[].class);
    -			return new ClassPathFileSystemWatcher(new MockFileSystemWatcherFactory(
    -					watcher), restartStrategy(), urls);
    +			return new ClassPathFileSystemWatcher(
    +					new MockFileSystemWatcherFactory(watcher), restartStrategy(), urls);
     		}
     
     		@Bean
    @@ -137,7 +137,8 @@ public class ClassPathFileSystemWatcherTests {
     
     	}
     
    -	private static class MockFileSystemWatcherFactory implements FileSystemWatcherFactory {
    +	private static class MockFileSystemWatcherFactory
    +			implements FileSystemWatcherFactory {
     
     		private final FileSystemWatcher watcher;
     
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/PatternClassPathRestartStrategyTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/PatternClassPathRestartStrategyTests.java
    index a9c308d4a4..018c9e00b7 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/PatternClassPathRestartStrategyTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/PatternClassPathRestartStrategyTests.java
    @@ -76,7 +76,8 @@ public class PatternClassPathRestartStrategyTests {
     
     	@Test
     	public void testChange() {
    -		ClassPathRestartStrategy strategy = createStrategy("**/*Test.class,**/*Tests.class");
    +		ClassPathRestartStrategy strategy = createStrategy(
    +				"**/*Test.class,**/*Tests.class");
     		assertRestartRequired(strategy, "com/example/ExampleTests.class", false);
     		assertRestartRequired(strategy, "com/example/ExampleTest.class", false);
     		assertRestartRequired(strategy, "com/example/Example.class", true);
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessorTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessorTests.java
    index e7f39b0e96..7234b3edfc 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessorTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessorTests.java
    @@ -55,8 +55,8 @@ public class DevToolsHomePropertiesPostProcessorTests {
     	public void loadsHomeProperties() throws Exception {
     		Properties properties = new Properties();
     		properties.put("abc", "def");
    -		OutputStream out = new FileOutputStream(new File(this.home,
    -				".spring-boot-devtools.properties"));
    +		OutputStream out = new FileOutputStream(
    +				new File(this.home, ".spring-boot-devtools.properties"));
     		properties.store(out, null);
     		out.close();
     		ConfigurableEnvironment environment = new MockEnvironment();
    @@ -73,8 +73,8 @@ public class DevToolsHomePropertiesPostProcessorTests {
     		assertThat(environment.getProperty("abc"), nullValue());
     	}
     
    -	private class MockDevToolHomePropertiesPostProcessor extends
    -			DevToolsHomePropertiesPostProcessor {
    +	private class MockDevToolHomePropertiesPostProcessor
    +			extends DevToolsHomePropertiesPostProcessor {
     
     		@Override
     		protected File getHomeFolder() {
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java
    index 1b48f37172..d616b4d3b5 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java
    @@ -113,8 +113,8 @@ public class FileSystemWatcherTests {
     		File folder = new File("does/not/exist");
     		assertThat(folder.exists(), is(false));
     		this.thrown.expect(IllegalArgumentException.class);
    -		this.thrown.expectMessage("Folder '" + folder
    -				+ "' must exist and must be a directory");
    +		this.thrown.expectMessage(
    +				"Folder '" + folder + "' must exist and must be a directory");
     		this.watcher.addSourceFolder(folder);
     	}
     
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FolderSnapshotTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FolderSnapshotTests.java
    index 3772bc87e3..194ca5e95a 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FolderSnapshotTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FolderSnapshotTests.java
    @@ -108,8 +108,8 @@ public class FolderSnapshotTests {
     	public void getChangedFilesSnapshotMustBeTheSameSourceFolder() throws Exception {
     		this.thrown.expect(IllegalArgumentException.class);
     		this.thrown.expectMessage("Snapshot source folder must be '" + this.folder + "'");
    -		this.initialSnapshot.getChangedFiles(new FolderSnapshot(
    -				createTestFolderStructure()), null);
    +		this.initialSnapshot
    +				.getChangedFiles(new FolderSnapshot(createTestFolderStructure()), null);
     	}
     
     	@Test
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java
    index ef0dfbcb23..94fd90cbf4 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java
    @@ -138,8 +138,8 @@ public class ClassPathChangeUploaderTests {
     		return file;
     	}
     
    -	private ClassLoaderFiles deserialize(byte[] bytes) throws IOException,
    -			ClassNotFoundException {
    +	private ClassLoaderFiles deserialize(byte[] bytes)
    +			throws IOException, ClassNotFoundException {
     		ObjectInputStream objectInputStream = new ObjectInputStream(
     				new ByteArrayInputStream(bytes));
     		return (ClassLoaderFiles) objectInputStream.readObject();
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/DelayedLiveReloadTriggerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/DelayedLiveReloadTriggerTests.java
    index b75a7e154a..ce3c3161c3 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/DelayedLiveReloadTriggerTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/DelayedLiveReloadTriggerTests.java
    @@ -75,8 +75,8 @@ public class DelayedLiveReloadTriggerTests {
     		MockitoAnnotations.initMocks(this);
     		given(this.errorRequest.execute()).willReturn(this.errorResponse);
     		given(this.okRequest.execute()).willReturn(this.okResponse);
    -		given(this.errorResponse.getStatusCode()).willReturn(
    -				HttpStatus.INTERNAL_SERVER_ERROR);
    +		given(this.errorResponse.getStatusCode())
    +				.willReturn(HttpStatus.INTERNAL_SERVER_ERROR);
     		given(this.okResponse.getStatusCode()).willReturn(HttpStatus.OK);
     		this.trigger = new DelayedLiveReloadTrigger(this.liveReloadServer,
     				this.requestFactory, URL);
    @@ -112,8 +112,9 @@ public class DelayedLiveReloadTriggerTests {
     
     	@Test
     	public void triggerReloadOnStatus() throws Exception {
    -		given(this.requestFactory.createRequest(new URI(URL), HttpMethod.GET)).willThrow(
    -				new IOException()).willReturn(this.errorRequest, this.okRequest);
    +		given(this.requestFactory.createRequest(new URI(URL), HttpMethod.GET))
    +				.willThrow(new IOException())
    +				.willReturn(this.errorRequest, this.okRequest);
     		long startTime = System.currentTimeMillis();
     		this.trigger.setTimings(10, 200, 30000);
     		this.trigger.run();
    @@ -123,8 +124,8 @@ public class DelayedLiveReloadTriggerTests {
     
     	@Test
     	public void timeout() throws Exception {
    -		given(this.requestFactory.createRequest(new URI(URL), HttpMethod.GET)).willThrow(
    -				new IOException());
    +		given(this.requestFactory.createRequest(new URI(URL), HttpMethod.GET))
    +				.willThrow(new IOException());
     		this.trigger.setTimings(10, 0, 10);
     		this.trigger.run();
     		verify(this.liveReloadServer, never()).triggerReload();
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java
    index cdf2f75591..89895919a6 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java
    @@ -91,8 +91,8 @@ public class DispatcherTests {
     
     	@Test
     	public void accessManagerVetoRequest() throws Exception {
    -		given(this.accessManager.isAllowed(any(ServerHttpRequest.class))).willReturn(
    -				false);
    +		given(this.accessManager.isAllowed(any(ServerHttpRequest.class)))
    +				.willReturn(false);
     		HandlerMapper mapper = mock(HandlerMapper.class);
     		Handler handler = mock(Handler.class);
     		given(mapper.getHandler(any(ServerHttpRequest.class))).willReturn(handler);
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ChangeableUrlsTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ChangeableUrlsTests.java
    index 903e335af7..efcde69446 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ChangeableUrlsTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ChangeableUrlsTests.java
    @@ -57,10 +57,10 @@ public class ChangeableUrlsTests {
     
     	@Test
     	public void skipsUrls() throws Exception {
    -		ChangeableUrls urls = ChangeableUrls
    -				.fromUrls(makeUrl("spring-boot"), makeUrl("spring-boot-autoconfigure"),
    -						makeUrl("spring-boot-actuator"), makeUrl("spring-boot-starter"),
    -						makeUrl("spring-boot-starter-some-thing"));
    +		ChangeableUrls urls = ChangeableUrls.fromUrls(makeUrl("spring-boot"),
    +				makeUrl("spring-boot-autoconfigure"), makeUrl("spring-boot-actuator"),
    +				makeUrl("spring-boot-starter"),
    +				makeUrl("spring-boot-starter-some-thing"));
     		assertThat(urls.size(), equalTo(0));
     	}
     
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java
    index 717abf626a..a3f0ea42f4 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java
    @@ -63,7 +63,8 @@ public class DefaultRestartInitializerTests {
     	@Test
     	public void threadNotUsingAppClassLoader() throws Exception {
     		MockRestartInitializer initializer = new MockRestartInitializer(false);
    -		ClassLoader classLoader = new MockLauncherClassLoader(getClass().getClassLoader());
    +		ClassLoader classLoader = new MockLauncherClassLoader(
    +				getClass().getClassLoader());
     		Thread thread = new Thread();
     		thread.setName("main");
     		thread.setContextClassLoader(classLoader);
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java
    index 07f2f688d5..a01bbab350 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java
    @@ -62,8 +62,8 @@ public class MainMethodTests {
     			}
     		}).test();
     		assertThat(method.getMethod(), equalTo(this.actualMain));
    -		assertThat(method.getDeclaringClassName(), equalTo(this.actualMain
    -				.getDeclaringClass().getName()));
    +		assertThat(method.getDeclaringClassName(),
    +				equalTo(this.actualMain.getDeclaringClass().getName()));
     	}
     
     	@Test
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java
    index dfd80a4712..1fa97dbbf8 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java
    @@ -68,7 +68,8 @@ public class MockRestarter implements TestRule {
     					@Override
     					public Object answer(InvocationOnMock invocation) throws Throwable {
     						String name = (String) invocation.getArguments()[0];
    -						ObjectFactory factory = (ObjectFactory) invocation.getArguments()[1];
    +						ObjectFactory factory = (ObjectFactory) invocation
    +								.getArguments()[1];
     						Object attribute = MockRestarter.this.attributes.get(name);
     						if (attribute == null) {
     							attribute = factory.getObject();
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java
    index ad18132905..e6e0388f7d 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java
    @@ -85,7 +85,8 @@ public class RestartApplicationListenerTests {
     		Restarter.clearInstance();
     		RestartApplicationListener listener = new RestartApplicationListener();
     		SpringApplication application = new SpringApplication();
    -		ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class);
    +		ConfigurableApplicationContext context = mock(
    +				ConfigurableApplicationContext.class);
     		listener.onApplicationEvent(new ApplicationStartedEvent(application, ARGS));
     		assertThat(Restarter.getInstance(), not(nullValue()));
     		assertThat(Restarter.getInstance().isFinished(), equalTo(false));
    @@ -94,8 +95,8 @@ public class RestartApplicationListenerTests {
     					context, new RuntimeException()));
     		}
     		else {
    -			listener.onApplicationEvent(new ApplicationReadyEvent(application, ARGS,
    -					context));
    +			listener.onApplicationEvent(
    +					new ApplicationReadyEvent(application, ARGS, context));
     		}
     	}
     
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartScopeInitializerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartScopeInitializerTests.java
    index fa0727da9f..2f2cb39bb2 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartScopeInitializerTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartScopeInitializerTests.java
    @@ -69,8 +69,8 @@ public class RestartScopeInitializerTests {
     
     	}
     
    -	public static class ScopeTestBean implements
    -			ApplicationListener {
    +	public static class ScopeTestBean
    +			implements ApplicationListener {
     
     		public ScopeTestBean() {
     			createCount.incrementAndGet();
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java
    index e9805f0b1d..587d5b45f7 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java
    @@ -129,8 +129,8 @@ public class ClassLoaderFilesTests {
     		ObjectOutputStream oos = new ObjectOutputStream(bos);
     		oos.writeObject(this.files);
     		oos.close();
    -		ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(
    -				bos.toByteArray()));
    +		ObjectInputStream ois = new ObjectInputStream(
    +				new ByteArrayInputStream(bos.toByteArray()));
     		ClassLoaderFiles readObject = (ClassLoaderFiles) ois.readObject();
     		assertThat(readObject.getFile("myfile"), notNullValue());
     	}
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java
    index 8b99b33453..74a73ca4f1 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java
    @@ -112,29 +112,30 @@ public class RestartClassLoaderTests {
     
     	@Test
     	public void getResourceFromReloadableUrl() throws Exception {
    -		String content = readString(this.reloadClassLoader
    -				.getResourceAsStream(PACKAGE_PATH + "/Sample.txt"));
    +		String content = readString(
    +				this.reloadClassLoader.getResourceAsStream(PACKAGE_PATH + "/Sample.txt"));
     		assertThat(content, startsWith("fromchild"));
     	}
     
     	@Test
     	public void getResourceFromParent() throws Exception {
    -		String content = readString(this.reloadClassLoader
    -				.getResourceAsStream(PACKAGE_PATH + "/Parent.txt"));
    +		String content = readString(
    +				this.reloadClassLoader.getResourceAsStream(PACKAGE_PATH + "/Parent.txt"));
     		assertThat(content, startsWith("fromparent"));
     	}
     
     	@Test
     	public void getResourcesFiltersDuplicates() throws Exception {
    -		List resources = toList(this.reloadClassLoader.getResources(PACKAGE_PATH
    -				+ "/Sample.txt"));
    +		List resources = toList(
    +				this.reloadClassLoader.getResources(PACKAGE_PATH + "/Sample.txt"));
     		assertThat(resources.size(), equalTo(1));
     	}
     
     	@Test
     	public void loadClassFromReloadableUrl() throws Exception {
     		Class loaded = this.reloadClassLoader.loadClass(PACKAGE + ".Sample");
    -		assertThat(loaded.getClassLoader(), equalTo((ClassLoader) this.reloadClassLoader));
    +		assertThat(loaded.getClassLoader(),
    +				equalTo((ClassLoader) this.reloadClassLoader));
     	}
     
     	@Test
    @@ -203,11 +204,12 @@ public class RestartClassLoaderTests {
     	@Test
     	public void getAddedClass() throws Exception {
     		String name = PACKAGE_PATH + "/SampleParent.class";
    -		byte[] bytes = FileCopyUtils.copyToByteArray(getClass().getResourceAsStream(
    -				"SampleParent.class"));
    +		byte[] bytes = FileCopyUtils
    +				.copyToByteArray(getClass().getResourceAsStream("SampleParent.class"));
     		this.updatedFiles.addFile(name, new ClassLoaderFile(Kind.ADDED, bytes));
     		Class loaded = this.reloadClassLoader.loadClass(PACKAGE + ".SampleParent");
    -		assertThat(loaded.getClassLoader(), equalTo((ClassLoader) this.reloadClassLoader));
    +		assertThat(loaded.getClassLoader(),
    +				equalTo((ClassLoader) this.reloadClassLoader));
     	}
     
     	private String readString(InputStream in) throws IOException {
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilterTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilterTests.java
    index 479f000ce6..11e3c79e2e 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilterTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilterTests.java
    @@ -37,6 +37,7 @@ public class DefaultSourceFolderUrlFilterTests {
     	private static final String SOURCE_ROOT = "/Users/me/code/some-root/";
     
     	private static final List COMMON_POSTFIXES;
    +
     	static {
     		List postfixes = new ArrayList();
     		postfixes.add(".jar");
    @@ -92,9 +93,10 @@ public class DefaultSourceFolderUrlFilterTests {
     		urls.add(new URL("file:/some/path/" + name));
     		urls.add(new URL("file:/some/path/" + name + "!/"));
     		for (String postfix : COMMON_POSTFIXES) {
    -			urls.add(new URL("jar:file:/some/path/lib-module" + postfix + "!/lib/" + name));
    -			urls.add(new URL("jar:file:/some/path/lib-module" + postfix + "!/lib/" + name
    -					+ "!/"));
    +			urls.add(new URL(
    +					"jar:file:/some/path/lib-module" + postfix + "!/lib/" + name));
    +			urls.add(new URL(
    +					"jar:file:/some/path/lib-module" + postfix + "!/lib/" + name + "!/"));
     		}
     		return urls;
     	}
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java
    index 4b20e2a9a8..9f518b2839 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java
    @@ -105,13 +105,13 @@ public class MockClientHttpRequestFactory implements ClientHttpRequestFactory {
     		}
     
     		public ClientHttpResponse asHttpResponse(AtomicLong seq) {
    -			MockClientHttpResponse httpResponse = new MockClientHttpResponse(
    -					this.payload, this.status);
    +			MockClientHttpResponse httpResponse = new MockClientHttpResponse(this.payload,
    +					this.status);
     			waitForDelay();
     			if (this.payload != null) {
     				httpResponse.getHeaders().setContentLength(this.payload.length);
    -				httpResponse.getHeaders().setContentType(
    -						MediaType.APPLICATION_OCTET_STREAM);
    +				httpResponse.getHeaders()
    +						.setContentType(MediaType.APPLICATION_OCTET_STREAM);
     				httpResponse.getHeaders().add("x-seq",
     						Long.toString(seq.incrementAndGet()));
     			}
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadTests.java
    index cb315a7a71..d331b60d4a 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadTests.java
    @@ -121,8 +121,8 @@ public class HttpTunnelPayloadTests {
     
     	@Test
     	public void getPayloadData() throws Exception {
    -		ReadableByteChannel channel = Channels.newChannel(new ByteArrayInputStream(
    -				"hello".getBytes()));
    +		ReadableByteChannel channel = Channels
    +				.newChannel(new ByteArrayInputStream("hello".getBytes()));
     		ByteBuffer payloadData = HttpTunnelPayload.getPayloadData(channel);
     		ByteArrayOutputStream out = new ByteArrayOutputStream();
     		WritableByteChannel writeChannel = Channels.newChannel(out);
    diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java
    index 8dadd6ccd1..0b72663015 100644
    --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java
    +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java
    @@ -304,11 +304,11 @@ public class HttpTunnelServerTests {
     		testHttpConnectionNonAsync(100);
     	}
     
    -	private void testHttpConnectionNonAsync(long sleepBeforeResponse) throws IOException,
    -			InterruptedException {
    +	private void testHttpConnectionNonAsync(long sleepBeforeResponse)
    +			throws IOException, InterruptedException {
     		ServerHttpRequest request = mock(ServerHttpRequest.class);
    -		given(request.getAsyncRequestControl(this.response)).willThrow(
    -				new IllegalArgumentException());
    +		given(request.getAsyncRequestControl(this.response))
    +				.willThrow(new IllegalArgumentException());
     		final HttpConnection connection = new HttpConnection(request, this.response);
     		final AtomicBoolean responded = new AtomicBoolean();
     		Thread connectionThread = new Thread() {
    diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java
    index 9b18e02e13..f81f2a26a5 100644
    --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java
    +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java
    @@ -44,8 +44,7 @@ public class SpringLoadedTests {
     			throws IOException {
     		ProjectConnection project = new ProjectCreator()
     				.createProject("spring-loaded-jvm-args");
    -		project.newBuild()
    -				.forTasks("bootRun")
    +		project.newBuild().forTasks("bootRun")
     				.withArguments("-PbootVersion=" + BOOT_VERSION,
     						"-PspringLoadedVersion=" + SPRING_LOADED_VERSION, "--stacktrace")
     				.run();
    @@ -53,13 +52,13 @@ public class SpringLoadedTests {
     		List output = getOutput();
     		assertOutputContains("-DSOME_ARG=someValue", output);
     		assertOutputContains("-Xverify:none", output);
    -		assertOutputMatches(
    -				"-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar", output);
    +		assertOutputMatches("-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar",
    +				output);
     	}
     
     	private List getOutput() throws IOException {
    -		BufferedReader reader = new BufferedReader(new FileReader(new File(
    -				"target/spring-loaded-jvm-args/build/output.txt")));
    +		BufferedReader reader = new BufferedReader(new FileReader(
    +				new File("target/spring-loaded-jvm-args/build/output.txt")));
     		try {
     			List lines = new ArrayList();
     
    diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/Versions.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/Versions.java
    index 9f123cfeec..4565c8be90 100644
    --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/Versions.java
    +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/Versions.java
    @@ -33,18 +33,20 @@ public final class Versions {
     	}
     
     	public static String getBootVersion() {
    -		return evaluateExpression("/*[local-name()='project']/*[local-name()='version']"
    -				+ "/text()");
    +		return evaluateExpression(
    +				"/*[local-name()='project']/*[local-name()='version']" + "/text()");
     	}
     
     	public static String getSpringLoadedVersion() {
    -		return evaluateExpression("/*[local-name()='project']/*[local-name()='properties']"
    -				+ "/*[local-name()='spring-loaded.version']/text()");
    +		return evaluateExpression(
    +				"/*[local-name()='project']/*[local-name()='properties']"
    +						+ "/*[local-name()='spring-loaded.version']/text()");
     	}
     
     	public static String getSpringVersion() {
    -		return evaluateExpression("/*[local-name()='project']/*[local-name()='properties']"
    -				+ "/*[local-name()='spring.version']/text()");
    +		return evaluateExpression(
    +				"/*[local-name()='project']/*[local-name()='properties']"
    +						+ "/*[local-name()='spring.version']/text()");
     	}
     
     	private static String evaluateExpression(String expression) {
    @@ -52,8 +54,8 @@ public final class Versions {
     			XPathFactory xPathfactory = XPathFactory.newInstance();
     			XPath xpath = xPathfactory.newXPath();
     			XPathExpression expr = xpath.compile(expression);
    -			String version = expr.evaluate(new InputSource(new FileReader(
    -					"target/dependencies-pom.xml")));
    +			String version = expr.evaluate(
    +					new InputSource(new FileReader("target/dependencies-pom.xml")));
     			return version;
     		}
     		catch (Exception ex) {
    diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java
    index f9c247ab1a..17eaa48354 100644
    --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java
    +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java
    @@ -85,10 +85,10 @@ public class WarPackagingTests {
     
     	private void checkWebInfEntriesForServletContainer(String servletContainer,
     			Set expectedLibProvidedEntries) throws IOException {
    -		project.newBuild()
    -				.forTasks("clean", "build")
    +		project.newBuild().forTasks("clean", "build")
     				.withArguments("-PbootVersion=" + BOOT_VERSION,
    -						"-PservletContainer=" + servletContainer).run();
    +						"-PservletContainer=" + servletContainer)
    +				.run();
     
     		JarFile war = new JarFile("target/war-packaging/build/libs/war-packaging.war");
     
    @@ -108,9 +108,8 @@ public class WarPackagingTests {
     			throws IOException {
     		Set entries = getWebInfLibProvidedEntries(war);
     
    -		assertEquals(
    -				"Expected " + expectedEntries.size() + " but found " + entries.size()
    -						+ ": " + entries, expectedEntries.size(), entries.size());
    +		assertEquals("Expected " + expectedEntries.size() + " but found " + entries.size()
    +				+ ": " + entries, expectedEntries.size(), entries.size());
     
     		List unexpectedLibProvidedEntries = new ArrayList();
     		for (String entry : entries) {
    @@ -118,8 +117,10 @@ public class WarPackagingTests {
     				unexpectedLibProvidedEntries.add(entry);
     			}
     		}
    -		assertTrue("Found unexpected entries in WEB-INF/lib-provided: "
    -				+ unexpectedLibProvidedEntries, unexpectedLibProvidedEntries.isEmpty());
    +		assertTrue(
    +				"Found unexpected entries in WEB-INF/lib-provided: "
    +						+ unexpectedLibProvidedEntries,
    +				unexpectedLibProvidedEntries.isEmpty());
     	}
     
     	private void checkWebInfLibEntries(JarFile war, Set entriesOnlyInLibProvided)
    @@ -170,7 +171,8 @@ public class WarPackagingTests {
     		return name.startsWith(WEB_INF_LIB_PREFIX) && !name.equals(WEB_INF_LIB_PREFIX);
     	}
     
    -	private boolean isExpectedInWebInfLibProvided(String name, Set expectedEntries) {
    +	private boolean isExpectedInWebInfLibProvided(String name,
    +			Set expectedEntries) {
     		for (String expected : expectedEntries) {
     			if (name.startsWith(WEB_INF_LIB_PROVIDED_PREFIX + expected)) {
     				return true;
    diff --git a/spring-boot-samples/spring-boot-sample-actuator-log4j/src/test/java/sample/actuator/log4j/SampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-log4j/src/test/java/sample/actuator/log4j/SampleActuatorApplicationTests.java
    index 775c8884fa..511fdcd8cf 100644
    --- a/spring-boot-samples/spring-boot-sample-actuator-log4j/src/test/java/sample/actuator/log4j/SampleActuatorApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-actuator-log4j/src/test/java/sample/actuator/log4j/SampleActuatorApplicationTests.java
    @@ -51,8 +51,8 @@ public class SampleActuatorApplicationTests {
     	@Test
     	public void testHome() throws Exception {
     		@SuppressWarnings("rawtypes")
    -		ResponseEntity entity = new TestRestTemplate().getForEntity(
    -				"http://localhost:" + this.port, Map.class);
    +		ResponseEntity entity = new TestRestTemplate()
    +				.getForEntity("http://localhost:" + this.port, Map.class);
     		assertEquals(HttpStatus.OK, entity.getStatusCode());
     		@SuppressWarnings("unchecked")
     		Map body = entity.getBody();
    @@ -62,8 +62,8 @@ public class SampleActuatorApplicationTests {
     	@Test
     	public void testHealth() throws Exception {
     		@SuppressWarnings("rawtypes")
    -		ResponseEntity entity = new TestRestTemplate().getForEntity(
    -				"http://localhost:" + this.port + "/health", Map.class);
    +		ResponseEntity entity = new TestRestTemplate()
    +				.getForEntity("http://localhost:" + this.port + "/health", Map.class);
     		assertEquals(HttpStatus.OK, entity.getStatusCode());
     		@SuppressWarnings("unchecked")
     		Map body = entity.getBody();
    diff --git a/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java b/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java
    index 55b2e059f9..5b03436d77 100644
    --- a/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java
    +++ b/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java
    @@ -48,12 +48,10 @@ public class SampleAntApplicationIT {
     
     		});
     		assertThat("Number of jars", jarFiles.length, equalTo(1));
    -		Process process = new JavaExecutable()
    -				.processBuilder("-jar", jarFiles[0].getName()).directory(target).start();
    +		Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0].getName()).directory(target).start();
     		process.waitFor(5, TimeUnit.MINUTES);
     		assertThat(process.exitValue(), equalTo(0));
    -		String output = FileCopyUtils.copyToString(new InputStreamReader(process
    -				.getInputStream()));
    +		String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream()));
     		assertThat(output, containsString("Spring Boot Ant Example"));
     	}
     
    diff --git a/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/CacheManagerCheck.java b/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/CacheManagerCheck.java
    index bd11438949..9ca8ea0955 100644
    --- a/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/CacheManagerCheck.java
    +++ b/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/CacheManagerCheck.java
    @@ -38,8 +38,7 @@ public class CacheManagerCheck implements CommandLineRunner {
     
     	@Override
     	public void run(String... strings) throws Exception {
    -		logger.info("\n\n"
    -				+ "=========================================================\n"
    +		logger.info("\n\n" + "=========================================================\n"
     				+ "Using cache manager: " + this.cacheManager.getClass().getName() + "\n"
     				+ "=========================================================\n\n");
     	}
    diff --git a/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java b/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java
    index fd38e48573..4cdae68f7b 100644
    --- a/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java
    +++ b/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java
    @@ -62,8 +62,8 @@ class SampleClient {
     
     	@Scheduled(fixedDelay = 500)
     	public void retrieveCountry() {
    -		String randomCode = SAMPLE_COUNTRY_CODES.get(this.random
    -				.nextInt(SAMPLE_COUNTRY_CODES.size()));
    +		String randomCode = SAMPLE_COUNTRY_CODES
    +				.get(this.random.nextInt(SAMPLE_COUNTRY_CODES.size()));
     		System.out.println("Looking for country with code '" + randomCode + "'");
     		this.countryService.findByCode(randomCode);
     	}
    diff --git a/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/OrderedCassandraTestExecutionListener.java b/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/OrderedCassandraTestExecutionListener.java
    index c402fb02bf..eb3e5d52d7 100644
    --- a/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/OrderedCassandraTestExecutionListener.java
    +++ b/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/OrderedCassandraTestExecutionListener.java
    @@ -19,8 +19,8 @@ package sample.data.cassandra;
     import org.cassandraunit.spring.CassandraUnitDependencyInjectionTestExecutionListener;
     import org.springframework.core.Ordered;
     
    -public class OrderedCassandraTestExecutionListener extends
    -		CassandraUnitDependencyInjectionTestExecutionListener {
    +public class OrderedCassandraTestExecutionListener
    +		extends CassandraUnitDependencyInjectionTestExecutionListener {
     
     	@Override
     	public int getOrder() {
    diff --git a/spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/MyController.java b/spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/MyController.java
    index 7620751152..91fa83bda1 100644
    --- a/spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/MyController.java
    +++ b/spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/MyController.java
    @@ -35,8 +35,8 @@ public class MyController {
     			sessionVar = new Date();
     			session.setAttribute("var", sessionVar);
     		}
    -		ModelMap model = new ModelMap("message", Message.MESSAGE).addAttribute(
    -				"sessionVar", sessionVar);
    +		ModelMap model = new ModelMap("message", Message.MESSAGE)
    +				.addAttribute("sessionVar", sessionVar);
     		return new ModelAndView("hello", model);
     	}
     
    diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java
    index e2f34f4930..6d65d48ead 100644
    --- a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java
    @@ -85,8 +85,8 @@ public class SampleHypermediaJpaApplicationIntegrationTests {
     	public void browser() throws Exception {
     		MvcResult response = this.mockMvc.perform(get("/").accept(MediaType.TEXT_HTML))
     				.andExpect(status().isFound()).andReturn();
    -		assertEquals("/browser/index.html#", response.getResponse()
    -				.getHeaders("location").get(0));
    +		assertEquals("/browser/index.html#",
    +				response.getResponse().getHeaders("location").get(0));
     	}
     
     }
    diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/test/java/sample/hypermedia/ui/SampleHypermediaUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/test/java/sample/hypermedia/ui/SampleHypermediaUiApplicationTests.java
    index 2d297cde11..d790cc9a15 100644
    --- a/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/test/java/sample/hypermedia/ui/SampleHypermediaUiApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/test/java/sample/hypermedia/ui/SampleHypermediaUiApplicationTests.java
    @@ -46,15 +46,15 @@ public class SampleHypermediaUiApplicationTests {
     
     	@Test
     	public void home() {
    -		String response = new TestRestTemplate().getForObject("http://localhost:"
    -				+ this.port, String.class);
    +		String response = new TestRestTemplate()
    +				.getForObject("http://localhost:" + this.port, String.class);
     		assertTrue("Wrong body: " + response, response.contains("Hello World"));
     	}
     
     	@Test
     	public void links() {
    -		String response = new TestRestTemplate().getForObject("http://localhost:"
    -				+ this.port + "/actuator", String.class);
    +		String response = new TestRestTemplate().getForObject(
    +				"http://localhost:" + this.port + "/actuator", String.class);
     		assertTrue("Wrong body: " + response, response.contains("\"_links\":"));
     	}
     
    @@ -63,8 +63,9 @@ public class SampleHypermediaUiApplicationTests {
     		HttpHeaders headers = new HttpHeaders();
     		headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
     		ResponseEntity response = new TestRestTemplate().exchange(
    -				new RequestEntity(headers, HttpMethod.GET, new URI(
    -						"http://localhost:" + this.port + "/actuator")), String.class);
    +				new RequestEntity(headers, HttpMethod.GET,
    +						new URI("http://localhost:" + this.port + "/actuator")),
    +				String.class);
     		assertTrue("Wrong body: " + response, response.getBody().contains("\"_links\":"));
     	}
     
    @@ -72,9 +73,9 @@ public class SampleHypermediaUiApplicationTests {
     	public void homeWithHtml() throws Exception {
     		HttpHeaders headers = new HttpHeaders();
     		headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
    -		ResponseEntity response = new TestRestTemplate().exchange(
    -				new RequestEntity(headers, HttpMethod.GET, new URI(
    -						"http://localhost:" + this.port)), String.class);
    +		ResponseEntity response = new TestRestTemplate()
    +				.exchange(new RequestEntity(headers, HttpMethod.GET,
    +						new URI("http://localhost:" + this.port)), String.class);
     		assertTrue("Wrong body: " + response, response.getBody().contains("Hello World"));
     	}
     
    diff --git a/spring-boot-samples/spring-boot-sample-hypermedia/src/test/java/sample/hypermedia/SampleHypermediaApplicationHomePageTests.java b/spring-boot-samples/spring-boot-sample-hypermedia/src/test/java/sample/hypermedia/SampleHypermediaApplicationHomePageTests.java
    index eb7244c91a..02dcb8a7e6 100644
    --- a/spring-boot-samples/spring-boot-sample-hypermedia/src/test/java/sample/hypermedia/SampleHypermediaApplicationHomePageTests.java
    +++ b/spring-boot-samples/spring-boot-sample-hypermedia/src/test/java/sample/hypermedia/SampleHypermediaApplicationHomePageTests.java
    @@ -46,8 +46,8 @@ public class SampleHypermediaApplicationHomePageTests {
     
     	@Test
     	public void home() {
    -		String response = new TestRestTemplate().getForObject("http://localhost:"
    -				+ this.port, String.class);
    +		String response = new TestRestTemplate()
    +				.getForObject("http://localhost:" + this.port, String.class);
     		assertTrue("Wrong body: " + response, response.contains("404"));
     	}
     
    @@ -56,8 +56,9 @@ public class SampleHypermediaApplicationHomePageTests {
     		HttpHeaders headers = new HttpHeaders();
     		headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
     		ResponseEntity response = new TestRestTemplate().exchange(
    -				new RequestEntity(headers, HttpMethod.GET, new URI(
    -						"http://localhost:" + this.port + "/actuator")), String.class);
    +				new RequestEntity(headers, HttpMethod.GET,
    +						new URI("http://localhost:" + this.port + "/actuator")),
    +				String.class);
     		assertTrue("Wrong body: " + response, response.getBody().contains("\"_links\":"));
     	}
     
    @@ -66,8 +67,9 @@ public class SampleHypermediaApplicationHomePageTests {
     		HttpHeaders headers = new HttpHeaders();
     		headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
     		ResponseEntity response = new TestRestTemplate().exchange(
    -				new RequestEntity(headers, HttpMethod.GET, new URI(
    -						"http://localhost:" + this.port + "/actuator/")), String.class);
    +				new RequestEntity(headers, HttpMethod.GET,
    +						new URI("http://localhost:" + this.port + "/actuator/")),
    +				String.class);
     		assertTrue("Wrong body: " + response, response.getBody().contains("HAL Browser"));
     	}
     
    diff --git a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java
    index e7191a5c2b..8dbfecbc8e 100644
    --- a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java
    @@ -71,13 +71,14 @@ public class SampleJettyApplicationTests {
     
     		RestTemplate restTemplate = new TestRestTemplate();
     
    -		ResponseEntity entity = restTemplate.exchange("http://localhost:"
    -				+ this.port, HttpMethod.GET, requestEntity, byte[].class);
    +		ResponseEntity entity = restTemplate.exchange(
    +				"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
    +				byte[].class);
     
     		assertEquals(HttpStatus.OK, entity.getStatusCode());
     
    -		GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
    -				entity.getBody()));
    +		GZIPInputStream inflater = new GZIPInputStream(
    +				new ByteArrayInputStream(entity.getBody()));
     		try {
     			assertEquals("Hello World",
     					StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
    diff --git a/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java
    index 923cc518b4..eed945dea4 100644
    --- a/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java
    @@ -69,11 +69,12 @@ public class SampleJetty8ApplicationTests {
     		requestHeaders.set("Accept-Encoding", "gzip");
     		HttpEntity requestEntity = new HttpEntity(requestHeaders);
     		RestTemplate restTemplate = new TestRestTemplate();
    -		ResponseEntity entity = restTemplate.exchange("http://localhost:"
    -				+ this.port, HttpMethod.GET, requestEntity, byte[].class);
    +		ResponseEntity entity = restTemplate.exchange(
    +				"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
    +				byte[].class);
     		assertEquals(HttpStatus.OK, entity.getStatusCode());
    -		GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
    -				entity.getBody()));
    +		GZIPInputStream inflater = new GZIPInputStream(
    +				new ByteArrayInputStream(entity.getBody()));
     		try {
     			assertEquals("Hello World",
     					StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
    diff --git a/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJetty93ApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJetty93ApplicationTests.java
    index 71afbf7af3..d891f24240 100644
    --- a/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJetty93ApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJetty93ApplicationTests.java
    @@ -57,8 +57,8 @@ public class SampleJetty93ApplicationTests {
     
     	@Test
     	public void testHome() throws Exception {
    -		ResponseEntity entity = new TestRestTemplate().getForEntity(
    -				"http://localhost:" + this.port, String.class);
    +		ResponseEntity entity = new TestRestTemplate()
    +				.getForEntity("http://localhost:" + this.port, String.class);
     		assertEquals(HttpStatus.OK, entity.getStatusCode());
     		assertEquals("Hello World", entity.getBody());
     	}
    @@ -69,11 +69,12 @@ public class SampleJetty93ApplicationTests {
     		requestHeaders.set("Accept-Encoding", "gzip");
     		HttpEntity requestEntity = new HttpEntity(requestHeaders);
     		RestTemplate restTemplate = new TestRestTemplate();
    -		ResponseEntity entity = restTemplate.exchange("http://localhost:"
    -				+ this.port, HttpMethod.GET, requestEntity, byte[].class);
    +		ResponseEntity entity = restTemplate.exchange(
    +				"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
    +				byte[].class);
     		assertEquals(HttpStatus.OK, entity.getStatusCode());
    -		GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
    -				entity.getBody()));
    +		GZIPInputStream inflater = new GZIPInputStream(
    +				new ByteArrayInputStream(entity.getBody()));
     		try {
     			assertEquals("Hello World",
     					StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Keys.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Keys.java
    index bb09d7ea56..1e4b0b4523 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Keys.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Keys.java
    @@ -24,7 +24,8 @@ import sample.jooq.domain.tables.records.LanguageRecord;
      * A class modelling foreign key relationships between tables of the PUBLIC
      * schema
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
     public class Keys {
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Public.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Public.java
    index 3c43375981..e9e21c2b1e 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Public.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Public.java
    @@ -21,7 +21,8 @@ import sample.jooq.domain.tables.Language;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
     public class Public extends SchemaImpl {
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Tables.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Tables.java
    index 77eb1563e9..f3e77b0ce6 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Tables.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Tables.java
    @@ -14,7 +14,8 @@ import sample.jooq.domain.tables.Language;
     /**
      * Convenience access to all tables in PUBLIC
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
     public class Tables {
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Author.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Author.java
    index 9aac8f29ce..1fbddd1aaa 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Author.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Author.java
    @@ -22,7 +22,8 @@ import sample.jooq.domain.tables.records.AuthorRecord;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
     public class Author extends TableImpl {
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Book.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Book.java
    index f8d2929a1f..9606b4052b 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Book.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Book.java
    @@ -22,7 +22,8 @@ import sample.jooq.domain.tables.records.BookRecord;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
     public class Book extends TableImpl {
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookStore.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookStore.java
    index 7639b342b6..4c8ac4ebf6 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookStore.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookStore.java
    @@ -21,7 +21,8 @@ import sample.jooq.domain.tables.records.BookStoreRecord;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
     public class BookStore extends TableImpl {
     
    @@ -64,7 +65,8 @@ public class BookStore extends TableImpl {
     		this(alias, aliased, null);
     	}
     
    -	private BookStore(String alias, Table aliased, Field[] parameters) {
    +	private BookStore(String alias, Table aliased,
    +			Field[] parameters) {
     		super(alias, Public.PUBLIC, aliased, parameters, "");
     	}
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookToBookStore.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookToBookStore.java
    index 11086720ad..59b0eb0663 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookToBookStore.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/BookToBookStore.java
    @@ -22,7 +22,8 @@ import sample.jooq.domain.tables.records.BookToBookStoreRecord;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
     public class BookToBookStore extends TableImpl {
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Language.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Language.java
    index 5b8c23b05a..03ac8e44dc 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Language.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/Language.java
    @@ -21,7 +21,8 @@ import sample.jooq.domain.tables.records.LanguageRecord;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
     public class Language extends TableImpl {
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/AuthorRecord.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/AuthorRecord.java
    index 6dcca764d6..b5b857c73d 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/AuthorRecord.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/AuthorRecord.java
    @@ -18,10 +18,11 @@ import sample.jooq.domain.tables.Author;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
    -public class AuthorRecord extends UpdatableRecordImpl implements
    -		Record6 {
    +public class AuthorRecord extends UpdatableRecordImpl
    +		implements Record6 {
     
     	private static final long serialVersionUID = -983051550;
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookRecord.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookRecord.java
    index c543cfab3c..8695854795 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookRecord.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookRecord.java
    @@ -16,10 +16,11 @@ import sample.jooq.domain.tables.Book;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
    -public class BookRecord extends UpdatableRecordImpl implements
    -		Record5 {
    +public class BookRecord extends UpdatableRecordImpl
    +		implements Record5 {
     
     	private static final long serialVersionUID = 220424682;
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookStoreRecord.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookStoreRecord.java
    index f934a8499c..8151d8503b 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookStoreRecord.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookStoreRecord.java
    @@ -15,10 +15,11 @@ import sample.jooq.domain.tables.BookStore;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
    -public class BookStoreRecord extends TableRecordImpl implements
    -		Record1 {
    +public class BookStoreRecord extends TableRecordImpl
    +		implements Record1 {
     
     	private static final long serialVersionUID = -1969224219;
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookToBookStoreRecord.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookToBookStoreRecord.java
    index fe2c6f6c1a..8fff22a798 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookToBookStoreRecord.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/BookToBookStoreRecord.java
    @@ -16,7 +16,8 @@ import sample.jooq.domain.tables.BookToBookStore;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
     public class BookToBookStoreRecord extends UpdatableRecordImpl
     		implements Record3 {
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/LanguageRecord.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/LanguageRecord.java
    index c85c6f90c1..6a36203d77 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/LanguageRecord.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/tables/records/LanguageRecord.java
    @@ -16,10 +16,11 @@ import sample.jooq.domain.tables.Language;
     /**
      * This class is generated by jOOQ.
      */
    -@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
    +@Generated(value = { "http://www.jooq.org",
    +		"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
     @SuppressWarnings({ "all", "unchecked", "rawtypes" })
    -public class LanguageRecord extends UpdatableRecordImpl implements
    -		Record3 {
    +public class LanguageRecord extends UpdatableRecordImpl
    +		implements Record3 {
     
     	private static final long serialVersionUID = -1003202585;
     
    diff --git a/spring-boot-samples/spring-boot-sample-jooq/src/test/java/sample/jooq/SampleJooqApplicationTests.java b/spring-boot-samples/spring-boot-sample-jooq/src/test/java/sample/jooq/SampleJooqApplicationTests.java
    index 4b3bdaae13..50373df19d 100644
    --- a/spring-boot-samples/spring-boot-sample-jooq/src/test/java/sample/jooq/SampleJooqApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-jooq/src/test/java/sample/jooq/SampleJooqApplicationTests.java
    @@ -38,9 +38,9 @@ public class SampleJooqApplicationTests {
     		SampleJooqApplication.main(NO_ARGS);
     		assertThat(this.out.toString(), containsString("jOOQ Fetch 1 Greg Turnquest"));
     		assertThat(this.out.toString(), containsString("jOOQ Fetch 2 Craig Walls"));
    -		assertThat(this.out.toString(), containsString("jOOQ SQL "
    -				+ "[Learning Spring Boot : Greg Turnquest, "
    -				+ "Spring Boot in Action : Craig Walls]"));
    +		assertThat(this.out.toString(),
    +				containsString("jOOQ SQL " + "[Learning Spring Boot : Greg Turnquest, "
    +						+ "Spring Boot in Action : Craig Walls]"));
     	}
     
     }
    diff --git a/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/AggregateMetricsConfiguration.java b/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/AggregateMetricsConfiguration.java
    index 835257e2c6..2972cfb80f 100644
    --- a/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/AggregateMetricsConfiguration.java
    +++ b/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/AggregateMetricsConfiguration.java
    @@ -42,8 +42,9 @@ public class AggregateMetricsConfiguration {
     	}
     
     	private MetricReader globalMetricsForAggregation() {
    -		return new RedisMetricRepository(this.connectionFactory, this.export.getRedis()
    -				.getAggregatePrefix(), this.export.getRedis().getKey());
    +		return new RedisMetricRepository(this.connectionFactory,
    +				this.export.getRedis().getAggregatePrefix(),
    +				this.export.getRedis().getKey());
     	}
     
     	private MetricReader aggregatesMetricReader() {
    diff --git a/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleRedisExportApplication.java b/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleRedisExportApplication.java
    index 6341924679..97f7186c84 100644
    --- a/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleRedisExportApplication.java
    +++ b/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleRedisExportApplication.java
    @@ -38,8 +38,8 @@ public class SampleRedisExportApplication {
     	@ExportMetricWriter
     	public RedisMetricRepository redisMetricWriter(
     			RedisConnectionFactory connectionFactory) {
    -		return new RedisMetricRepository(connectionFactory, this.export.getRedis()
    -				.getPrefix(), this.export.getRedis().getKey());
    +		return new RedisMetricRepository(connectionFactory,
    +				this.export.getRedis().getPrefix(), this.export.getRedis().getKey());
     	}
     
     	@Bean
    diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java b/spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java
    index 7ea91420c1..0e50611ea6 100644
    --- a/spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java
    +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java
    @@ -33,8 +33,8 @@ public class SampleParentContextApplication {
     	}
     
     	public static void main(String[] args) throws Exception {
    -		new SpringApplicationBuilder(Parent.class).child(
    -				SampleParentContextApplication.class).run(args);
    +		new SpringApplicationBuilder(Parent.class)
    +				.child(SampleParentContextApplication.class).run(args);
     	}
     
     }
    diff --git a/spring-boot-samples/spring-boot-sample-property-validation/src/main/java/sample/propertyvalidation/SamplePropertyValidationApplication.java b/spring-boot-samples/spring-boot-sample-property-validation/src/main/java/sample/propertyvalidation/SamplePropertyValidationApplication.java
    index f979411d1c..462b0d567a 100644
    --- a/spring-boot-samples/spring-boot-sample-property-validation/src/main/java/sample/propertyvalidation/SamplePropertyValidationApplication.java
    +++ b/spring-boot-samples/spring-boot-sample-property-validation/src/main/java/sample/propertyvalidation/SamplePropertyValidationApplication.java
    @@ -50,8 +50,8 @@ public class SamplePropertyValidationApplication {
     	}
     
     	public static void main(String[] args) throws Exception {
    -		new SpringApplicationBuilder(SamplePropertyValidationApplication.class).profiles(
    -				"app").run(args);
    +		new SpringApplicationBuilder(SamplePropertyValidationApplication.class)
    +				.profiles("app").run(args);
     	}
     
     }
    diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java
    index 1a85f47f17..2c87eaa466 100644
    --- a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java
    @@ -85,23 +85,22 @@ public class SampleSecureOAuth2ApplicationTests {
     	public void useAppSecretsPlusUserAccountToGetBearerToken() throws Exception {
     		String header = "Basic " + new String(Base64.encode("foo:bar".getBytes()));
     		MvcResult result = this.mvc
    -				.perform(
    -						post("/oauth/token").header("Authorization", header)
    -								.param("grant_type", "password").param("scope", "read")
    -								.param("username", "greg").param("password", "turnquist"))
    +				.perform(post("/oauth/token").header("Authorization", header)
    +						.param("grant_type", "password").param("scope", "read")
    +						.param("username", "greg").param("password", "turnquist"))
     				.andExpect(status().isOk()).andDo(print()).andReturn();
    -		Object accessToken = this.objectMapper.readValue(
    -				result.getResponse().getContentAsString(), Map.class).get("access_token");
    +		Object accessToken = this.objectMapper
    +				.readValue(result.getResponse().getContentAsString(), Map.class)
    +				.get("access_token");
     		MvcResult flightsAction = this.mvc
    -				.perform(
    -						get("/flights/1").accept(MediaTypes.HAL_JSON).header(
    -								"Authorization", "Bearer " + accessToken))
    +				.perform(get("/flights/1").accept(MediaTypes.HAL_JSON)
    +						.header("Authorization", "Bearer " + accessToken))
     				.andExpect(
     						header().string("Content-Type", MediaTypes.HAL_JSON.toString()))
     				.andExpect(status().isOk()).andDo(print()).andReturn();
     
    -		Flight flight = this.objectMapper.readValue(flightsAction.getResponse()
    -				.getContentAsString(), Flight.class);
    +		Flight flight = this.objectMapper.readValue(
    +				flightsAction.getResponse().getContentAsString(), Flight.class);
     
     		assertThat(flight.getOrigin(), is("Nashville"));
     		assertThat(flight.getDestination(), is("Dallas"));
    diff --git a/spring-boot-samples/spring-boot-sample-secure-sso/src/test/java/sample/secure/sso/SampleOAuth2SsoApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure-sso/src/test/java/sample/secure/sso/SampleOAuth2SsoApplicationTests.java
    index 4278160aa3..68edb40664 100644
    --- a/spring-boot-samples/spring-boot-sample-secure-sso/src/test/java/sample/secure/sso/SampleOAuth2SsoApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-secure-sso/src/test/java/sample/secure/sso/SampleOAuth2SsoApplicationTests.java
    @@ -63,9 +63,8 @@ public class SampleOAuth2SsoApplicationTests {
     
     	@Test
     	public void everythingIsSecuredByDefault() throws Exception {
    -		this.mvc.perform(get("/"))
    -				.andExpect(status().isFound())
    -				.andExpect(header().string("location", containsString("localhost/login")));
    +		this.mvc.perform(get("/")).andExpect(status().isFound()).andExpect(
    +				header().string("location", containsString("localhost/login")));
     	}
     
     }
    diff --git a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java
    index ae3930daec..de7c3849ea 100644
    --- a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java
    @@ -43,7 +43,8 @@ import static org.junit.Assert.assertEquals;
      * @author Dave Syer
      */
     @RunWith(SpringJUnit4ClassRunner.class)
    -@SpringApplicationConfiguration({ SampleSecureApplication.class, TestConfiguration.class })
    +@SpringApplicationConfiguration({ SampleSecureApplication.class,
    +		TestConfiguration.class })
     public class SampleSecureApplicationTests {
     
     	@Autowired
    diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java
    index 71577575cb..1fd0ee737f 100644
    --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java
    @@ -67,11 +67,12 @@ public class SampleTomcatApplicationTests {
     		requestHeaders.set("Accept-Encoding", "gzip");
     		HttpEntity requestEntity = new HttpEntity(requestHeaders);
     		RestTemplate restTemplate = new TestRestTemplate();
    -		ResponseEntity entity = restTemplate.exchange("http://localhost:"
    -				+ this.port, HttpMethod.GET, requestEntity, byte[].class);
    +		ResponseEntity entity = restTemplate.exchange(
    +				"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
    +				byte[].class);
     		assertEquals(HttpStatus.OK, entity.getStatusCode());
    -		GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
    -				entity.getBody()));
    +		GZIPInputStream inflater = new GZIPInputStream(
    +				new ByteArrayInputStream(entity.getBody()));
     		try {
     			assertEquals("Hello World",
     					StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
    diff --git a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java
    index 82d8fb77af..d8060e8ff2 100644
    --- a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java
    @@ -71,11 +71,12 @@ public class SampleUndertowApplicationTests {
     		requestHeaders.set("Accept-Encoding", "gzip");
     		HttpEntity requestEntity = new HttpEntity(requestHeaders);
     		RestTemplate restTemplate = new TestRestTemplate();
    -		ResponseEntity entity = restTemplate.exchange("http://localhost:"
    -				+ this.port, HttpMethod.GET, requestEntity, byte[].class);
    +		ResponseEntity entity = restTemplate.exchange(
    +				"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
    +				byte[].class);
     		assertEquals(HttpStatus.OK, entity.getStatusCode());
    -		GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
    -				entity.getBody()));
    +		GZIPInputStream inflater = new GZIPInputStream(
    +				new ByteArrayInputStream(entity.getBody()));
     		try {
     			assertEquals("Hello World",
     					StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
    diff --git a/spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java
    index 8e2747c5de..b1dc54f3ea 100644
    --- a/spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java
    +++ b/spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java
    @@ -59,8 +59,8 @@ public class SampleGithubApplicationTests {
     
     	@Before
     	public void setUp() {
    -		this.mvc = webAppContextSetup(this.context).addFilters(this.filter,
    -				this.filterChain).build();
    +		this.mvc = webAppContextSetup(this.context)
    +				.addFilters(this.filter, this.filterChain).build();
     		SecurityContextHolder.clearContext();
     	}
     
    diff --git a/spring-boot-tools/spring-boot-antlib/src/main/java/org/springframework/boot/ant/FindMainClass.java b/spring-boot-tools/spring-boot-antlib/src/main/java/org/springframework/boot/ant/FindMainClass.java
    index 381217b0a3..02da7a0da4 100644
    --- a/spring-boot-tools/spring-boot-antlib/src/main/java/org/springframework/boot/ant/FindMainClass.java
    +++ b/spring-boot-tools/spring-boot-antlib/src/main/java/org/springframework/boot/ant/FindMainClass.java
    @@ -64,15 +64,15 @@ public class FindMainClass extends Task {
     					"one of @mainClass or @classesRoot must be specified");
     		}
     		if (!this.classesRoot.exists()) {
    -			throw new BuildException("@classesRoot " + this.classesRoot
    -					+ " does not exist");
    +			throw new BuildException(
    +					"@classesRoot " + this.classesRoot + " does not exist");
     		}
     		try {
     			if (this.classesRoot.isDirectory()) {
     				return MainClassFinder.findSingleMainClass(this.classesRoot);
     			}
    -			return MainClassFinder
    -					.findSingleMainClass(new JarFile(this.classesRoot), "/");
    +			return MainClassFinder.findSingleMainClass(new JarFile(this.classesRoot),
    +					"/");
     		}
     		catch (IOException ex) {
     			throw new BuildException(ex);
    diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataProperty.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataProperty.java
    index 46499f2547..1c2c602df9 100644
    --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataProperty.java
    +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataProperty.java
    @@ -83,8 +83,8 @@ public class ConfigurationMetadataProperty implements Serializable {
     	 * For consistency, the type of a primitive is specified using its wrapper
     	 * counterpart, i.e. {@code boolean} becomes {@code java.lang.Boolean}. If the type
     	 * holds generic information, these are provided as well, i.e. a {@code HashMap} of
    -	 * String to Integer would be defined as
    -	 * {@code java.util.HashMap}.
    +	 * String to Integer would be defined as {@code java.util.HashMap
    +	 * }.
     	 * 

    * Note that this class may be a complex type that gets converted from a String as * values are bound. diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java index 5949b88ef5..7fa51d4db0 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java @@ -105,16 +105,17 @@ public final class ConfigurationMetadataRepositoryJsonBuilder { return create(metadata); } catch (IOException ex) { - throw new IllegalArgumentException("Failed to read configuration " - + "metadata", ex); + throw new IllegalArgumentException( + "Failed to read configuration " + "metadata", ex); } catch (JSONException ex) { - throw new IllegalArgumentException("Invalid configuration " - + "metadata document", ex); + throw new IllegalArgumentException( + "Invalid configuration " + "metadata document", ex); } } - private SimpleConfigurationMetadataRepository create(RawConfigurationMetadata metadata) { + private SimpleConfigurationMetadataRepository create( + RawConfigurationMetadata metadata) { SimpleConfigurationMetadataRepository repository = new SimpleConfigurationMetadataRepository(); repository.add(metadata.getSources()); for (ConfigurationMetadataItem item : metadata.getItems()) { @@ -170,7 +171,8 @@ public final class ConfigurationMetadataRepositoryJsonBuilder { * @param defaultCharset the default charset to use * @return a new {@link ConfigurationMetadataRepositoryJsonBuilder} instance. */ - public static ConfigurationMetadataRepositoryJsonBuilder create(Charset defaultCharset) { + public static ConfigurationMetadataRepositoryJsonBuilder create( + Charset defaultCharset) { return new ConfigurationMetadataRepositoryJsonBuilder(defaultCharset); } diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/DescriptionExtractor.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/DescriptionExtractor.java index 3b2e9707bb..81a9ff9b4d 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/DescriptionExtractor.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/DescriptionExtractor.java @@ -36,8 +36,8 @@ class DescriptionExtractor { if (dot != -1) { BreakIterator breakIterator = BreakIterator.getSentenceInstance(Locale.US); breakIterator.setText(description); - String text = description.substring(breakIterator.first(), - breakIterator.next()).trim(); + String text = description + .substring(breakIterator.first(), breakIterator.next()).trim(); return removeSpaceBetweenLine(text); } else { diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java index bd966de511..97b33969f2 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java @@ -93,8 +93,8 @@ class JsonReader { source.setType(json.optString("type", null)); String description = json.optString("description", null); source.setDescription(description); - source.setShortDescription(this.descriptionExtractor - .getShortDescription(description)); + source.setShortDescription( + this.descriptionExtractor.getShortDescription(description)); source.setSourceType(json.optString("sourceType", null)); source.setSourceMethod(json.optString("sourceMethod", null)); return source; @@ -106,8 +106,8 @@ class JsonReader { item.setType(json.optString("type", null)); String description = json.optString("description", null); item.setDescription(description); - item.setShortDescription(this.descriptionExtractor - .getShortDescription(description)); + item.setShortDescription( + this.descriptionExtractor.getShortDescription(description)); item.setDefaultValue(readItemValue(json.opt("defaultValue"))); item.setDeprecation(parseDeprecation(json)); item.setSourceType(json.optString("sourceType", null)); @@ -126,8 +126,8 @@ class JsonReader { valueHint.setValue(readItemValue(value.get("value"))); String description = value.optString("description", null); valueHint.setDescription(description); - valueHint.setShortDescription(this.descriptionExtractor - .getShortDescription(description)); + valueHint.setShortDescription( + this.descriptionExtractor.getShortDescription(description)); hint.getValueHints().add(valueHint); } } @@ -157,8 +157,8 @@ class JsonReader { JSONObject deprecationJsonObject = object.getJSONObject("deprecation"); Deprecation deprecation = new Deprecation(); deprecation.setReason(deprecationJsonObject.optString("reason", null)); - deprecation.setReplacement(deprecationJsonObject.optString("replacement", - null)); + deprecation + .setReplacement(deprecationJsonObject.optString("replacement", null)); return deprecation; } return (object.optBoolean("deprecated") ? new Deprecation() : null); diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java index f4057d37ae..ecb10a883a 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java @@ -34,7 +34,8 @@ class RawConfigurationMetadata { private final List hints; RawConfigurationMetadata(List sources, - List items, List hints) { + List items, + List hints) { this.sources = new ArrayList(sources); this.items = new ArrayList(items); this.hints = new ArrayList(hints); diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java index 6a0b4a08dd..e12ec44796 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java @@ -29,8 +29,8 @@ import java.util.Map; * @since 1.3.0 */ @SuppressWarnings("serial") -public class SimpleConfigurationMetadataRepository implements - ConfigurationMetadataRepository, Serializable { +public class SimpleConfigurationMetadataRepository + implements ConfigurationMetadataRepository, Serializable { private final Map allGroups = new HashMap(); diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueHint.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueHint.java index d303b66876..48d5260a07 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueHint.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueHint.java @@ -74,7 +74,7 @@ public class ValueHint implements Serializable { @Override public String toString() { - return "ValueHint{" + "value=" + this.value + ", description='" - + this.description + '\'' + '}'; + return "ValueHint{" + "value=" + this.value + ", description='" + this.description + + '\'' + '}'; } } diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueProvider.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueProvider.java index e7d4032528..550181ee91 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueProvider.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueProvider.java @@ -59,8 +59,8 @@ public class ValueProvider implements Serializable { @Override public String toString() { - return "ValueProvider{" + "name='" + this.name + ", parameters=" - + this.parameters + '}'; + return "ValueProvider{" + "name='" + this.name + ", parameters=" + this.parameters + + '}'; } } diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/AbstractConfigurationMetadataTests.java b/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/AbstractConfigurationMetadataTests.java index 0f0c6c4062..fdc609fbfd 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/AbstractConfigurationMetadataTests.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/AbstractConfigurationMetadataTests.java @@ -61,8 +61,8 @@ public abstract class AbstractConfigurationMetadataTests { } protected InputStream getInputStreamFor(String name) throws IOException { - Resource r = new ClassPathResource("metadata/configuration-metadata-" + name - + ".json"); + Resource r = new ClassPathResource( + "metadata/configuration-metadata-" + name + ".json"); return r.getInputStream(); } diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java b/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java index 7880a19455..1107e51ce9 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java @@ -31,8 +31,8 @@ import static org.junit.Assert.assertTrue; * * @author Stephane Nicoll */ -public class ConfigurationMetadataRepositoryJsonBuilderTests extends - AbstractConfigurationMetadataTests { +public class ConfigurationMetadataRepositoryJsonBuilderTests + extends AbstractConfigurationMetadataTests { @Test public void nullResource() throws IOException { @@ -48,8 +48,8 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends .create(foo).build(); validateFoo(repo); assertEquals(1, repo.getAllGroups().size()); - contains(repo.getAllProperties(), "spring.foo.name", - "spring.foo.description", "spring.foo.counter"); + contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", + "spring.foo.counter"); assertEquals(3, repo.getAllProperties().size()); } finally { @@ -67,9 +67,9 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends validateFoo(repo); validateBar(repo); assertEquals(2, repo.getAllGroups().size()); - contains(repo.getAllProperties(), "spring.foo.name", - "spring.foo.description", "spring.foo.counter", "spring.bar.name", - "spring.bar.description", "spring.bar.counter"); + contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", + "spring.foo.counter", "spring.bar.name", "spring.bar.description", + "spring.bar.counter"); assertEquals(6, repo.getAllProperties().size()); } finally { @@ -88,9 +88,8 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends validateFoo(repo); assertEquals(2, repo.getAllGroups().size()); - contains(repo.getAllProperties(), "spring.foo.name", - "spring.foo.description", "spring.foo.counter", "spring.root.name", - "spring.root2.name"); + contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", + "spring.foo.counter", "spring.root.name", "spring.root2.name"); assertEquals(5, repo.getAllProperties().size()); } finally { @@ -114,9 +113,8 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends contains(group.getProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter", "spring.foo.enabled", "spring.foo.type"); assertEquals(5, group.getProperties().size()); - contains(repo.getAllProperties(), "spring.foo.name", - "spring.foo.description", "spring.foo.counter", "spring.foo.enabled", - "spring.foo.type"); + contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", + "spring.foo.counter", "spring.foo.enabled", "spring.foo.type"); assertEquals(5, repo.getAllProperties().size()); } finally { @@ -159,12 +157,13 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends ConfigurationMetadataSource source = group.getSources().get("org.acme.Foo"); contains(source.getProperties(), "spring.foo.name", "spring.foo.description"); assertEquals(2, source.getProperties().size()); - ConfigurationMetadataSource source2 = group.getSources().get( - "org.springframework.boot.FooProperties"); + ConfigurationMetadataSource source2 = group.getSources() + .get("org.springframework.boot.FooProperties"); contains(source2.getProperties(), "spring.foo.name", "spring.foo.counter"); assertEquals(2, source2.getProperties().size()); validatePropertyHints(repo.getAllProperties().get("spring.foo.name"), 0, 0); - validatePropertyHints(repo.getAllProperties().get("spring.foo.description"), 0, 0); + validatePropertyHints(repo.getAllProperties().get("spring.foo.description"), 0, + 0); validatePropertyHints(repo.getAllProperties().get("spring.foo.counter"), 1, 1); } @@ -175,12 +174,13 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends ConfigurationMetadataSource source = group.getSources().get("org.acme.Bar"); contains(source.getProperties(), "spring.bar.name", "spring.bar.description"); assertEquals(2, source.getProperties().size()); - ConfigurationMetadataSource source2 = group.getSources().get( - "org.springframework.boot.BarProperties"); + ConfigurationMetadataSource source2 = group.getSources() + .get("org.springframework.boot.BarProperties"); contains(source2.getProperties(), "spring.bar.name", "spring.bar.counter"); assertEquals(2, source2.getProperties().size()); validatePropertyHints(repo.getAllProperties().get("spring.bar.name"), 0, 0); - validatePropertyHints(repo.getAllProperties().get("spring.bar.description"), 2, 2); + validatePropertyHints(repo.getAllProperties().get("spring.bar.description"), 2, + 2); validatePropertyHints(repo.getAllProperties().get("spring.bar.counter"), 0, 0); } diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/DescriptionExtractorTests.java b/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/DescriptionExtractorTests.java index 6f0ae5b1d2..e1ba457684 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/DescriptionExtractorTests.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/DescriptionExtractorTests.java @@ -33,22 +33,22 @@ public class DescriptionExtractorTests { @Test public void extractShortDescription() { - String description = this.extractor.getShortDescription("My short " - + "description. More stuff."); + String description = this.extractor + .getShortDescription("My short " + "description. More stuff."); assertEquals("My short description.", description); } @Test public void extractShortDescriptionNewLineBeforeDot() { - String description = this.extractor.getShortDescription("My short" + NEW_LINE - + "description." + NEW_LINE + "More stuff."); + String description = this.extractor.getShortDescription( + "My short" + NEW_LINE + "description." + NEW_LINE + "More stuff."); assertEquals("My short description.", description); } @Test public void extractShortDescriptionNewLineBeforeDotWithSpaces() { - String description = this.extractor.getShortDescription("My short " + NEW_LINE - + " description. " + NEW_LINE + "More stuff."); + String description = this.extractor.getShortDescription( + "My short " + NEW_LINE + " description. " + NEW_LINE + "More stuff."); assertEquals("My short description.", description); } @@ -60,8 +60,8 @@ public class DescriptionExtractorTests { @Test public void extractShortDescriptionNoDotMultipleLines() { - String description = this.extractor.getShortDescription("My short description " - + NEW_LINE + " More stuff"); + String description = this.extractor + .getShortDescription("My short description " + NEW_LINE + " More stuff"); assertEquals("My short description", description); } diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/JsonReaderTests.java b/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/JsonReaderTests.java index cb0f7681f6..ce75549d21 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/JsonReaderTests.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/JsonReaderTests.java @@ -92,7 +92,8 @@ public class JsonReaderTests extends AbstractConfigurationMetadataTests { ValueProvider valueProvider = hint.getValueProviders().get(0); assertEquals("handle-as", valueProvider.getName()); assertEquals(1, valueProvider.getParameters().size()); - assertEquals(Integer.class.getName(), valueProvider.getParameters().get("target")); + assertEquals(Integer.class.getName(), + valueProvider.getParameters().get("target")); } @Test @@ -141,8 +142,8 @@ public class JsonReaderTests extends AbstractConfigurationMetadataTests { ConfigurationMetadataItem item = items.get(0); assertProperty(item, "server.port", "server.port", Integer.class, null); assertTrue(item.isDeprecated()); - assertEquals("Server namespace has moved to spring.server", item.getDeprecation() - .getReason()); + assertEquals("Server namespace has moved to spring.server", + item.getDeprecation().getReason()); assertEquals("server.spring.port", item.getDeprecation().getReplacement()); ConfigurationMetadataItem item2 = items.get(1); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java index f15e7b15d1..a0611b6214 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java @@ -169,13 +169,13 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor private void processExecutableElement(String prefix, ExecutableElement element) { if (element.getModifiers().contains(Modifier.PUBLIC) && (TypeKind.VOID != element.getReturnType().getKind())) { - Element returns = this.processingEnv.getTypeUtils().asElement( - element.getReturnType()); + Element returns = this.processingEnv.getTypeUtils() + .asElement(element.getReturnType()); if (returns instanceof TypeElement) { - this.metadataCollector.add(ItemMetadata.newGroup(prefix, - this.typeUtils.getType(returns), - this.typeUtils.getType(element.getEnclosingElement()), - element.toString())); + this.metadataCollector.add( + ItemMetadata.newGroup(prefix, this.typeUtils.getType(returns), + this.typeUtils.getType(element.getEnclosingElement()), + element.toString())); processTypeElement(prefix, (TypeElement) returns); } } @@ -207,8 +207,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor ExecutableElement setter = members.getPublicSetters().get(name); VariableElement field = members.getFields().get(name); TypeMirror returnType = getter.getReturnType(); - Element returnTypeElement = this.processingEnv.getTypeUtils().asElement( - returnType); + Element returnTypeElement = this.processingEnv.getTypeUtils() + .asElement(returnType); boolean isExcluded = this.typeExcludeFilter.isExcluded(returnType); boolean isNested = isNested(returnTypeElement, field, element); boolean isCollection = this.typeUtils.isCollectionOrMap(returnType); @@ -249,8 +249,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor continue; } TypeMirror returnType = field.asType(); - Element returnTypeElement = this.processingEnv.getTypeUtils().asElement( - returnType); + Element returnTypeElement = this.processingEnv.getTypeUtils() + .asElement(returnType); boolean isExcluded = this.typeExcludeFilter.isExcluded(returnType); boolean isNested = isNested(returnTypeElement, field, element); boolean isCollection = this.typeUtils.isCollectionOrMap(returnType); @@ -277,8 +277,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor private boolean hasLombokSetter(VariableElement field, TypeElement element) { return !field.getModifiers().contains(Modifier.FINAL) && (hasAnnotation(field, LOMBOK_SETTER_ANNOTATION) - || hasAnnotation(element, LOMBOK_SETTER_ANNOTATION) || hasAnnotation( - element, LOMBOK_DATA_ANNOTATION)); + || hasAnnotation(element, LOMBOK_SETTER_ANNOTATION) + || hasAnnotation(element, LOMBOK_DATA_ANNOTATION)); } private void processNestedTypes(String prefix, TypeElement element, @@ -288,8 +288,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor String name = entry.getKey(); ExecutableElement getter = entry.getValue(); VariableElement field = members.getFields().get(name); - Element returnType = this.processingEnv.getTypeUtils().asElement( - getter.getReturnType()); + Element returnType = this.processingEnv.getTypeUtils() + .asElement(getter.getReturnType()); AnnotationMirror annotation = getAnnotation(getter, configurationPropertiesAnnotation()); boolean isNested = isNested(returnType, field, element); @@ -350,8 +350,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor Map values = new LinkedHashMap(); for (Map.Entry entry : annotation .getElementValues().entrySet()) { - values.put(entry.getKey().getSimpleName().toString(), entry.getValue() - .getValue()); + values.put(entry.getKey().getSimpleName().toString(), + entry.getValue().getValue()); } return values; } @@ -371,7 +371,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor return null; } - private ConfigurationMetadata mergeAdditionalMetadata(ConfigurationMetadata metadata) { + private ConfigurationMetadata mergeAdditionalMetadata( + ConfigurationMetadata metadata) { try { ConfigurationMetadata merged = new ConfigurationMetadata(metadata); merged.merge(this.metadataStore.readAdditionalMetadata()); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java index 58ae1cbe8f..d0a2d03af7 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java @@ -89,7 +89,8 @@ public class MetadataStore { catch (JSONException ex) { throw new InvalidConfigurationMetadataException( "Invalid additional meta-data in '" + METADATA_PATH + "': " - + ex.getMessage(), Diagnostic.Kind.ERROR); + + ex.getMessage(), + Diagnostic.Kind.ERROR); } finally { in.close(); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/ExpressionTree.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/ExpressionTree.java index f9f09b1564..a8e991feef 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/ExpressionTree.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/ExpressionTree.java @@ -31,14 +31,17 @@ class ExpressionTree extends ReflectionWrapper { private final Class literalTreeType = findClass("com.sun.source.tree.LiteralTree"); - private final Method literalValueMethod = findMethod(this.literalTreeType, "getValue"); + private final Method literalValueMethod = findMethod(this.literalTreeType, + "getValue"); - private final Class methodInvocationTreeType = findClass("com.sun.source.tree.MethodInvocationTree"); + private final Class methodInvocationTreeType = findClass( + "com.sun.source.tree.MethodInvocationTree"); private final Method methodInvocationArgumentsMethod = findMethod( this.methodInvocationTreeType, "getArguments"); - private final Class newArrayTreeType = findClass("com.sun.source.tree.NewArrayTree"); + private final Class newArrayTreeType = findClass( + "com.sun.source.tree.NewArrayTree"); private final Method arrayValueMethod = findMethod(this.newArrayTreeType, "getInitializers"); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java index 2fdd46cf5e..c9e7b93f5d 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java @@ -179,7 +179,8 @@ public class ConfigurationMetadata { return first + "-" + second; } - private static > List flattenValues(MultiValueMap map) { + private static > List flattenValues( + MultiValueMap map) { List content = new ArrayList(); for (List values : map.values()) { content.addAll(values); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java index b247a9bb45..8aff946951 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java @@ -221,8 +221,8 @@ public class JsonMarshaller { JSONObject deprecationJsonObject = object.getJSONObject("deprecation"); ItemDeprecation deprecation = new ItemDeprecation(); deprecation.setReason(deprecationJsonObject.optString("reason", null)); - deprecation.setReplacement(deprecationJsonObject.optString("replacement", - null)); + deprecation + .setReplacement(deprecationJsonObject.optString("replacement", null)); return deprecation; } return (object.optBoolean("deprecated") ? new ItemDeprecation() : null); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java index 2e8fddd96e..44e9d3eca8 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java @@ -103,14 +103,12 @@ public class ConfigurationMetadataAnnotationProcessorTests { public void simpleProperties() throws Exception { ConfigurationMetadata metadata = compile(SimpleProperties.class); assertThat(metadata, containsGroup("simple").fromSource(SimpleProperties.class)); - assertThat( - metadata, + assertThat(metadata, containsProperty("simple.the-name", String.class) .fromSource(SimpleProperties.class) .withDescription("The name of this simple properties.") .withDefaultValue(is("boot")).withDeprecation(null, null)); - assertThat( - metadata, + assertThat(metadata, containsProperty("simple.flag", Boolean.class) .fromSource(SimpleProperties.class) .withDescription("A simple flag.").withDeprecation(null, null)); @@ -124,10 +122,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { ConfigurationMetadata metadata = compile(SimplePrefixValueProperties.class); assertThat(metadata, containsGroup("simple").fromSource(SimplePrefixValueProperties.class)); - assertThat( - metadata, - containsProperty("simple.name", String.class).fromSource( - SimplePrefixValueProperties.class)); + assertThat(metadata, containsProperty("simple.name", String.class) + .fromSource(SimplePrefixValueProperties.class)); } @Test @@ -195,77 +191,57 @@ public class ConfigurationMetadataAnnotationProcessorTests { assertThat(metadata, containsGroup("singledeprecated").fromSource(type)); assertThat(metadata, containsProperty("singledeprecated.new-name", String.class) .fromSource(type)); - assertThat(metadata, containsProperty("singledeprecated.name", String.class) - .fromSource(type).withDeprecation("renamed", "singledeprecated.new-name")); + assertThat(metadata, + containsProperty("singledeprecated.name", String.class).fromSource(type) + .withDeprecation("renamed", "singledeprecated.new-name")); } @Test public void parseCollectionConfig() throws Exception { ConfigurationMetadata metadata = compile(SimpleCollectionProperties.class); // getter and setter - assertThat( - metadata, - containsProperty("collection.integers-to-names", - "java.util.Map")); - assertThat( - metadata, - containsProperty("collection.longs", - "java.util.Collection")); + assertThat(metadata, containsProperty("collection.integers-to-names", + "java.util.Map")); + assertThat(metadata, containsProperty("collection.longs", + "java.util.Collection")); assertThat(metadata, containsProperty("collection.floats", "java.util.List")); // getter only - assertThat( - metadata, - containsProperty("collection.names-to-integers", - "java.util.Map")); - assertThat( - metadata, - containsProperty("collection.bytes", - "java.util.Collection")); - assertThat( - metadata, - containsProperty("collection.doubles", "java.util.List")); + assertThat(metadata, containsProperty("collection.names-to-integers", + "java.util.Map")); + assertThat(metadata, containsProperty("collection.bytes", + "java.util.Collection")); + assertThat(metadata, containsProperty("collection.doubles", + "java.util.List")); } @Test public void simpleMethodConfig() throws Exception { ConfigurationMetadata metadata = compile(SimpleMethodConfig.class); assertThat(metadata, containsGroup("foo").fromSource(SimpleMethodConfig.class)); - assertThat( - metadata, - containsProperty("foo.name", String.class).fromSource( - SimpleMethodConfig.Foo.class)); - assertThat( - metadata, - containsProperty("foo.flag", Boolean.class).fromSource( - SimpleMethodConfig.Foo.class)); + assertThat(metadata, containsProperty("foo.name", String.class) + .fromSource(SimpleMethodConfig.Foo.class)); + assertThat(metadata, containsProperty("foo.flag", Boolean.class) + .fromSource(SimpleMethodConfig.Foo.class)); } @Test public void invalidMethodConfig() throws Exception { ConfigurationMetadata metadata = compile(InvalidMethodConfig.class); - assertThat( - metadata, - containsProperty("something.name", String.class).fromSource( - InvalidMethodConfig.class)); + assertThat(metadata, containsProperty("something.name", String.class) + .fromSource(InvalidMethodConfig.class)); assertThat(metadata, not(containsProperty("invalid.name"))); } @Test public void methodAndClassConfig() throws Exception { ConfigurationMetadata metadata = compile(MethodAndClassConfig.class); - assertThat( - metadata, - containsProperty("conflict.name", String.class).fromSource( - MethodAndClassConfig.Foo.class)); - assertThat( - metadata, - containsProperty("conflict.flag", Boolean.class).fromSource( - MethodAndClassConfig.Foo.class)); - assertThat( - metadata, - containsProperty("conflict.value", String.class).fromSource( - MethodAndClassConfig.class)); + assertThat(metadata, containsProperty("conflict.name", String.class) + .fromSource(MethodAndClassConfig.Foo.class)); + assertThat(metadata, containsProperty("conflict.flag", Boolean.class) + .fromSource(MethodAndClassConfig.Foo.class)); + assertThat(metadata, containsProperty("conflict.value", String.class) + .fromSource(MethodAndClassConfig.class)); } @Test @@ -342,7 +318,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { @Test public void lombokExplicitProperties() throws Exception { ConfigurationMetadata metadata = compile(LombokExplicitProperties.class); - assertSimpleLombokProperties(metadata, LombokExplicitProperties.class, "explicit"); + assertSimpleLombokProperties(metadata, LombokExplicitProperties.class, + "explicit"); } @Test @@ -352,9 +329,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { writeAdditionalMetadata(property); ConfigurationMetadata metadata = compile(SimpleProperties.class); assertThat(metadata, containsProperty("simple.comparator")); - assertThat(metadata, - containsProperty("foo", String.class) - .fromSource(AdditionalMetadata.class)); + assertThat(metadata, containsProperty("foo", String.class) + .fromSource(AdditionalMetadata.class)); } @Test @@ -363,8 +339,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { null, null, true, null); writeAdditionalMetadata(property); ConfigurationMetadata metadata = compile(SimpleProperties.class); - assertThat( - metadata, + assertThat(metadata, containsProperty("simple.flag", Boolean.class) .fromSource(SimpleProperties.class) .withDescription("A simple flag.").withDefaultValue(is(true))); @@ -377,41 +352,38 @@ public class ConfigurationMetadataAnnotationProcessorTests { null, null, "A nice comparator.", null, null); writeAdditionalMetadata(property); ConfigurationMetadata metadata = compile(SimpleProperties.class); - assertThat( - metadata, + assertThat(metadata, containsProperty("simple.comparator", "java.util.Comparator") - .fromSource(SimpleProperties.class).withDescription( - "A nice comparator.")); + .fromSource(SimpleProperties.class) + .withDescription("A nice comparator.")); assertThat(metadata.getItems().size(), is(4)); } @Test public void mergeExistingPropertyDeprecation() throws Exception { ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null, - null, null, null, null, new ItemDeprecation("Don't use this.", - "simple.complex-comparator")); + null, null, null, null, + new ItemDeprecation("Don't use this.", "simple.complex-comparator")); writeAdditionalMetadata(property); ConfigurationMetadata metadata = compile(SimpleProperties.class); - assertThat( - metadata, + assertThat(metadata, containsProperty("simple.comparator", "java.util.Comparator") - .fromSource(SimpleProperties.class).withDeprecation( - "Don't use this.", "simple.complex-comparator")); + .fromSource(SimpleProperties.class) + .withDeprecation("Don't use this.", "simple.complex-comparator")); assertThat(metadata.getItems().size(), is(4)); } @Test public void mergeExistingPropertyDeprecationOverride() throws Exception { - ItemMetadata property = ItemMetadata.newProperty("singledeprecated", "name", - null, null, null, null, null, new ItemDeprecation("Don't use this.", - "single.name")); + ItemMetadata property = ItemMetadata.newProperty("singledeprecated", "name", null, + null, null, null, null, + new ItemDeprecation("Don't use this.", "single.name")); writeAdditionalMetadata(property); ConfigurationMetadata metadata = compile(DeprecatedSingleProperty.class); - assertThat( - metadata, + assertThat(metadata, containsProperty("singledeprecated.name", String.class.getName()) - .fromSource(DeprecatedSingleProperty.class).withDeprecation( - "Don't use this.", "single.name")); + .fromSource(DeprecatedSingleProperty.class) + .withDeprecation("Don't use this.", "single.name")); assertThat(metadata.getItems().size(), is(3)); } @@ -427,27 +399,25 @@ public class ConfigurationMetadataAnnotationProcessorTests { @Test public void mergingOfSimpleHint() throws Exception { - writeAdditionalHints(ItemHint.newHint("simple.the-name", new ItemHint.ValueHint( - "boot", "Bla bla"), new ItemHint.ValueHint("spring", null))); + writeAdditionalHints(ItemHint.newHint("simple.the-name", + new ItemHint.ValueHint("boot", "Bla bla"), + new ItemHint.ValueHint("spring", null))); ConfigurationMetadata metadata = compile(SimpleProperties.class); - assertThat( - metadata, + assertThat(metadata, containsProperty("simple.the-name", String.class) .fromSource(SimpleProperties.class) .withDescription("The name of this simple properties.") .withDefaultValue(is("boot")).withDeprecation(null, null)); - assertThat(metadata, - containsHint("simple.the-name").withValue(0, "boot", "Bla bla") - .withValue(1, "spring", null)); + assertThat(metadata, containsHint("simple.the-name") + .withValue(0, "boot", "Bla bla").withValue(1, "spring", null)); } @Test public void mergingOfHintWithNonCanonicalName() throws Exception { - writeAdditionalHints(ItemHint.newHint("simple.theName", new ItemHint.ValueHint( - "boot", "Bla bla"))); + writeAdditionalHints(ItemHint.newHint("simple.theName", + new ItemHint.ValueHint("boot", "Bla bla"))); ConfigurationMetadata metadata = compile(SimpleProperties.class); - assertThat( - metadata, + assertThat(metadata, containsProperty("simple.the-name", String.class) .fromSource(SimpleProperties.class) .withDescription("The name of this simple properties.") @@ -459,28 +429,27 @@ public class ConfigurationMetadataAnnotationProcessorTests { @Test public void mergingOfHintWithProvider() throws Exception { writeAdditionalHints(new ItemHint("simple.theName", - Collections.emptyList(), Arrays.asList( - new ItemHint.ValueProvider("first", Collections - .singletonMap("target", "org.foo")), + Collections.emptyList(), + Arrays.asList( + new ItemHint.ValueProvider("first", + Collections.singletonMap("target", + "org.foo")), new ItemHint.ValueProvider("second", null)))); ConfigurationMetadata metadata = compile(SimpleProperties.class); - assertThat( - metadata, + assertThat(metadata, containsProperty("simple.the-name", String.class) .fromSource(SimpleProperties.class) .withDescription("The name of this simple properties.") .withDefaultValue(is("boot")).withDeprecation(null, null)); - assertThat(metadata, - containsHint("simple.the-name") - .withProvider("first", "target", "org.foo") - .withProvider("second")); + assertThat(metadata, containsHint("simple.the-name") + .withProvider("first", "target", "org.foo").withProvider("second")); } @Test public void mergingOfAdditionalDeprecation() throws Exception { writePropertyDeprecation(ItemMetadata.newProperty("simple", "wrongName", - "java.lang.String", null, null, null, null, new ItemDeprecation( - "Lame name.", "simple.the-name"))); + "java.lang.String", null, null, null, null, + new ItemDeprecation("Lame name.", "simple.the-name"))); ConfigurationMetadata metadata = compile(SimpleProperties.class); assertThat(metadata, containsProperty("simple.wrong-name", String.class) .withDeprecation("Lame name.", "simple.the-name")); @@ -545,9 +514,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { containsProperty("foo.counter").fromSource(FooProperties.class)); assertThat(metadata, containsProperty("bar.counter").fromSource(BarProperties.class)); - assertThat(metadata, - not(containsProperty("bar.counter") - .fromSource(RenamedBarProperties.class))); + assertThat(metadata, not( + containsProperty("bar.counter").fromSource(RenamedBarProperties.class))); project.delete(BarProperties.class); project.add(RenamedBarProperties.class); @@ -564,9 +532,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { Class source, String prefix) { assertThat(metadata, containsGroup(prefix).fromSource(source)); assertThat(metadata, not(containsProperty(prefix + ".id"))); - assertThat(metadata, - containsProperty(prefix + ".name", String.class).fromSource(source) - .withDescription("Name description.")); + assertThat(metadata, containsProperty(prefix + ".name", String.class) + .fromSource(source).withDescription("Name description.")); assertThat(metadata, containsProperty(prefix + ".description")); assertThat(metadata, containsProperty(prefix + ".counter")); assertThat(metadata, containsProperty(prefix + ".number").fromSource(source) @@ -634,7 +601,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { return additionalMetadataFile; } - private void writeMetadata(File metadataFile, JSONObject metadata) throws IOException { + private void writeMetadata(File metadataFile, JSONObject metadata) + throws IOException { FileWriter writer = new FileWriter(metadataFile); try { metadata.write(writer); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataMatchers.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataMatchers.java index 94cb710388..cc4d41a236 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataMatchers.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataMatchers.java @@ -136,12 +136,12 @@ public final class ConfigurationMetadataMatchers { ConfigurationMetadata metadata = (ConfigurationMetadata) item; ItemMetadata property = getFirstItemWithName(metadata, this.name); if (property == null) { - description.appendText("missing " - + this.itemType.toString().toLowerCase() + " " + this.name); + description.appendText("missing " + this.itemType.toString().toLowerCase() + + " " + this.name); } else { - description.appendText( - "was " + this.itemType.toString().toLowerCase() + " ") + description + .appendText("was " + this.itemType.toString().toLowerCase() + " ") .appendValue(property); } } @@ -274,7 +274,8 @@ public final class ConfigurationMetadataMatchers { } } - public ContainsHintMatcher withValue(int index, Object value, String description) { + public ContainsHintMatcher withValue(int index, Object value, + String description) { List values = new ArrayList(this.values); values.add(new ValueHintMatcher(index, value, description)); return new ContainsHintMatcher(this.name, values, this.providers); @@ -288,7 +289,8 @@ public final class ConfigurationMetadataMatchers { return new ContainsHintMatcher(this.name, this.values, providers); } - public ContainsHintMatcher withProvider(String provider, String key, Object value) { + public ContainsHintMatcher withProvider(String provider, String key, + Object value) { return withProvider(this.providers.size(), provider, Collections.singletonMap(key, value)); } @@ -297,7 +299,8 @@ public final class ConfigurationMetadataMatchers { return withProvider(this.providers.size(), provider, null); } - private ItemHint getFirstHintWithName(ConfigurationMetadata metadata, String name) { + private ItemHint getFirstHintWithName(ConfigurationMetadata metadata, + String name) { for (ItemHint hint : metadata.getHints()) { if (name.equals(hint.getName())) { return hint; @@ -357,7 +360,8 @@ public final class ConfigurationMetadataMatchers { private final String name; private final Map parameters; - public ValueProviderMatcher(int index, String name, Map parameters) { + public ValueProviderMatcher(int index, String name, + Map parameters) { this.index = index; this.name = name; this.parameters = parameters; diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshallerTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshallerTests.java index 81b2dafe69..820794eb16 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshallerTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshallerTests.java @@ -45,12 +45,12 @@ public class JsonMarshallerTests { metadata.add(ItemMetadata.newProperty("a", "b", StringBuffer.class.getName(), InputStream.class.getName(), "sourceMethod", "desc", "x", new ItemDeprecation("Deprecation comment", "b.c.d"))); - metadata.add(ItemMetadata.newProperty("b.c.d", null, null, null, null, null, - null, null)); - metadata.add(ItemMetadata.newProperty("c", null, null, null, null, null, 123, - null)); - metadata.add(ItemMetadata.newProperty("d", null, null, null, null, null, true, + metadata.add(ItemMetadata.newProperty("b.c.d", null, null, null, null, null, null, null)); + metadata.add( + ItemMetadata.newProperty("c", null, null, null, null, null, 123, null)); + metadata.add( + ItemMetadata.newProperty("d", null, null, null, null, null, true, null)); metadata.add(ItemMetadata.newProperty("e", null, null, null, null, null, new String[] { "y", "n" }, null)); metadata.add(ItemMetadata.newProperty("f", null, null, null, null, null, @@ -59,14 +59,17 @@ public class JsonMarshallerTests { metadata.add(ItemHint.newHint("a.b")); metadata.add(ItemHint.newHint("c", new ItemHint.ValueHint(123, "hey"), new ItemHint.ValueHint(456, null))); - metadata.add(new ItemHint("d", null, Arrays.asList(new ItemHint.ValueProvider( - "first", Collections.singletonMap("target", "foo")), + metadata.add(new ItemHint("d", null, + Arrays.asList( + new ItemHint.ValueProvider("first", + Collections.singletonMap("target", + "foo")), new ItemHint.ValueProvider("second", null)))); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); JsonMarshaller marshaller = new JsonMarshaller(); marshaller.write(metadata, outputStream); - ConfigurationMetadata read = marshaller.read(new ByteArrayInputStream( - outputStream.toByteArray())); + ConfigurationMetadata read = marshaller + .read(new ByteArrayInputStream(outputStream.toByteArray())); assertThat(read, containsProperty("a.b", StringBuffer.class).fromSource(InputStream.class) .withDescription("desc").withDefaultValue(is("x")) @@ -76,8 +79,8 @@ public class JsonMarshallerTests { assertThat(read, containsProperty("d").withDefaultValue(is(true))); assertThat(read, containsProperty("e").withDefaultValue(is(new String[] { "y", "n" }))); - assertThat(read, - containsProperty("f").withDefaultValue(is(new boolean[] { true, false }))); + assertThat(read, containsProperty("f") + .withDefaultValue(is(new boolean[] { true, false }))); assertThat(read, containsGroup("d")); assertThat(read, containsHint("a.b")); assertThat(read, diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java index c1b7aae929..0643a4afc9 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java @@ -76,8 +76,8 @@ public class JarWriter { * @throws IOException if the file cannot be opened * @throws FileNotFoundException if the file cannot be found */ - public JarWriter(File file, LaunchScript launchScript) throws FileNotFoundException, - IOException { + public JarWriter(File file, LaunchScript launchScript) + throws FileNotFoundException, IOException { FileOutputStream fileOutputStream = new FileOutputStream(file); if (launchScript != null) { fileOutputStream.write(launchScript.toByteArray()); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java index 6391e94fe9..bbe27db7e4 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java @@ -118,8 +118,8 @@ public class Repackager { * @throws IOException if the file cannot be repackaged * @since 1.3.0 */ - public void repackage(File destination, Libraries libraries, LaunchScript launchScript) - throws IOException { + public void repackage(File destination, Libraries libraries, + LaunchScript launchScript) throws IOException { if (destination == null || destination.isDirectory()) { throw new IllegalArgumentException("Invalid destination"); } diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java index e40c698490..4cef7b9d36 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java @@ -55,7 +55,8 @@ public class RunProcess { return run(waitForProcess, Arrays.asList(args)); } - protected int run(boolean waitForProcess, Collection args) throws IOException { + protected int run(boolean waitForProcess, Collection args) + throws IOException { ProcessBuilder builder = new ProcessBuilder(this.command); builder.command().addAll(args); builder.redirectErrorStream(true); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java index 244c9850d1..6cd51d5ba6 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java @@ -62,6 +62,7 @@ public class RepackagerTests { private static final long JAN_1_1980; private static final long JAN_1_1985; + static { Calendar calendar = Calendar.getInstance(); calendar.set(1980, 0, 1, 0, 0, 0); @@ -303,8 +304,8 @@ public class RepackagerTests { @Override public void doWithLibraries(LibraryCallback callback) throws IOException { callback.library(new Library(libJarFile, LibraryScope.COMPILE)); - callback.library(new Library(libJarFileToUnpack, LibraryScope.COMPILE, - true)); + callback.library( + new Library(libJarFileToUnpack, LibraryScope.COMPILE, true)); callback.library(new Library(libNonJarFile, LibraryScope.COMPILE)); } }); @@ -368,9 +369,8 @@ public class RepackagerTests { Repackager repackager = new Repackager(file); repackager.repackage(NO_LIBRARIES); Manifest actualManifest = getManifest(file); - assertThat( - actualManifest.getMainAttributes().containsKey( - new Attributes.Name("Spring-Boot-Version")), equalTo(true)); + assertThat(actualManifest.getMainAttributes() + .containsKey(new Attributes.Name("Spring-Boot-Version")), equalTo(true)); } @Test @@ -431,7 +431,8 @@ public class RepackagerTests { } @Test - public void unpackLibrariesTakePrecedenceOverExistingSourceEntries() throws Exception { + public void unpackLibrariesTakePrecedenceOverExistingSourceEntries() + throws Exception { TestJarFile nested = new TestJarFile(this.temporaryFolder); nested.addClass("a/b/C.class", ClassWithoutMainMethod.class); final File nestedFile = nested.getFile(); diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java index 3ec99a16e0..93dac69a62 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java @@ -325,7 +325,8 @@ public class JarFile extends java.util.jar.JarFile implements Iterable action) throws Exception { + private void doWithTccl(ClassLoader classLoader, Callable action) + throws Exception { ClassLoader old = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(classLoader); @@ -101,8 +102,8 @@ public class ExecutableArchiveLauncherTests { } } - private static final class UnitTestExecutableArchiveLauncher extends - ExecutableArchiveLauncher { + private static final class UnitTestExecutableArchiveLauncher + extends ExecutableArchiveLauncher { UnitTestExecutableArchiveLauncher(JavaAgentDetector javaAgentDetector) { super(javaAgentDetector); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index f734cb3845..e621ebc7a2 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -144,7 +144,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { * @return {@code true} if the application process should be forked */ protected boolean isFork() { - return (Boolean.TRUE.equals(this.fork) || (this.fork == null && (hasAgent() || hasJvmArgs()))); + return (Boolean.TRUE.equals(this.fork) + || (this.fork == null && (hasAgent() || hasJvmArgs()))); } private boolean hasAgent() { @@ -171,7 +172,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { } CodeSource source = loaded.getProtectionDomain().getCodeSource(); if (source != null) { - this.agent = new File[] { new File(source.getLocation().getFile()) }; + this.agent = new File[] { + new File(source.getLocation().getFile()) }; } } } @@ -184,8 +186,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { } } - private void run(String startClassName) throws MojoExecutionException, - MojoFailureException { + private void run(String startClassName) + throws MojoExecutionException, MojoFailureException { findAgent(); if (isFork()) { doRunWithForkedJvm(startClassName); @@ -195,16 +197,15 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { getLog().warn("Fork mode disabled, ignoring agent"); } if (hasJvmArgs()) { - getLog().warn( - "Fork mode disabled, ignoring JVM argument(s) [" - + this.jvmArguments + "]"); + getLog().warn("Fork mode disabled, ignoring JVM argument(s) [" + + this.jvmArguments + "]"); } runWithMavenJvm(startClassName, resolveApplicationArguments().asArray()); } } - private void doRunWithForkedJvm(String startClassName) throws MojoExecutionException, - MojoFailureException { + private void doRunWithForkedJvm(String startClassName) + throws MojoExecutionException, MojoFailureException { List args = new ArrayList(); addAgents(args); addJvmArgs(args); @@ -277,8 +278,9 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { try { StringBuilder classpath = new StringBuilder(); for (URL ele : getClassPathUrls()) { - classpath = classpath.append((classpath.length() > 0 ? File.pathSeparator - : "") + new File(ele.toURI())); + classpath = classpath + .append((classpath.length() > 0 ? File.pathSeparator : "") + + new File(ele.toURI())); } getLog().debug("Classpath for forked process: " + classpath); args.add("-cp"); @@ -346,11 +348,12 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { urls.add(this.classesDirectory.toURI().toURL()); } - private void addDependencies(List urls) throws MalformedURLException, - MojoExecutionException { + private void addDependencies(List urls) + throws MalformedURLException, MojoExecutionException { FilterArtifacts filters = this.useTestClasspath ? getFilters() : getFilters(new TestArtifactFilter()); - Set artifacts = filterDependencies(this.project.getArtifacts(), filters); + Set artifacts = filterDependencies(this.project.getArtifacts(), + filters); for (Artifact artifact : artifacts) { if (artifact.getFile() != null) { urls.add(artifact.getFile().toURI().toURL()); @@ -400,7 +403,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { } } - public synchronized void rethrowUncaughtException() throws MojoExecutionException { + public synchronized void rethrowUncaughtException() + throws MojoExecutionException { if (this.exception != null) { throw new MojoExecutionException("An exception occured while running. " + this.exception.getMessage(), this.exception); @@ -437,7 +441,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { catch (NoSuchMethodException ex) { Exception wrappedEx = new Exception( "The specified mainClass doesn't contain a " - + "main method with appropriate signature.", ex); + + "main method with appropriate signature.", + ex); thread.getThreadGroup().uncaughtException(thread, wrappedEx); } catch (Exception ex) { diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java index 1d5915ad0c..133cc2a2ac 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java @@ -176,10 +176,9 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { finally { long duration = System.currentTimeMillis() - startTime; if (duration > FIND_WARNING_TIMEOUT) { - getLog().warn( - "Searching for the main-class is taking some time, " - + "consider using the mainClass configuration " - + "parameter"); + getLog().warn("Searching for the main-class is taking some time, " + + "consider using the mainClass configuration " + + "parameter"); } } } @@ -203,9 +202,8 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { throw new MojoExecutionException(ex.getMessage(), ex); } if (this.classifier != null) { - getLog().info( - "Attaching archive: " + target + ", with classifier: " - + this.classifier); + getLog().info("Attaching archive: " + target + ", with classifier: " + + this.classifier); this.projectHelper.attachArtifact(this.project, this.project.getPackaging(), this.classifier, target); } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java index 4256bd1924..f4c2145a5e 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java @@ -52,8 +52,8 @@ public class RunMojo extends AbstractRunMojo { protected void runWithMavenJvm(String startClassName, String... arguments) throws MojoExecutionException { IsolatedThreadGroup threadGroup = new IsolatedThreadGroup(startClassName); - Thread launchThread = new Thread(threadGroup, new LaunchRunner(startClassName, - arguments), "main"); + Thread launchThread = new Thread(threadGroup, + new LaunchRunner(startClassName, arguments), "main"); launchThread.setContextClassLoader(new URLClassLoader(getClassPathUrls())); launchThread.start(); join(threadGroup); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java index de068729d1..066423e676 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java @@ -66,8 +66,8 @@ class SpringApplicationAdminClient { return false; // Instance not available yet } catch (AttributeNotFoundException ex) { - throw new IllegalStateException( - "Unexpected: attribute 'Ready' not available", ex); + throw new IllegalStateException("Unexpected: attribute 'Ready' not available", + ex); } catch (ReflectionException ex) { throw new MojoExecutionException("Failed to retrieve Ready attribute", @@ -87,8 +87,8 @@ class SpringApplicationAdminClient { * @throws IOException if an I/O error occurs * @throws InstanceNotFoundException if the lifecycle mbean cannot be found */ - public void stop() throws MojoExecutionException, IOException, - InstanceNotFoundException { + public void stop() + throws MojoExecutionException, IOException, InstanceNotFoundException { try { this.connection.invoke(this.objectName, "shutdown", null, null); } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java index 956382a5e2..2c0da5b415 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java @@ -86,8 +86,8 @@ public class StartMojo extends AbstractRunMojo { private final Object lock = new Object(); @Override - protected void runWithForkedJvm(List args) throws MojoExecutionException, - MojoFailureException { + protected void runWithForkedJvm(List args) + throws MojoExecutionException, MojoFailureException { RunProcess runProcess = runProcess(args); try { waitForSpringApplication(); @@ -118,8 +118,8 @@ public class StartMojo extends AbstractRunMojo { RunArguments applicationArguments = super.resolveApplicationArguments(); applicationArguments.getArgs().addLast(ENABLE_MBEAN_PROPERTY); if (isFork()) { - applicationArguments.getArgs().addLast( - JMX_NAME_PROPERTY_PREFIX + this.jmxName); + applicationArguments.getArgs() + .addLast(JMX_NAME_PROPERTY_PREFIX + this.jmxName); } return applicationArguments; } @@ -142,8 +142,8 @@ public class StartMojo extends AbstractRunMojo { protected void runWithMavenJvm(String startClassName, String... arguments) throws MojoExecutionException { IsolatedThreadGroup threadGroup = new IsolatedThreadGroup(startClassName); - Thread launchThread = new Thread(threadGroup, new LaunchRunner(startClassName, - arguments), startClassName + ".main()"); + Thread launchThread = new Thread(threadGroup, + new LaunchRunner(startClassName, arguments), startClassName + ".main()"); launchThread.setContextClassLoader(new URLClassLoader(getClassPathUrls())); launchThread.start(); waitForSpringApplication(this.wait, this.maxAttempts); @@ -176,8 +176,8 @@ public class StartMojo extends AbstractRunMojo { + (wait * maxAttempts) + "ms"); } - private void waitForSpringApplication() throws MojoFailureException, - MojoExecutionException { + private void waitForSpringApplication() + throws MojoFailureException, MojoExecutionException { try { if (Boolean.TRUE.equals(isFork())) { waitForForkedSpringApplication(); @@ -196,8 +196,8 @@ public class StartMojo extends AbstractRunMojo { } } - private void waitForForkedSpringApplication() throws IOException, - MojoFailureException, MojoExecutionException { + private void waitForForkedSpringApplication() + throws IOException, MojoFailureException, MojoExecutionException { try { getLog().debug("Connecting to local MBeanServer at port " + this.jmxPort); JMXConnector connector = execute(this.wait, this.maxAttempts, @@ -220,8 +220,8 @@ public class StartMojo extends AbstractRunMojo { throw ex; } catch (Exception ex) { - throw new MojoExecutionException("Failed to connect to MBean server at port " - + this.jmxPort, ex); + throw new MojoExecutionException( + "Failed to connect to MBean server at port " + this.jmxPort, ex); } } @@ -309,8 +309,8 @@ public class StartMojo extends AbstractRunMojo { } private boolean hasCauseWithType(Throwable t, Class type) { - return type.isAssignableFrom(t.getClass()) || t.getCause() != null - && hasCauseWithType(t.getCause(), type); + return type.isAssignableFrom(t.getClass()) + || t.getCause() != null && hasCauseWithType(t.getCause(), type); } } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java index 1eccecb2d4..550f351436 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java @@ -79,8 +79,8 @@ public class StopMojo extends AbstractMojo { } } - private void stopForkedProcess() throws IOException, MojoFailureException, - MojoExecutionException { + private void stopForkedProcess() + throws IOException, MojoFailureException, MojoExecutionException { JMXConnector connector = SpringApplicationAdminClient.connect(this.jmxPort); try { MBeanServerConnection connection = connector.getMBeanServerConnection(); @@ -95,15 +95,16 @@ public class StopMojo extends AbstractMojo { doStop(ManagementFactory.getPlatformMBeanServer()); } - private void doStop(MBeanServerConnection connection) throws IOException, - MojoExecutionException { + private void doStop(MBeanServerConnection connection) + throws IOException, MojoExecutionException { try { new SpringApplicationAdminClient(connection, this.jmxName).stop(); } catch (InstanceNotFoundException ex) { throw new MojoExecutionException( "Spring application lifecycle JMX bean not found (fork is " + "" - + this.fork + "). Could not stop application gracefully", ex); + + this.fork + "). Could not stop application gracefully", + ex); } } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java index b45e088d2b..e637e61c0e 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java @@ -72,8 +72,8 @@ public class DependencyFilterMojoTests { return a; } - private static final class TestableDependencyFilterMojo extends - AbstractDependencyFilterMojo { + private static final class TestableDependencyFilterMojo + extends AbstractDependencyFilterMojo { private TestableDependencyFilterMojo(List excludes, String excludeGroupIds, String excludeArtifactIds) { diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java index 6af8ff6d02..d44eb33221 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java @@ -165,14 +165,15 @@ public final class Verify { verify(true); } - public void verify(boolean executable, String... scriptContents) throws Exception { + public void verify(boolean executable, String... scriptContents) + throws Exception { assertTrue("Archive missing", this.file.exists()); assertTrue("Archive not a file", this.file.isFile()); if (scriptContents.length > 0 && executable) { String contents = new String(FileCopyUtils.copyToByteArray(this.file)); - contents = contents.substring(0, contents.indexOf(new String(new byte[] { - 0x50, 0x4b, 0x03, 0x04 }))); + contents = contents.substring(0, contents + .indexOf(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 }))); for (String content : scriptContents) { assertThat(contents, containsString(content)); } @@ -180,10 +181,8 @@ public final class Verify { if (!executable) { String contents = new String(FileCopyUtils.copyToByteArray(this.file)); - assertTrue( - "Is executable", - contents.startsWith(new String(new byte[] { 0x50, 0x4b, 0x03, - 0x04 }))); + assertTrue("Is executable", contents + .startsWith(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 }))); } ZipFile zipFile = new ZipFile(this.file); diff --git a/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java b/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java index 941afa16bc..d804b80d9e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java +++ b/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java @@ -79,8 +79,8 @@ public class ApplicationTemp { byte[] hash = generateHash(this.sourceClass); this.folder = new File(getTempDirectory(), toHexString(hash)); this.folder.mkdirs(); - Assert.state(this.folder.exists(), "Unable to create temp folder " - + this.folder); + Assert.state(this.folder.exists(), + "Unable to create temp folder " + this.folder); } } return this.folder; diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 6c8c2af65a..0b4ada8a14 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -121,7 +121,8 @@ import org.springframework.web.context.support.StandardServletEnvironment; * your application, however, any of the following sources can also be used: * *

      - *
    • {@link Class} - A Java class to be loaded by {@link AnnotatedBeanDefinitionReader}
    • + *
    • {@link Class} - A Java class to be loaded by {@link AnnotatedBeanDefinitionReader} + *
    • * *
    • {@link Resource} - An XML resource to be loaded by {@link XmlBeanDefinitionReader}, * or a groovy script to be loaded by {@link GroovyBeanDefinitionReader}
    • @@ -169,6 +170,7 @@ public class SpringApplication { private static final Banner DEFAULT_BANNER = new SpringBootBanner(); private static final Set SERVLET_ENVIRONMENT_SOURCE_NAMES; + static { Set names = new HashSet(); names.add(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME); @@ -247,7 +249,8 @@ public class SpringApplication { this.sources.addAll(Arrays.asList(sources)); } this.webEnvironment = deduceWebEnvironment(); - setInitializers((Collection) getSpringFactoriesInstances(ApplicationContextInitializer.class)); + setInitializers((Collection) getSpringFactoriesInstances( + ApplicationContextInitializer.class)); setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class)); this.mainApplicationClass = deduceMainApplicationClass(); } @@ -293,8 +296,8 @@ public class SpringApplication { context = doRun(listeners, args); stopWatch.stop(); if (this.logStartupInfo) { - new StartupInfoLogger(this.mainApplicationClass).logStarted( - getApplicationLog(), stopWatch); + new StartupInfoLogger(this.mainApplicationClass) + .logStarted(getApplicationLog(), stopWatch); } return context; } @@ -366,10 +369,8 @@ public class SpringApplication { } private void configureHeadlessProperty() { - System.setProperty( - SYSTEM_PROPERTY_JAVA_AWT_HEADLESS, - System.getProperty(SYSTEM_PROPERTY_JAVA_AWT_HEADLESS, - Boolean.toString(this.headless))); + System.setProperty(SYSTEM_PROPERTY_JAVA_AWT_HEADLESS, System.getProperty( + SYSTEM_PROPERTY_JAVA_AWT_HEADLESS, Boolean.toString(this.headless))); } private SpringApplicationRunListeners getRunListeners(String[] args) { @@ -402,8 +403,8 @@ public class SpringApplication { instances.add(instance); } catch (Throwable ex) { - throw new IllegalArgumentException("Cannot instantiate " + type + " : " - + name, ex); + throw new IllegalArgumentException( + "Cannot instantiate " + type + " : " + name, ex); } } @@ -433,15 +434,16 @@ public class SpringApplication { * @see #configureProfiles(ConfigurableEnvironment, String[]) * @see #configurePropertySources(ConfigurableEnvironment, String[]) */ - protected void configureEnvironment(ConfigurableEnvironment environment, String[] args) { + protected void configureEnvironment(ConfigurableEnvironment environment, + String[] args) { configurePropertySources(environment, args); configureProfiles(environment, args); } private boolean isWebEnvironment(ConfigurableEnvironment environment) { try { - Class webEnvironmentClass = ClassUtils.forName( - CONFIGURABLE_WEB_ENVIRONMENT_CLASS, getClassLoader()); + Class webEnvironmentClass = ClassUtils + .forName(CONFIGURABLE_WEB_ENVIRONMENT_CLASS, getClassLoader()); return (webEnvironmentClass.isInstance(environment)); } catch (Throwable ex) { @@ -483,16 +485,16 @@ public class SpringApplication { String[] args) { MutablePropertySources sources = environment.getPropertySources(); if (this.defaultProperties != null && !this.defaultProperties.isEmpty()) { - sources.addLast(new MapPropertySource("defaultProperties", - this.defaultProperties)); + sources.addLast( + new MapPropertySource("defaultProperties", this.defaultProperties)); } if (this.addCommandLineProperties && args.length > 0) { String name = CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME; if (sources.contains(name)) { PropertySource source = sources.get(name); CompositePropertySource composite = new CompositePropertySource(name); - composite.addPropertySource(new SimpleCommandLinePropertySource(name - + "-" + args.hashCode(), args)); + composite.addPropertySource(new SimpleCommandLinePropertySource( + name + "-" + args.hashCode(), args)); composite.addPropertySource(source); sources.replace(name, composite); } @@ -559,14 +561,14 @@ public class SpringApplication { Class contextClass = this.applicationContextClass; if (contextClass == null) { try { - contextClass = Class - .forName(this.webEnvironment ? DEFAULT_WEB_CONTEXT_CLASS - : DEFAULT_CONTEXT_CLASS); + contextClass = Class.forName(this.webEnvironment + ? DEFAULT_WEB_CONTEXT_CLASS : DEFAULT_CONTEXT_CLASS); } catch (ClassNotFoundException ex) { throw new IllegalStateException( "Unable create a default ApplicationContext, " - + "please specify an ApplicationContextClass", ex); + + "please specify an ApplicationContextClass", + ex); } } return (ConfigurableApplicationContext) BeanUtils.instantiate(contextClass); @@ -595,8 +597,8 @@ public class SpringApplication { .setResourceLoader(this.resourceLoader); } if (context instanceof DefaultResourceLoader) { - ((DefaultResourceLoader) context).setClassLoader(this.resourceLoader - .getClassLoader()); + ((DefaultResourceLoader) context) + .setClassLoader(this.resourceLoader.getClassLoader()); } } } @@ -665,8 +667,8 @@ public class SpringApplication { */ protected void load(ApplicationContext context, Object[] sources) { if (this.log.isDebugEnabled()) { - this.log.debug("Loading source " - + StringUtils.arrayToCommaDelimitedString(sources)); + this.log.debug( + "Loading source " + StringUtils.arrayToCommaDelimitedString(sources)); } BeanDefinitionLoader loader = createBeanDefinitionLoader( getBeanDefinitionRegistry(context), sources); @@ -1087,8 +1089,8 @@ public class SpringApplication { try { List generators = new ArrayList(); generators.addAll(Arrays.asList(exitCodeGenerators)); - generators.addAll(context.getBeansOfType(ExitCodeGenerator.class) - .values()); + generators + .addAll(context.getBeansOfType(ExitCodeGenerator.class).values()); exitCode = getExitCode(generators); } finally { diff --git a/spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java b/spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java index 58f14f28b9..4eca832d29 100644 --- a/spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java +++ b/spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java @@ -45,9 +45,9 @@ import org.springframework.util.Assert; * @author Stephane Nicoll * @since 1.3.0 */ -public class SpringApplicationAdminMXBeanRegistrar implements ApplicationContextAware, - EnvironmentAware, InitializingBean, DisposableBean, - ApplicationListener { +public class SpringApplicationAdminMXBeanRegistrar + implements ApplicationContextAware, EnvironmentAware, InitializingBean, + DisposableBean, ApplicationListener { private static final Log logger = LogFactory.getLog(SpringApplicationAdmin.class); @@ -106,7 +106,8 @@ public class SpringApplicationAdminMXBeanRegistrar implements ApplicationContext @Override public boolean isEmbeddedWebApplication() { - return (SpringApplicationAdminMXBeanRegistrar.this.applicationContext != null && SpringApplicationAdminMXBeanRegistrar.this.applicationContext instanceof EmbeddedWebApplicationContext); + return (SpringApplicationAdminMXBeanRegistrar.this.applicationContext != null + && SpringApplicationAdminMXBeanRegistrar.this.applicationContext instanceof EmbeddedWebApplicationContext); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiPropertySource.java b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiPropertySource.java index 0fbf7478ad..efefd4a4e5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiPropertySource.java +++ b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiPropertySource.java @@ -39,11 +39,13 @@ import org.springframework.util.StringUtils; public class AnsiPropertySource extends PropertySource { private static final Iterable> MAPPED_ENUMS; + static { List> enums = new ArrayList>(); enums.add(new MappedEnum("AnsiStyle.", AnsiStyle.class)); enums.add(new MappedEnum("AnsiColor.", AnsiColor.class)); - enums.add(new MappedEnum("AnsiBackground.", AnsiBackground.class)); + enums.add( + new MappedEnum("AnsiBackground.", AnsiBackground.class)); enums.add(new MappedEnum("Ansi.", AnsiStyle.class)); enums.add(new MappedEnum("Ansi.", AnsiColor.class)); enums.add(new MappedEnum("Ansi.BG_", AnsiBackground.class)); diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcher.java b/spring-boot/src/main/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcher.java index 5583911d85..859d57be0c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcher.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcher.java @@ -78,7 +78,8 @@ class DefaultPropertyNamePatternsMatcher implements PropertyNamePatternsMatcher } } else { - char charAfter = propertyNameChars[this.names[nameIndex].length()]; + char charAfter = propertyNameChars[this.names[nameIndex] + .length()]; if (isDelimiter(charAfter)) { match[nameIndex] = true; noneMatched = false; diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/OriginCapablePropertyValue.java b/spring-boot/src/main/java/org/springframework/boot/bind/OriginCapablePropertyValue.java index 564d4961ed..cb1d96599d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/OriginCapablePropertyValue.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/OriginCapablePropertyValue.java @@ -53,8 +53,8 @@ class OriginCapablePropertyValue extends PropertyValue { @Override public String toString() { String name = this.origin != null ? this.origin.getName() : this.getName(); - String source = this.origin.getSource() != null ? this.origin.getSource() - .getName() : "unknown"; + String source = this.origin.getSource() != null + ? this.origin.getSource().getName() : "unknown"; return "'" + name + "' from '" + source + "'"; } diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PatternPropertyNamePatternsMatcher.java b/spring-boot/src/main/java/org/springframework/boot/bind/PatternPropertyNamePatternsMatcher.java index c401071838..390947fc64 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PatternPropertyNamePatternsMatcher.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PatternPropertyNamePatternsMatcher.java @@ -32,8 +32,8 @@ class PatternPropertyNamePatternsMatcher implements PropertyNamePatternsMatcher private final String[] patterns; PatternPropertyNamePatternsMatcher(Collection patterns) { - this.patterns = (patterns == null ? new String[] {} : patterns - .toArray(new String[patterns.size()])); + this.patterns = (patterns == null ? new String[] {} + : patterns.toArray(new String[patterns.size()])); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java index 85c0de798c..9600d2781a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java @@ -272,8 +272,8 @@ public class PropertiesConfigurationFactory private Set getNames() { Set names = new LinkedHashSet(); if (this.target != null) { - Iterable prefixes = (StringUtils.hasLength(this.targetName) ? new RelaxedNames( - this.targetName) : null); + Iterable prefixes = (StringUtils.hasLength(this.targetName) + ? new RelaxedNames(this.targetName) : null); PropertyDescriptor[] descriptors = BeanUtils .getPropertyDescriptors(this.target.getClass()); for (PropertyDescriptor descriptor : descriptors) { @@ -311,7 +311,8 @@ public class PropertiesConfigurationFactory return new PropertySourcesPropertyValues(this.propertySources, names, includes); } - private PropertyNamePatternsMatcher getPropertyNamePatternsMatcher(Set names) { + private PropertyNamePatternsMatcher getPropertyNamePatternsMatcher( + Set names) { if (this.ignoreUnknownFields && !isMapTarget()) { // Since unknown fields are ignored we can filter them out early to save // unnecessary calls to the PropertySource. diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java index 7e59dab988..ac329a6bfc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java @@ -199,8 +199,8 @@ public class PropertySourcesPropertyValues implements PropertyValues { COLLECTION_PROPERTY.matcher(propertyName).replaceAll("[]"), source); if (collectionOwner == null || collectionOwner == source) { this.collectionOwners.get(this.collectionOwners); - PropertyValue propertyValue = new OriginCapablePropertyValue( - propertyName, value, propertyName, source); + PropertyValue propertyValue = new OriginCapablePropertyValue(propertyName, + value, propertyName, source); this.propertyValues.put(propertyName, propertyValue); return propertyValue; } diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedBindingNotWritablePropertyException.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedBindingNotWritablePropertyException.java index 318b6d855e..81d4bc8944 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedBindingNotWritablePropertyException.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedBindingNotWritablePropertyException.java @@ -26,8 +26,8 @@ import org.springframework.beans.NotWritablePropertyException; * @since 1.3.0 * @see RelaxedDataBinder */ -public class RelaxedBindingNotWritablePropertyException extends - NotWritablePropertyException { +public class RelaxedBindingNotWritablePropertyException + extends NotWritablePropertyException { private final String message; diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java index da4bae7c8e..ef592a3b67 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java @@ -79,8 +79,8 @@ public class RelaxedDataBinder extends DataBinder { * @param namePrefix An optional prefix to be used when reading properties */ public RelaxedDataBinder(Object target, String namePrefix) { - super(wrapTarget(target), (StringUtils.hasLength(namePrefix) ? namePrefix - : DEFAULT_OBJECT_NAME)); + super(wrapTarget(target), + (StringUtils.hasLength(namePrefix) ? namePrefix : DEFAULT_OBJECT_NAME)); this.namePrefix = cleanNamePrefix(namePrefix); } @@ -143,7 +143,8 @@ public class RelaxedDataBinder extends DataBinder { propertyValues = addMapPrefix(propertyValues); } BeanWrapper wrapper = new BeanWrapperImpl(target); - wrapper.setConversionService(new RelaxedConversionService(getConversionService())); + wrapper.setConversionService( + new RelaxedConversionService(getConversionService())); wrapper.setAutoGrowNestedPaths(true); List sortedValues = new ArrayList(); Set modifiedNames = new HashSet(); @@ -208,8 +209,8 @@ public class RelaxedDataBinder extends DataBinder { String name = value.getName(); for (String prefix : new RelaxedNames(stripLastDot(this.namePrefix))) { for (String separator : new String[] { ".", "_" }) { - String candidate = (StringUtils.hasLength(prefix) ? prefix - + separator : prefix); + String candidate = (StringUtils.hasLength(prefix) ? prefix + separator + : prefix); if (name.startsWith(candidate)) { name = name.substring(candidate.length()); if (!(this.ignoreNestedProperties && name.contains("."))) { @@ -232,7 +233,8 @@ public class RelaxedDataBinder extends DataBinder { return string; } - private PropertyValue modifyProperty(BeanWrapper target, PropertyValue propertyValue) { + private PropertyValue modifyProperty(BeanWrapper target, + PropertyValue propertyValue) { String name = propertyValue.getName(); String normalizedName = normalizePath(target, name); if (!normalizedName.equals(name)) { @@ -315,8 +317,8 @@ public class RelaxedDataBinder extends DataBinder { @SuppressWarnings("rawtypes") private boolean isBlanked(BeanWrapper wrapper, String propertyName, String key) { - Object value = (wrapper.isReadableProperty(propertyName) ? wrapper - .getPropertyValue(propertyName) : null); + Object value = (wrapper.isReadableProperty(propertyName) + ? wrapper.getPropertyValue(propertyName) : null); if (value instanceof Map) { if (((Map) value).get(key) == BLANK) { return true; @@ -325,7 +327,8 @@ public class RelaxedDataBinder extends DataBinder { return false; } - private void extendCollectionIfNecessary(BeanWrapper wrapper, BeanPath path, int index) { + private void extendCollectionIfNecessary(BeanWrapper wrapper, BeanPath path, + int index) { String name = path.prefix(index); TypeDescriptor elementDescriptor = wrapper.getPropertyTypeDescriptor(name) .getElementTypeDescriptor(); @@ -643,8 +646,8 @@ public class RelaxedDataBinder extends DataBinder { /** * Extended version of {@link BeanPropertyBindingResult} to support relaxed binding. */ - private static class RelaxedBeanPropertyBindingResult extends - BeanPropertyBindingResult { + private static class RelaxedBeanPropertyBindingResult + extends BeanPropertyBindingResult { private RelaxedConversionService conversionService; @@ -671,6 +674,7 @@ public class RelaxedDataBinder extends DataBinder { private static class RelaxedBeanWrapper extends BeanWrapperImpl { private static final Set BENIGN_PROPERTY_SOURCE_NAMES; + static { Set names = new HashSet(); names.add(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME); diff --git a/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java index 5b9bd2153a..65d88cc2fb 100644 --- a/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java @@ -88,7 +88,8 @@ import org.springframework.util.StringUtils; * @author Dave Syer * @author Andy Wilkinson */ -public class CloudFoundryVcapEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { +public class CloudFoundryVcapEnvironmentPostProcessor + implements EnvironmentPostProcessor, Ordered { private static final Log logger = LogFactory .getLog(CloudFoundryVcapEnvironmentPostProcessor.class); @@ -121,8 +122,8 @@ public class CloudFoundryVcapEnvironmentPostProcessor implements EnvironmentPost addWithPrefix(properties, getPropertiesFromServices(environment), "vcap.services."); MutablePropertySources propertySources = environment.getPropertySources(); - if (propertySources - .contains(CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME)) { + if (propertySources.contains( + CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME)) { propertySources.addAfter( CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME, new PropertiesPropertySource("vcap", properties)); diff --git a/spring-boot/src/main/java/org/springframework/boot/cloudfoundry/VcapEnvironmentPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/cloudfoundry/VcapEnvironmentPostProcessor.java index 93f15b6d49..5cb0cb11bd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/cloudfoundry/VcapEnvironmentPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/cloudfoundry/VcapEnvironmentPostProcessor.java @@ -72,7 +72,7 @@ import org.springframework.core.env.Environment; * @deprecated since 1.3.0 in favor of CloudFoundryVcapEnvironmentPostProcessor */ @Deprecated -public class VcapEnvironmentPostProcessor extends - CloudFoundryVcapEnvironmentPostProcessor { +public class VcapEnvironmentPostProcessor + extends CloudFoundryVcapEnvironmentPostProcessor { } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java index c1775091f1..e030087406 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java @@ -92,8 +92,8 @@ public class ContextIdApplicationContextInitializer implements private String getApplicationId(ConfigurableEnvironment environment) { String name = environment.resolvePlaceholders(this.name); String index = environment.resolvePlaceholders(INDEX_PATTERN); - String profiles = StringUtils.arrayToCommaDelimitedString(environment - .getActiveProfiles()); + String profiles = StringUtils + .arrayToCommaDelimitedString(environment.getActiveProfiles()); if (StringUtils.hasText(profiles)) { name = name + ":" + profiles; } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java index 5c915a8f40..0fb73f3bb3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java @@ -45,8 +45,8 @@ public class AnsiOutputApplicationListener } if (resolver.containsProperty("console-available")) { - AnsiOutput.setConsoleAvailable(resolver.getProperty("console-available", - Boolean.class)); + AnsiOutput.setConsoleAvailable( + resolver.getProperty("console-available", Boolean.class)); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileEnvironmentPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileEnvironmentPostProcessor.java index 4bdc0f5bb3..1adeab4cae 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileEnvironmentPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileEnvironmentPostProcessor.java @@ -189,8 +189,8 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces * @param context the context to configure */ protected void addPostProcessors(ConfigurableApplicationContext context) { - context.addBeanFactoryPostProcessor(new PropertySourceOrderingPostProcessor( - context)); + context.addBeanFactoryPostProcessor( + new PropertySourceOrderingPostProcessor(context)); } public void setOrder(int order) { @@ -230,8 +230,8 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces * {@link BeanFactoryPostProcessor} to re-order our property sources below any * {@code @PropertySource} items added by the {@link ConfigurationClassPostProcessor}. */ - private class PropertySourceOrderingPostProcessor implements - BeanFactoryPostProcessor, Ordered { + private class PropertySourceOrderingPostProcessor + implements BeanFactoryPostProcessor, Ordered { private ConfigurableApplicationContext context; @@ -251,8 +251,8 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces } private void reorderSources(ConfigurableEnvironment environment) { - ConfigurationPropertySources.finishAndRelocate(environment - .getPropertySources()); + ConfigurationPropertySources + .finishAndRelocate(environment.getPropertySources()); PropertySource defaultProperties = environment.getPropertySources() .remove(DEFAULT_PROPERTIES); if (defaultProperties != null) { @@ -292,15 +292,15 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces if (this.environment.containsProperty(ACTIVE_PROFILES_PROPERTY)) { // Any pre-existing active profiles set via property sources (e.g. System // properties) take precedence over those added in config files. - maybeActivateProfiles(this.environment - .getProperty(ACTIVE_PROFILES_PROPERTY)); + maybeActivateProfiles( + this.environment.getProperty(ACTIVE_PROFILES_PROPERTY)); } else { // Pre-existing active profiles set via Environment.setActiveProfiles() // are additional profiles and config files are allowed to add more if // they want to, so don't call addActiveProfiles() here. - List list = new ArrayList(Arrays.asList(this.environment - .getActiveProfiles())); + List list = new ArrayList( + Arrays.asList(this.environment.getActiveProfiles())); // Reverse them so the order is the same as from getProfilesForValue() // (last one wins when properties are eventually resolved) Collections.reverse(list); @@ -377,10 +377,10 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces profile); if (propertySource != null) { msg.append("Loaded "); - maybeActivateProfiles(propertySource - .getProperty(ACTIVE_PROFILES_PROPERTY)); - addIncludeProfiles(propertySource - .getProperty(INCLUDE_PROFILES_PROPERTY)); + maybeActivateProfiles( + propertySource.getProperty(ACTIVE_PROFILES_PROPERTY)); + addIncludeProfiles( + propertySource.getProperty(INCLUDE_PROFILES_PROPERTY)); } else { msg.append("Skipped (empty) "); @@ -466,9 +466,9 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces locations.add(path); } } - locations.addAll(asResolvedSet( - ConfigFileEnvironmentPostProcessor.this.searchLocations, - DEFAULT_SEARCH_LOCATIONS)); + locations.addAll( + asResolvedSet(ConfigFileEnvironmentPostProcessor.this.searchLocations, + DEFAULT_SEARCH_LOCATIONS)); return locations; } @@ -482,9 +482,9 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces } private Set asResolvedSet(String value, String fallback) { - List list = Arrays.asList(StringUtils - .commaDelimitedListToStringArray(value != null ? this.environment - .resolvePlaceholders(value) : fallback)); + List list = Arrays + .asList(StringUtils.commaDelimitedListToStringArray(value != null + ? this.environment.resolvePlaceholders(value) : fallback)); Collections.reverse(list); return new LinkedHashSet(list); } @@ -495,8 +495,8 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces reorderedSources.add(item); } // Maybe we should add before the DEFAULT_PROPERTIES if it exists? - this.environment.getPropertySources().addLast( - new ConfigurationPropertySources(reorderedSources)); + this.environment.getPropertySources() + .addLast(new ConfigurationPropertySources(reorderedSources)); } } @@ -505,8 +505,8 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces * Holds the configuration {@link PropertySource}s as they are loaded can relocate * them once configuration classes have been processed. */ - static class ConfigurationPropertySources extends - EnumerablePropertySource>> { + static class ConfigurationPropertySources + extends EnumerablePropertySource>> { private static final String NAME = "applicationConfigurationProperties"; @@ -520,8 +520,8 @@ public class ConfigFileEnvironmentPostProcessor implements EnvironmentPostProces List names = new ArrayList(); for (PropertySource source : sources) { if (source instanceof EnumerablePropertySource) { - names.addAll(Arrays.asList(((EnumerablePropertySource) source) - .getPropertyNames())); + names.addAll(Arrays.asList( + ((EnumerablePropertySource) source).getPropertyNames())); } } this.names = names.toArray(new String[names.size()]); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java index 4dd8ea9962..5d2a3415d2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java @@ -325,10 +325,8 @@ public abstract class AbstractConfigurableEmbeddedServletContainer * @return {@code true} if the container should be registered, otherwise {@code false} */ protected boolean shouldRegisterJspServlet() { - return this.jspServlet != null - && this.jspServlet.getRegistered() - && ClassUtils.isPresent(this.jspServlet.getClassName(), getClass() - .getClassLoader()); + return this.jspServlet != null && this.jspServlet.getRegistered() && ClassUtils + .isPresent(this.jspServlet.getClassName(), getClass().getClassLoader()); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java index e4dd495247..c861bd5385 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java @@ -88,8 +88,8 @@ import org.springframework.util.StringUtils; * @see #setConfigurations(Collection) * @see JettyEmbeddedServletContainer */ -public class JettyEmbeddedServletContainerFactory extends - AbstractEmbeddedServletContainerFactory implements ResourceLoaderAware { +public class JettyEmbeddedServletContainerFactory + extends AbstractEmbeddedServletContainerFactory implements ResourceLoaderAware { private static final String GZIP_HANDLER_JETTY_9_2 = "org.eclipse.jetty.servlets.gzip.GzipHandler"; @@ -150,8 +150,8 @@ public class JettyEmbeddedServletContainerFactory extends if (getSsl() != null && getSsl().isEnabled()) { SslContextFactory sslContextFactory = new SslContextFactory(); configureSsl(sslContextFactory, getSsl()); - AbstractConnector connector = getSslServerConnectorFactory().getConnector( - server, sslContextFactory, port); + AbstractConnector connector = getSslServerConnectorFactory() + .getConnector(server, sslContextFactory, port); server.setConnectors(new Connector[] { connector }); } for (JettyServerCustomizer customizer : getServerCustomizers()) { @@ -179,7 +179,8 @@ public class JettyEmbeddedServletContainerFactory extends } private SslServerConnectorFactory getSslServerConnectorFactory() { - if (ClassUtils.isPresent("org.eclipse.jetty.server.ssl.SslSocketConnector", null)) { + if (ClassUtils.isPresent("org.eclipse.jetty.server.ssl.SslSocketConnector", + null)) { return new Jetty8SslServerConnectorFactory(); } return new Jetty9SslServerConnectorFactory(); @@ -227,8 +228,8 @@ public class JettyEmbeddedServletContainerFactory extends factory.setKeyStoreResource(Resource.newResource(url)); } catch (IOException ex) { - throw new EmbeddedServletContainerException("Could not find key store '" - + ssl.getKeyStore() + "'", ex); + throw new EmbeddedServletContainerException( + "Could not find key store '" + ssl.getKeyStore() + "'", ex); } if (ssl.getKeyStoreType() != null) { factory.setKeyStoreType(ssl.getKeyStoreType()); @@ -321,12 +322,13 @@ public class JettyEmbeddedServletContainerFactory extends if (root != null) { try { if (!root.isDirectory()) { - Resource resource = JarResource.newJarResource(Resource - .newResource(root)); + Resource resource = JarResource + .newJarResource(Resource.newResource(root)); handler.setBaseResource(resource); } else { - handler.setBaseResource(Resource.newResource(root.getCanonicalFile())); + handler.setBaseResource( + Resource.newResource(root.getCanonicalFile())); } } catch (Exception ex) { @@ -378,8 +380,8 @@ public class JettyEmbeddedServletContainerFactory extends protected Configuration[] getWebAppContextConfigurations(WebAppContext webAppContext, ServletContextInitializer... initializers) { List configurations = new ArrayList(); - configurations.add(getServletContextInitializerConfiguration(webAppContext, - initializers)); + configurations.add( + getServletContextInitializerConfiguration(webAppContext, initializers)); configurations.addAll(getConfigurations()); configurations.add(getErrorPageConfiguration()); configurations.add(getMimeTypeConfiguration()); @@ -447,7 +449,8 @@ public class JettyEmbeddedServletContainerFactory extends * @param server the Jetty server. * @return a new {@link JettyEmbeddedServletContainer} instance */ - protected JettyEmbeddedServletContainer getJettyEmbeddedServletContainer(Server server) { + protected JettyEmbeddedServletContainer getJettyEmbeddedServletContainer( + Server server) { return new JettyEmbeddedServletContainer(server, getPort() >= 0); } @@ -553,16 +556,16 @@ public class JettyEmbeddedServletContainerFactory extends */ private interface SslServerConnectorFactory { - AbstractConnector getConnector(Server server, - SslContextFactory sslContextFactory, int port); + AbstractConnector getConnector(Server server, SslContextFactory sslContextFactory, + int port); } /** * {@link SslServerConnectorFactory} for Jetty 9. */ - private static class Jetty9SslServerConnectorFactory implements - SslServerConnectorFactory { + private static class Jetty9SslServerConnectorFactory + implements SslServerConnectorFactory { @Override public ServerConnector getConnector(Server server, @@ -582,8 +585,8 @@ public class JettyEmbeddedServletContainerFactory extends /** * {@link SslServerConnectorFactory} for Jetty 8. */ - private static class Jetty8SslServerConnectorFactory implements - SslServerConnectorFactory { + private static class Jetty8SslServerConnectorFactory + implements SslServerConnectorFactory { @Override public AbstractConnector getConnector(Server server, @@ -592,10 +595,10 @@ public class JettyEmbeddedServletContainerFactory extends Class connectorClass = Class .forName("org.eclipse.jetty.server.ssl.SslSocketConnector"); AbstractConnector connector = (AbstractConnector) connectorClass - .getConstructor(SslContextFactory.class).newInstance( - sslContextFactory); - connector.getClass().getMethod("setPort", int.class) - .invoke(connector, port); + .getConstructor(SslContextFactory.class) + .newInstance(sslContextFactory); + connector.getClass().getMethod("setPort", int.class).invoke(connector, + port); return connector; } catch (Exception ex) { @@ -622,19 +625,18 @@ public class JettyEmbeddedServletContainerFactory extends ReflectionUtils.findMethod(handlerClass, "setMinGzipSize", int.class) .invoke(handler, compression.getMinResponseSize()); ReflectionUtils.findMethod(handlerClass, "setMimeTypes", Set.class) - .invoke(handler, - new HashSet(Arrays.asList(compression - .getMimeTypes()))); + .invoke(handler, new HashSet( + Arrays.asList(compression.getMimeTypes()))); if (compression.getExcludedUserAgents() != null) { ReflectionUtils.findMethod(handlerClass, "setExcluded", Set.class) - .invoke(handler, - new HashSet(Arrays.asList(compression - .getExcludedUserAgents()))); + .invoke(handler, new HashSet( + Arrays.asList(compression.getExcludedUserAgents()))); } return handler; } catch (Exception ex) { - throw new RuntimeException("Failed to configure Jetty 8 gzip handler", ex); + throw new RuntimeException("Failed to configure Jetty 8 gzip handler", + ex); } } @@ -646,11 +648,11 @@ public class JettyEmbeddedServletContainerFactory extends public HandlerWrapper createGzipHandler(Compression compression) { GzipHandler gzipHandler = new GzipHandler(); gzipHandler.setMinGzipSize(compression.getMinResponseSize()); - gzipHandler.setMimeTypes(new HashSet(Arrays.asList(compression - .getMimeTypes()))); + gzipHandler.setMimeTypes( + new HashSet(Arrays.asList(compression.getMimeTypes()))); if (compression.getExcludedUserAgents() != null) { - gzipHandler.setExcluded(new HashSet(Arrays.asList(compression - .getExcludedUserAgents()))); + gzipHandler.setExcluded(new HashSet( + Arrays.asList(compression.getExcludedUserAgents()))); } return gzipHandler; } @@ -667,13 +669,15 @@ public class JettyEmbeddedServletContainerFactory extends HandlerWrapper handler = (HandlerWrapper) handlerClass.newInstance(); ReflectionUtils.findMethod(handlerClass, "setMinGzipSize", int.class) .invoke(handler, compression.getMinResponseSize()); - ReflectionUtils.findMethod(handlerClass, "setIncludedMimeTypes", - String[].class).invoke(handler, - new Object[] { compression.getMimeTypes() }); + ReflectionUtils + .findMethod(handlerClass, "setIncludedMimeTypes", String[].class) + .invoke(handler, new Object[] { compression.getMimeTypes() }); if (compression.getExcludedUserAgents() != null) { - ReflectionUtils.findMethod(handlerClass, "setExcludedAgentPatterns", - String[].class).invoke(handler, - new Object[] { compression.getExcludedUserAgents() }); + ReflectionUtils + .findMethod(handlerClass, "setExcludedAgentPatterns", + String[].class) + .invoke(handler, + new Object[] { compression.getExcludedUserAgents() }); } return handler; } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedContext.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedContext.java index 436ae7ce48..e7404d811b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedContext.java @@ -35,8 +35,9 @@ class TomcatEmbeddedContext extends StandardContext { private final boolean overrideLoadOnStart; TomcatEmbeddedContext() { - this.overrideLoadOnStart = ReflectionUtils.findMethod(StandardContext.class, - "loadOnStartup", Container[].class).getReturnType() == boolean.class; + this.overrideLoadOnStart = ReflectionUtils + .findMethod(StandardContext.class, "loadOnStartup", Container[].class) + .getReturnType() == boolean.class; } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java index 1e03ffc11e..0a1097ab0d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java @@ -89,8 +89,8 @@ import org.springframework.util.StringUtils; * @see #setContextLifecycleListeners(Collection) * @see TomcatEmbeddedServletContainer */ -public class TomcatEmbeddedServletContainerFactory extends - AbstractEmbeddedServletContainerFactory implements ResourceLoaderAware { +public class TomcatEmbeddedServletContainerFactory + extends AbstractEmbeddedServletContainerFactory implements ResourceLoaderAware { private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); @@ -176,8 +176,9 @@ public class TomcatEmbeddedServletContainerFactory extends context.setPath(getContextPath()); context.setDocBase(docBase.getAbsolutePath()); context.addLifecycleListener(new FixContextListener()); - context.setParentClassLoader(this.resourceLoader != null ? this.resourceLoader - .getClassLoader() : ClassUtils.getDefaultClassLoader()); + context.setParentClassLoader( + this.resourceLoader != null ? this.resourceLoader.getClassLoader() + : ClassUtils.getDefaultClassLoader()); SkipPatternJarScanner.apply(context, this.tldSkip); WebappLoader loader = new WebappLoader(context.getParentClassLoader()); loader.setLoaderClass(TomcatEmbeddedWebappClassLoader.class.getName()); @@ -286,12 +287,12 @@ public class TomcatEmbeddedServletContainerFactory extends Compression compression = getCompression(); protocol.setCompression("on"); protocol.setCompressionMinSize(compression.getMinResponseSize()); - protocol.setCompressableMimeTypes(StringUtils - .arrayToCommaDelimitedString(compression.getMimeTypes())); + protocol.setCompressableMimeTypes( + StringUtils.arrayToCommaDelimitedString(compression.getMimeTypes())); if (getCompression().getExcludedUserAgents() != null) { - protocol.setNoCompressionUserAgents(StringUtils - .arrayToCommaDelimitedString(getCompression() - .getExcludedUserAgents())); + protocol.setNoCompressionUserAgents( + StringUtils.arrayToCommaDelimitedString( + getCompression().getExcludedUserAgents())); } } } @@ -330,8 +331,8 @@ public class TomcatEmbeddedServletContainerFactory extends protocol.setKeystoreFile(file.getAbsolutePath()); } catch (FileNotFoundException ex) { - throw new EmbeddedServletContainerException("Could load key store: " - + ex.getMessage(), ex); + throw new EmbeddedServletContainerException( + "Could load key store: " + ex.getMessage(), ex); } if (ssl.getKeyStoreType() != null) { protocol.setKeystoreType(ssl.getKeyStoreType()); @@ -349,8 +350,8 @@ public class TomcatEmbeddedServletContainerFactory extends protocol.setTruststoreFile(file.getAbsolutePath()); } catch (FileNotFoundException ex) { - throw new EmbeddedServletContainerException("Could load trust store: " - + ex.getMessage(), ex); + throw new EmbeddedServletContainerException( + "Could load trust store: " + ex.getMessage(), ex); } } protocol.setTruststorePass(ssl.getTrustStorePassword()); @@ -362,7 +363,8 @@ public class TomcatEmbeddedServletContainerFactory extends } } - private void assertNotClasspathResource(String resource) throws FileNotFoundException { + private void assertNotClasspathResource(String resource) + throws FileNotFoundException { if (resource.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) { throw new FileNotFoundException("Unable to load '" + resource + "' since Tomcat doesn't support classpath resources"); @@ -469,7 +471,8 @@ public class TomcatEmbeddedServletContainerFactory extends catch (IOException ex) { throw new EmbeddedServletContainerException( "Unable to create Tomcat tempdir. java.io.tmpdir is set to " - + System.getProperty("java.io.tmpdir"), ex); + + System.getProperty("java.io.tmpdir"), + ex); } } @@ -589,7 +592,8 @@ public class TomcatEmbeddedServletContainerFactory extends * {@link Context}. * @param tomcatContextCustomizers the customizers to add */ - public void addContextCustomizers(TomcatContextCustomizer... tomcatContextCustomizers) { + public void addContextCustomizers( + TomcatContextCustomizer... tomcatContextCustomizers) { Assert.notNull(tomcatContextCustomizers, "TomcatContextCustomizers must not be null"); this.tomcatContextCustomizers.addAll(Arrays.asList(tomcatContextCustomizers)); @@ -690,8 +694,8 @@ public class TomcatEmbeddedServletContainerFactory extends } else if (ClassUtils.isPresent("org.apache.catalina.deploy.ErrorPage", null)) { - nativePage = BeanUtils.instantiate(ClassUtils.forName( - "org.apache.catalina.deploy.ErrorPage", null)); + nativePage = BeanUtils.instantiate(ClassUtils + .forName("org.apache.catalina.deploy.ErrorPage", null)); } } catch (ClassNotFoundException ex) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java index a6eb7cdbf4..9af91623ff 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java @@ -91,8 +91,8 @@ public class FileSessionPersistence implements SessionPersistenceManager { return null; } - private Map load(File file) throws IOException, - ClassNotFoundException { + private Map load(File file) + throws IOException, ClassNotFoundException { ObjectInputStream stream = new ObjectInputStream(new FileInputStream(file)); try { return load(stream); @@ -107,7 +107,8 @@ public class FileSessionPersistence implements SessionPersistenceManager { Map session = readSession(stream); long time = System.currentTimeMillis(); Map result = new LinkedHashMap(); - for (Map.Entry entry : session.entrySet()) { + for (Map.Entry entry : session + .entrySet()) { PersistentSession entrySession = entry.getValue().getPersistentSession(); if (entrySession.getExpiration().getTime() > time) { result.put(entry.getKey(), entrySession); @@ -147,7 +148,8 @@ public class FileSessionPersistence implements SessionPersistenceManager { SerializablePersistentSession(PersistentSession session) { this.expiration = session.getExpiration(); - this.sessionData = new LinkedHashMap(session.getSessionData()); + this.sessionData = new LinkedHashMap( + session.getSessionData()); } public PersistentSession getPersistentSession() { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java index c051470d8c..450d004f02 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java @@ -189,13 +189,13 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine private List extractChannels() { Field channelsField = ReflectionUtils.findField(Undertow.class, "channels"); ReflectionUtils.makeAccessible(channelsField); - return (List) ReflectionUtils - .getField(channelsField, this.undertow); + return (List) ReflectionUtils.getField(channelsField, + this.undertow); } private Port getPortFromChannel(BoundChannel channel) { - String protocol = ReflectionUtils.findField(channel.getClass(), "ssl") != null ? "https" - : "http"; + String protocol = ReflectionUtils.findField(channel.getClass(), "ssl") != null + ? "https" : "http"; SocketAddress socketAddress = channel.getLocalAddress(); if (socketAddress instanceof InetSocketAddress) { return new Port(((InetSocketAddress) socketAddress).getPort(), protocol); @@ -212,7 +212,8 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine this.undertow.stop(); } catch (Exception ex) { - throw new EmbeddedServletContainerException("Unable to stop undertow", ex); + throw new EmbeddedServletContainerException("Unable to stop undertow", + ex); } } } @@ -264,12 +265,12 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine @Override public boolean resolve(HttpServerExchange value) { - String contentType = value.getResponseHeaders().getFirst( - HttpHeaders.CONTENT_TYPE); + String contentType = value.getResponseHeaders() + .getFirst(HttpHeaders.CONTENT_TYPE); if (contentType != null) { for (MimeType mimeType : this.mimeTypes) { - if (mimeType.isCompatibleWith(MimeTypeUtils - .parseMimeType(contentType))) { + if (mimeType + .isCompatibleWith(MimeTypeUtils.parseMimeType(contentType))) { return true; } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java index f37679910d..d21c6bbb5f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java @@ -72,9 +72,9 @@ public @interface ConfigurationProperties { boolean ignoreUnknownFields() default true; /** - * Flag to indicate that an exception should be raised if a Validator is - * available and validation fails. If it is set to false, validation errors will be swallowed. - * They will be logged, but not propagated to the caller. + * Flag to indicate that an exception should be raised if a Validator is available and + * validation fails. If it is set to false, validation errors will be swallowed. They + * will be logged, but not propagated to the caller. * @return the flag value (default true) */ boolean exceptionIfInvalid() default true; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java index 82a62149d5..812c4bd1dc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -267,8 +267,8 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { - ConfigurationProperties annotation = AnnotationUtils.findAnnotation( - bean.getClass(), ConfigurationProperties.class); + ConfigurationProperties annotation = AnnotationUtils + .findAnnotation(bean.getClass(), ConfigurationProperties.class); if (annotation != null || bean instanceof ConfigurationPropertiesHolder) { postProcessBeforeInitialization(bean, beanName, annotation); } @@ -288,13 +288,13 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc private void postProcessBeforeInitialization(Object bean, String beanName, ConfigurationProperties annotation) { - Object target = (bean instanceof ConfigurationPropertiesHolder ? ((ConfigurationPropertiesHolder) bean) - .getTarget() : bean); + Object target = (bean instanceof ConfigurationPropertiesHolder + ? ((ConfigurationPropertiesHolder) bean).getTarget() : bean); PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory( target); if (annotation != null && annotation.locations().length != 0) { - factory.setPropertySources(loadPropertySources(annotation.locations(), - annotation.merge())); + factory.setPropertySources( + loadPropertySources(annotation.locations(), annotation.merge())); } else { factory.setPropertySources(this.propertySources); @@ -302,15 +302,15 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc factory.setValidator(determineValidator(bean)); // If no explicit conversion service is provided we add one so that (at least) // comma-separated arrays of convertibles can be bound automatically - factory.setConversionService(this.conversionService == null ? getDefaultConversionService() - : this.conversionService); + factory.setConversionService(this.conversionService == null + ? getDefaultConversionService() : this.conversionService); if (annotation != null) { factory.setIgnoreInvalidFields(annotation.ignoreInvalidFields()); factory.setIgnoreUnknownFields(annotation.ignoreUnknownFields()); factory.setExceptionIfInvalid(annotation.exceptionIfInvalid()); factory.setIgnoreNestedProperties(annotation.ignoreNestedProperties()); - String targetName = (StringUtils.hasLength(annotation.value()) ? annotation - .value() : annotation.prefix()); + String targetName = (StringUtils.hasLength(annotation.value()) + ? annotation.value() : annotation.prefix()); if (StringUtils.hasLength(targetName)) { factory.setTargetName(targetName); } @@ -330,19 +330,18 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc return ""; } StringBuilder details = new StringBuilder(); - details.append("prefix=").append( - (StringUtils.hasLength(annotation.value()) ? annotation.value() - : annotation.prefix())); + details.append("prefix=").append((StringUtils.hasLength(annotation.value()) + ? annotation.value() : annotation.prefix())); details.append(", ignoreInvalidFields=").append(annotation.ignoreInvalidFields()); details.append(", ignoreUnknownFields=").append(annotation.ignoreUnknownFields()); - details.append(", ignoreNestedProperties=").append( - annotation.ignoreNestedProperties()); + details.append(", ignoreNestedProperties=") + .append(annotation.ignoreNestedProperties()); return details.toString(); } private Validator determineValidator(Object bean) { - boolean globalValidatorSupportBean = (this.validator != null && this.validator - .supports(bean.getClass())); + boolean globalValidatorSupportBean = (this.validator != null + && this.validator.supports(bean.getClass())); if (ClassUtils.isAssignable(Validator.class, bean.getClass())) { if (!globalValidatorSupportBean) { return (Validator) bean; @@ -357,8 +356,8 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc try { PropertySourcesLoader loader = new PropertySourcesLoader(); for (String location : locations) { - Resource resource = this.resourceLoader.getResource(this.environment - .resolvePlaceholders(location)); + Resource resource = this.resourceLoader + .getResource(this.environment.resolvePlaceholders(location)); String[] profiles = this.environment.getActiveProfiles(); for (int i = profiles.length; i-- > 0;) { String profile = profiles[i]; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java index 59d290ae2c..16f5ec2e82 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java @@ -48,11 +48,12 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { public String[] selectImports(AnnotationMetadata metadata) { MultiValueMap attributes = metadata.getAllAnnotationAttributes( EnableConfigurationProperties.class.getName(), false); - Object[] type = attributes == null ? null : (Object[]) attributes - .getFirst("value"); + Object[] type = attributes == null ? null + : (Object[]) attributes.getFirst("value"); if (type == null || type.length == 0) { - return new String[] { ConfigurationPropertiesBindingPostProcessorRegistrar.class - .getName() }; + return new String[] { + ConfigurationPropertiesBindingPostProcessorRegistrar.class + .getName() }; } return new String[] { ConfigurationPropertiesBeanRegistrar.class.getName(), ConfigurationPropertiesBindingPostProcessorRegistrar.class.getName() }; @@ -61,8 +62,8 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { /** * {@link ImportBeanDefinitionRegistrar} for configuration properties support. */ - public static class ConfigurationPropertiesBeanRegistrar implements - ImportBeanDefinitionRegistrar { + public static class ConfigurationPropertiesBeanRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata metadata, @@ -73,8 +74,8 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { List> types = collectClasses(attributes.get("value")); for (Class type : types) { String prefix = extractPrefix(type); - String name = (StringUtils.hasText(prefix) ? prefix - + ".CONFIGURATION_PROPERTIES" : type.getName()); + String name = (StringUtils.hasText(prefix) + ? prefix + ".CONFIGURATION_PROPERTIES" : type.getName()); if (!registry.containsBeanDefinition(name)) { registerBeanDefinition(registry, type, name); } @@ -117,11 +118,13 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { } } - private void registerPropertiesHolder(BeanDefinitionRegistry registry, String name) { + private void registerPropertiesHolder(BeanDefinitionRegistry registry, + String name) { BeanDefinitionBuilder builder = BeanDefinitionBuilder .genericBeanDefinition(ConfigurationPropertiesHolder.class); builder.addConstructorArgReference(name); - registry.registerBeanDefinition(name + ".HOLDER", builder.getBeanDefinition()); + registry.registerBeanDefinition(name + ".HOLDER", + builder.getBeanDefinition()); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHiddenHttpMethodFilter.java b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHiddenHttpMethodFilter.java index 4b573879af..782a660fb1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHiddenHttpMethodFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHiddenHttpMethodFilter.java @@ -32,7 +32,8 @@ public class OrderedHiddenHttpMethodFilter extends HiddenHttpMethodFilter /** * The default order is high to ensure the filter is applied before Spring Security. */ - public static final int DEFAULT_ORDER = FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 10000; + public static final int DEFAULT_ORDER = FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER + - 10000; private int order = DEFAULT_ORDER; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHttpPutFormContentFilter.java b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHttpPutFormContentFilter.java index 807fd94a77..e8f594d892 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHttpPutFormContentFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHttpPutFormContentFilter.java @@ -26,13 +26,14 @@ import org.springframework.web.filter.HttpPutFormContentFilter; * @author Joao Pedro Evangelista * @since 1.3.0 */ -public class OrderedHttpPutFormContentFilter extends HttpPutFormContentFilter implements - Ordered { +public class OrderedHttpPutFormContentFilter extends HttpPutFormContentFilter + implements Ordered { /** * Higher order to ensure the filter is applied before Spring Security. */ - public static final int DEFAULT_ORDER = FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 9900; + public static final int DEFAULT_ORDER = FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER + - 9900; private int order = DEFAULT_ORDER; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/ServerPortInfoApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/web/ServerPortInfoApplicationContextInitializer.java index 770b3b9ad4..ddc84866a4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/ServerPortInfoApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/ServerPortInfoApplicationContextInitializer.java @@ -50,13 +50,13 @@ import org.springframework.util.StringUtils; * @author Phillip Webb * @since 1.3.0 */ -public class ServerPortInfoApplicationContextInitializer implements - ApplicationContextInitializer { +public class ServerPortInfoApplicationContextInitializer + implements ApplicationContextInitializer { @Override public void initialize(ConfigurableApplicationContext applicationContext) { - applicationContext - .addApplicationListener(new ApplicationListener() { + applicationContext.addApplicationListener( + new ApplicationListener() { @Override public void onApplicationEvent( EmbeddedServletContainerInitializedEvent event) { @@ -68,8 +68,8 @@ public class ServerPortInfoApplicationContextInitializer implements protected void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) { String propertyName = getPropertyName(event.getApplicationContext()); - setPortProperty(event.getApplicationContext(), propertyName, event - .getEmbeddedServletContainer().getPort()); + setPortProperty(event.getApplicationContext(), propertyName, + event.getEmbeddedServletContainer().getPort()); } protected String getPropertyName(EmbeddedWebApplicationContext context) { @@ -80,7 +80,8 @@ public class ServerPortInfoApplicationContextInitializer implements return "local." + name + ".port"; } - private void setPortProperty(ApplicationContext context, String propertyName, int port) { + private void setPortProperty(ApplicationContext context, String propertyName, + int port) { if (context instanceof ConfigurableApplicationContext) { ConfigurableEnvironment environment = ((ConfigurableApplicationContext) context) .getEnvironment(); @@ -93,8 +94,8 @@ public class ServerPortInfoApplicationContextInitializer implements } else { @SuppressWarnings("unchecked") - Map value = (Map) sources.get( - "server.ports").getSource(); + Map value = (Map) sources + .get("server.ports").getSource(); map = value; } map.put(propertyName, port); diff --git a/spring-boot/src/main/java/org/springframework/boot/env/EnvironmentPostProcessingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/env/EnvironmentPostProcessingApplicationListener.java index 9653c98f28..ffacd2beba 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/EnvironmentPostProcessingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/EnvironmentPostProcessingApplicationListener.java @@ -37,8 +37,8 @@ import org.springframework.core.io.support.SpringFactoriesLoader; * @since 1.3.0 * @see SpringFactoriesLoader#loadFactories(Class, ClassLoader) */ -public class EnvironmentPostProcessingApplicationListener implements - ApplicationListener, Ordered { +public class EnvironmentPostProcessingApplicationListener + implements ApplicationListener, Ordered { /** * The order for the {@link EnvironmentPostProcessingApplicationListener}. @@ -48,8 +48,8 @@ public class EnvironmentPostProcessingApplicationListener implements @Override public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { List postProcessors = SpringFactoriesLoader - .loadFactories(EnvironmentPostProcessor.class, getClass() - .getClassLoader()); + .loadFactories(EnvironmentPostProcessor.class, + getClass().getClassLoader()); for (EnvironmentPostProcessor postProcessor : postProcessors) { postProcessor.postProcessEnvironment(event.getEnvironment(), event.getSpringApplication()); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java index d2df2c5a5c..111368ee2c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java @@ -95,7 +95,8 @@ public abstract class AbstractLoggingSystem extends LoggingSystem { private String findConfig(String[] locations) { for (String location : locations) { - ClassPathResource resource = new ClassPathResource(location, this.classLoader); + ClassPathResource resource = new ClassPathResource(location, + this.classLoader); if (resource.exists()) { return "classpath:" + location; } @@ -121,8 +122,8 @@ public abstract class AbstractLoggingSystem extends LoggingSystem { for (int i = 0; i < locations.length; i++) { String extension = StringUtils.getFilenameExtension(locations[i]); locations[i] = locations[i].substring(0, - locations[i].length() - extension.length() - 1) - + "-spring." + extension; + locations[i].length() - extension.length() - 1) + "-spring." + + extension; } return locations; } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/ClasspathLoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/ClasspathLoggingApplicationListener.java index 051f93af23..e6a3c0b519 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/ClasspathLoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/ClasspathLoggingApplicationListener.java @@ -36,8 +36,8 @@ import org.springframework.core.ResolvableType; * * @author Andy Wilkinson */ -public final class ClasspathLoggingApplicationListener implements - GenericApplicationListener { +public final class ClasspathLoggingApplicationListener + implements GenericApplicationListener { private static final int ORDER = LoggingApplicationListener.DEFAULT_ORDER + 1; @@ -53,8 +53,8 @@ public final class ClasspathLoggingApplicationListener implements } else if (event instanceof ApplicationFailedEvent) { if (this.logger.isInfoEnabled()) { - this.logger.info("Application failed to start with classpath: " - + getClasspath()); + this.logger.info( + "Application failed to start with classpath: " + getClasspath()); } } } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java index 7dcab872ae..eea8f4bc4e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java @@ -49,6 +49,7 @@ import org.springframework.boot.ansi.AnsiStyle; public final class ColorConverter extends LogEventPatternConverter { private static final Map ELEMENTS; + static { Map elements = new HashMap(); elements.put("faint", AnsiStyle.FAINT); @@ -62,6 +63,7 @@ public final class ColorConverter extends LogEventPatternConverter { } private static final Map LEVELS; + static { Map levels = new HashMap(); levels.put(Level.FATAL.intLevel(), AnsiColor.RED); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index aae4cc47ff..8d81ab6a0c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -110,8 +110,9 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { LoggerContext context = getLoggerContext(); stopAndReset(context); LogbackConfigurator configurator = new LogbackConfigurator(context); - context.putProperty("LOG_LEVEL_PATTERN", initializationContext.getEnvironment() - .resolvePlaceholders("${logging.pattern.level:${LOG_LEVEL_PATTERN:%5p}}")); + context.putProperty("LOG_LEVEL_PATTERN", + initializationContext.getEnvironment().resolvePlaceholders( + "${logging.pattern.level:${LOG_LEVEL_PATTERN:%5p}}")); new DefaultLogbackConfiguration(initializationContext, logFile) .apply(configurator); } @@ -142,8 +143,8 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { } } if (errors.length() > 0) { - throw new IllegalStateException("Logback configuration error " - + "detected: \n" + errors); + throw new IllegalStateException( + "Logback configuration error " + "detected: \n" + errors); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java index c1d5045fdd..256c4ffeed 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java @@ -44,8 +44,8 @@ class SpringBootJoranConfigurator extends JoranConfigurator { Environment environment = this.initializationContext.getEnvironment(); rs.addRule(new ElementSelector("configuration/springProperty"), new SpringPropertyAction(environment)); - rs.addRule(new ElementSelector("*/springProfile"), new SpringProfileAction( - this.initializationContext.getEnvironment())); + rs.addRule(new ElementSelector("*/springProfile"), + new SpringProfileAction(this.initializationContext.getEnvironment())); rs.addRule(new ElementSelector("*/springProfile/*"), new NOPAction()); } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java index 47001caa80..63498354d1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java @@ -67,8 +67,8 @@ class SpringProfileAction extends Action implements InPlayListener { } private boolean acceptsProfiles(InterpretationContext ic, Attributes attributes) { - String[] profileNames = StringUtils.commaDelimitedListToStringArray(attributes - .getValue(NAME_ATTRIBUTE)); + String[] profileNames = StringUtils + .commaDelimitedListToStringArray(attributes.getValue(NAME_ATTRIBUTE)); if (profileNames.length != 0) { for (String profileName : profileNames) { OptionHelper.substVars(profileName, ic, this.context); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringPropertyAction.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringPropertyAction.java index 00b0dce3f6..e40b05a5fc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringPropertyAction.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringPropertyAction.java @@ -50,7 +50,8 @@ class SpringPropertyAction extends Action { String source = attributes.getValue(SOURCE_ATTRIBUTE); Scope scope = ActionUtil.stringToScope(attributes.getValue(SCOPE_ATTRIBUTE)); if (OptionHelper.isEmpty(name) || OptionHelper.isEmpty(source)) { - addError("The \"name\" and \"source\" attributes of must be set"); + addError( + "The \"name\" and \"source\" attributes of must be set"); } ActionUtil.setProperty(ic, name, getValue(source), scope); } diff --git a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java index f0ace565a4..1788dbba6e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java @@ -162,14 +162,14 @@ public class EntityManagerFactoryBuilder { public LocalContainerEntityManagerFactoryBean build() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); if (EntityManagerFactoryBuilder.this.persistenceUnitManager != null) { - entityManagerFactoryBean - .setPersistenceUnitManager(EntityManagerFactoryBuilder.this.persistenceUnitManager); + entityManagerFactoryBean.setPersistenceUnitManager( + EntityManagerFactoryBuilder.this.persistenceUnitManager); } if (this.persistenceUnit != null) { entityManagerFactoryBean.setPersistenceUnitName(this.persistenceUnit); } - entityManagerFactoryBean - .setJpaVendorAdapter(EntityManagerFactoryBuilder.this.jpaVendorAdapter); + entityManagerFactoryBean.setJpaVendorAdapter( + EntityManagerFactoryBuilder.this.jpaVendorAdapter); if (this.jta) { entityManagerFactoryBean.setJtaDataSource(this.dataSource); @@ -179,8 +179,8 @@ public class EntityManagerFactoryBuilder { } entityManagerFactoryBean.setPackagesToScan(this.packagesToScan); - entityManagerFactoryBean.getJpaPropertyMap().putAll( - EntityManagerFactoryBuilder.this.jpaProperties); + entityManagerFactoryBean.getJpaPropertyMap() + .putAll(EntityManagerFactoryBuilder.this.jpaProperties); entityManagerFactoryBean.getJpaPropertyMap().putAll(this.properties); if (EntityManagerFactoryBuilder.this.callback != null) { EntityManagerFactoryBuilder.this.callback diff --git a/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java b/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java index aaf17897a3..9ce9354b34 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java @@ -37,7 +37,8 @@ public class IntegrationTestPropertiesListener extends AbstractTestExecutionList public void prepareTestInstance(TestContext testContext) throws Exception { Class testClass = testContext.getTestClass(); AnnotationAttributes annotationAttributes = AnnotatedElementUtils - .getMergedAnnotationAttributes(testClass, IntegrationTest.class.getName()); + .getMergedAnnotationAttributes(testClass, + IntegrationTest.class.getName()); if (annotationAttributes != null) { addPropertySourceProperties(testContext, annotationAttributes.getStringArray("value")); diff --git a/spring-boot/src/main/java/org/springframework/boot/test/MergedContextConfigurationProperties.java b/spring-boot/src/main/java/org/springframework/boot/test/MergedContextConfigurationProperties.java index c0032f73e5..b86768b208 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/MergedContextConfigurationProperties.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/MergedContextConfigurationProperties.java @@ -38,8 +38,8 @@ class MergedContextConfigurationProperties { } public void add(String[] properties, String... additional) { - Set merged = new LinkedHashSet((Arrays.asList(this.configuration - .getPropertySourceProperties()))); + Set merged = new LinkedHashSet( + (Arrays.asList(this.configuration.getPropertySourceProperties()))); merged.addAll(Arrays.asList(properties)); merged.addAll(Arrays.asList(additional)); addIntegrationTestProperty(merged); diff --git a/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java b/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java index a017613ee8..3f94bd7efb 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java @@ -136,7 +136,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { return sources; } - private void setActiveProfiles(ConfigurableEnvironment environment, String[] profiles) { + private void setActiveProfiles(ConfigurableEnvironment environment, + String[] profiles) { EnvironmentTestUtils.addEnvironment(environment, "spring.profiles.active=" + StringUtils.arrayToCommaDelimitedString(profiles)); } @@ -146,8 +147,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { Map properties = new LinkedHashMap(); // JMX bean names will clash if the same bean is used in multiple contexts disableJmx(properties); - properties.putAll(extractEnvironmentProperties(config - .getPropertySourceProperties())); + properties.putAll( + extractEnvironmentProperties(config.getPropertySourceProperties())); if (!TestAnnotations.isIntegrationTest(config)) { properties.putAll(getDefaultEnvironmentProperties()); } @@ -170,8 +171,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { return asMap(properties); } catch (IOException ex) { - throw new IllegalStateException("Unexpected could not load properties from '" - + content + "'", ex); + throw new IllegalStateException( + "Unexpected could not load properties from '" + content + "'", ex); } } @@ -198,8 +199,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { private List> getInitializers( MergedContextConfiguration mergedConfig, SpringApplication application) { List> initializers = new ArrayList>(); - initializers.add(new PropertySourceLocationsInitializer(mergedConfig - .getPropertySourceLocations())); + initializers.add(new PropertySourceLocationsInitializer( + mergedConfig.getPropertySourceLocations())); initializers.addAll(application.getInitializers()); for (Class> initializerClass : mergedConfig .getContextInitializerClasses()) { @@ -213,8 +214,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { ContextConfigurationAttributes configAttributes) { super.processContextConfiguration(configAttributes); if (!configAttributes.hasResources()) { - Class[] defaultConfigClasses = detectDefaultConfigurationClasses(configAttributes - .getDeclaringClass()); + Class[] defaultConfigClasses = detectDefaultConfigurationClasses( + configAttributes.getDeclaringClass()); configAttributes.setClasses(defaultConfigClasses); } } @@ -271,8 +272,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { WebMergedContextConfiguration webConfiguration) { SpringBootMockServletContext servletContext = new SpringBootMockServletContext( webConfiguration.getResourceBasePath()); - initializers.add(0, new ServletContextApplicationContextInitializer( - servletContext)); + initializers.add(0, + new ServletContextApplicationContextInitializer(servletContext)); } } @@ -280,8 +281,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { /** * {@link ApplicationContextInitializer} to setup test property source locations. */ - private static class PropertySourceLocationsInitializer implements - ApplicationContextInitializer { + private static class PropertySourceLocationsInitializer + implements ApplicationContextInitializer { private final String[] propertySourceLocations; @@ -299,9 +300,10 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { private static class TestAnnotations { - public static boolean isIntegrationTest(MergedContextConfiguration configuration) { - return (hasAnnotation(configuration, IntegrationTest.class) || hasAnnotation( - configuration, WebIntegrationTest.class)); + public static boolean isIntegrationTest( + MergedContextConfiguration configuration) { + return (hasAnnotation(configuration, IntegrationTest.class) + || hasAnnotation(configuration, WebIntegrationTest.class)); } private static boolean hasAnnotation(MergedContextConfiguration configuration, diff --git a/spring-boot/src/main/java/org/springframework/boot/test/TestRestTemplate.java b/spring-boot/src/main/java/org/springframework/boot/test/TestRestTemplate.java index 0b4f06fe04..afa4729c5a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/TestRestTemplate.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/TestRestTemplate.java @@ -68,8 +68,8 @@ public class TestRestTemplate extends RestTemplate { public TestRestTemplate(String username, String password, HttpClientOption... httpClientOptions) { if (ClassUtils.isPresent("org.apache.http.client.config.RequestConfig", null)) { - setRequestFactory(new CustomHttpComponentsClientHttpRequestFactory( - httpClientOptions)); + setRequestFactory( + new CustomHttpComponentsClientHttpRequestFactory(httpClientOptions)); } addAuthentication(username, password); setErrorHandler(new DefaultResponseErrorHandler() { @@ -85,8 +85,8 @@ public class TestRestTemplate extends RestTemplate { return; } List interceptors = Collections - .singletonList(new BasicAuthorizationInterceptor( - username, password)); + .singletonList( + new BasicAuthorizationInterceptor(username, password)); setRequestFactory(new InterceptingClientHttpRequestFactory(getRequestFactory(), interceptors)); } @@ -108,8 +108,8 @@ public class TestRestTemplate extends RestTemplate { } - private static class BasicAuthorizationInterceptor implements - ClientHttpRequestInterceptor { + private static class BasicAuthorizationInterceptor + implements ClientHttpRequestInterceptor { private final String username; @@ -133,8 +133,8 @@ public class TestRestTemplate extends RestTemplate { /** * {@link HttpComponentsClientHttpRequestFactory} to apply customizations. */ - protected static class CustomHttpComponentsClientHttpRequestFactory extends - HttpComponentsClientHttpRequestFactory { + protected static class CustomHttpComponentsClientHttpRequestFactory + extends HttpComponentsClientHttpRequestFactory { private final String cookieSpec; @@ -144,8 +144,8 @@ public class TestRestTemplate extends RestTemplate { HttpClientOption[] httpClientOptions) { Set options = new HashSet( Arrays.asList(httpClientOptions)); - this.cookieSpec = (options.contains(HttpClientOption.ENABLE_COOKIES) ? CookieSpecs.STANDARD - : CookieSpecs.IGNORE_COOKIES); + this.cookieSpec = (options.contains(HttpClientOption.ENABLE_COOKIES) + ? CookieSpecs.STANDARD : CookieSpecs.IGNORE_COOKIES); this.enableRedirects = options.contains(HttpClientOption.ENABLE_REDIRECTS); } diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java index 46089b2598..6df72c29ff 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java @@ -49,12 +49,13 @@ abstract class ServletComponentHandler { return this.typeFilter; } - protected String[] extractUrlPatterns(String attribute, Map attributes) { + protected String[] extractUrlPatterns(String attribute, + Map attributes) { String[] value = (String[]) attributes.get("value"); String[] urlPatterns = (String[]) attributes.get("urlPatterns"); if (urlPatterns.length > 0) { - Assert.state(value.length == 0, "The urlPatterns and value attributes " - + "are mututally exclusive"); + Assert.state(value.length == 0, + "The urlPatterns and value attributes " + "are mututally exclusive"); return urlPatterns; } return value; diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java index 2ef2834ce0..3448969e79 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java @@ -40,10 +40,11 @@ import org.springframework.context.annotation.ScannedGenericBeanDefinition; * @see ServletComponentScan * @see ServletComponentScanRegistrar */ -class ServletComponentRegisteringPostProcessor implements BeanFactoryPostProcessor, - ApplicationContextAware { +class ServletComponentRegisteringPostProcessor + implements BeanFactoryPostProcessor, ApplicationContextAware { private static final List HANDLERS; + static { List handers = new ArrayList(); handers.add(new WebServletHandler()); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java index b1ff89c0c3..c4266f2bc7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java @@ -68,15 +68,15 @@ class ServletComponentScanRegistrar implements ImportBeanDefinitionRegistrar { Set packagesToScan) { GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(ServletComponentRegisteringPostProcessor.class); - beanDefinition.getConstructorArgumentValues().addGenericArgumentValue( - packagesToScan); + beanDefinition.getConstructorArgumentValues() + .addGenericArgumentValue(packagesToScan); beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); registry.registerBeanDefinition(BEAN_NAME, beanDefinition); } private Set getPackagesToScan(AnnotationMetadata metadata) { - AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(ServletComponentScan.class.getName())); + AnnotationAttributes attributes = AnnotationAttributes.fromMap( + metadata.getAnnotationAttributes(ServletComponentScan.class.getName())); String[] value = attributes.getStringArray("value"); String[] basePackages = attributes.getStringArray("basePackages"); Class[] basePackageClasses = attributes.getClassArray("basePackageClasses"); @@ -92,8 +92,8 @@ class ServletComponentScanRegistrar implements ImportBeanDefinitionRegistrar { packagesToScan.add(ClassUtils.getPackageName(basePackageClass)); } if (packagesToScan.isEmpty()) { - return Collections.singleton(ClassUtils.getPackageName(metadata - .getClassName())); + return Collections + .singleton(ClassUtils.getPackageName(metadata.getClassName())); } return packagesToScan; } diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebFilterHandler.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebFilterHandler.java index c5a4100b1e..31a85f5c90 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebFilterHandler.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebFilterHandler.java @@ -57,7 +57,8 @@ class WebFilterHandler extends ServletComponentHandler { registry.registerBeanDefinition(name, builder.getBeanDefinition()); } - private EnumSet extractDispatcherTypes(Map attributes) { + private EnumSet extractDispatcherTypes( + Map attributes) { DispatcherType[] dispatcherTypes = (DispatcherType[]) attributes .get("dispatcherTypes"); if (dispatcherTypes.length == 0) { @@ -72,8 +73,8 @@ class WebFilterHandler extends ServletComponentHandler { private String determineName(Map attributes, BeanDefinition beanDefinition) { - return (String) (StringUtils.hasText((String) attributes.get("filterName")) ? attributes - .get("filterName") : beanDefinition.getBeanClassName()); + return (String) (StringUtils.hasText((String) attributes.get("filterName")) + ? attributes.get("filterName") : beanDefinition.getBeanClassName()); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebListenerHandler.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebListenerHandler.java index b40bf626f2..f34a3f935a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebListenerHandler.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebListenerHandler.java @@ -37,8 +37,8 @@ class WebListenerHandler extends ServletComponentHandler { } @Override - protected void doHandle(Map attributes, - BeanDefinition beanDefinition, BeanDefinitionRegistry registry) { + protected void doHandle(Map attributes, BeanDefinition beanDefinition, + BeanDefinitionRegistry registry) { BeanDefinitionBuilder builder = BeanDefinitionBuilder .rootBeanDefinition(ServletListenerRegistrationBean.class); builder.addPropertyValue("listener", beanDefinition); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebServletHandler.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebServletHandler.java index 88a009ea79..a4e8ff0b0a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebServletHandler.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebServletHandler.java @@ -55,8 +55,8 @@ class WebServletHandler extends ServletComponentHandler { private String determineName(Map attributes, BeanDefinition beanDefinition) { - return (String) (StringUtils.hasText((String) attributes.get("name")) ? attributes - .get("name") : beanDefinition.getBeanClassName()); + return (String) (StringUtils.hasText((String) attributes.get("name")) + ? attributes.get("name") : beanDefinition.getBeanClassName()); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/yaml/ArrayDocumentMatcher.java b/spring-boot/src/main/java/org/springframework/boot/yaml/ArrayDocumentMatcher.java index 12a1df5509..fc92743c16 100644 --- a/spring-boot/src/main/java/org/springframework/boot/yaml/ArrayDocumentMatcher.java +++ b/spring-boot/src/main/java/org/springframework/boot/yaml/ArrayDocumentMatcher.java @@ -48,8 +48,8 @@ public class ArrayDocumentMatcher implements DocumentMatcher { if (!properties.containsKey(this.key)) { return MatchStatus.ABSTAIN; } - Set values = StringUtils.commaDelimitedListToSet(properties - .getProperty(this.key)); + Set values = StringUtils + .commaDelimitedListToSet(properties.getProperty(this.key)); if (values.isEmpty()) { values = Collections.singleton(""); } diff --git a/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java b/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java index 1d8b3eb933..2abd056504 100644 --- a/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java @@ -72,7 +72,8 @@ public class DefaultApplicationArgumentsTests { @Test public void getOptionValues() throws Exception { ApplicationArguments arguments = new DefaultApplicationArguments(ARGS); - assertThat(arguments.getOptionValues("foo"), equalTo(Arrays.asList("bar", "baz"))); + assertThat(arguments.getOptionValues("foo"), + equalTo(Arrays.asList("bar", "baz"))); assertThat(arguments.getOptionValues("debug"), equalTo(Collections.emptyList())); assertThat(arguments.getOptionValues("spring"), equalTo(null)); @@ -81,14 +82,16 @@ public class DefaultApplicationArgumentsTests { @Test public void getNonOptionArgs() throws Exception { ApplicationArguments arguments = new DefaultApplicationArguments(ARGS); - assertThat(arguments.getNonOptionArgs(), equalTo(Arrays.asList("spring", "boot"))); + assertThat(arguments.getNonOptionArgs(), + equalTo(Arrays.asList("spring", "boot"))); } @Test public void getNoNonOptionArgs() throws Exception { ApplicationArguments arguments = new DefaultApplicationArguments( new String[] { "--debug" }); - assertThat(arguments.getNonOptionArgs(), equalTo(Collections.emptyList())); + assertThat(arguments.getNonOptionArgs(), + equalTo(Collections.emptyList())); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java b/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java index 3986286b4f..edf0a3f09f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java @@ -52,10 +52,10 @@ public class OverrideSourcesTests { @Test public void primaryBeanInjectedProvingSourcesNotOverridden() { - this.context = SpringApplication - .run(new Object[] { MainConfiguration.class, TestConfiguration.class }, - new String[] { "--spring.main.web_environment=false", - "--spring.main.sources=org.springframework.boot.OverrideSourcesTests.MainConfiguration" }); + this.context = SpringApplication.run( + new Object[] { MainConfiguration.class, TestConfiguration.class }, + new String[] { "--spring.main.web_environment=false", + "--spring.main.sources=org.springframework.boot.OverrideSourcesTests.MainConfiguration" }); assertEquals("bar", this.context.getBean(Service.class).bean.name); } diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index e0284c77d5..8e068643d8 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -234,14 +234,13 @@ public class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebEnvironment(false); final AtomicReference reference = new AtomicReference(); - application - .setInitializers(Arrays - .asList(new ApplicationContextInitializer() { - @Override - public void initialize(ConfigurableApplicationContext context) { - reference.set(context); - } - })); + application.setInitializers(Arrays.asList( + new ApplicationContextInitializer() { + @Override + public void initialize(ConfigurableApplicationContext context) { + reference.set(context); + } + })); this.context = application.run("--foo=bar"); assertThat(this.context, sameInstance(reference.get())); // Custom initializers do not switch off the defaults @@ -253,8 +252,8 @@ public class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebEnvironment(false); final AtomicReference reference = new AtomicReference(); - class ApplicationReadyEventListener implements - ApplicationListener { + class ApplicationReadyEventListener + implements ApplicationListener { @Override public void onApplicationEvent(ApplicationReadyEvent event) { reference.set(event.getSpringApplication()); @@ -288,8 +287,8 @@ public class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebEnvironment(false); final List events = new ArrayList(); - class ApplicationRunningEventListener implements - ApplicationListener { + class ApplicationRunningEventListener + implements ApplicationListener { @Override public void onApplicationEvent(ApplicationEvent event) { events.add((event)); @@ -325,7 +324,8 @@ public class SpringApplicationTests { @Test public void customEnvironment() throws Exception { - TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); + TestSpringApplication application = new TestSpringApplication( + ExampleConfig.class); application.setWebEnvironment(false); ConfigurableEnvironment environment = new StandardEnvironment(); application.setEnvironment(environment); @@ -335,7 +335,8 @@ public class SpringApplicationTests { @Test public void customResourceLoader() throws Exception { - TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); + TestSpringApplication application = new TestSpringApplication( + ExampleConfig.class); application.setWebEnvironment(false); ResourceLoader resourceLoader = new DefaultResourceLoader(); application.setResourceLoader(resourceLoader); @@ -382,9 +383,8 @@ public class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebEnvironment(false); ConfigurableEnvironment environment = new StandardEnvironment(); - environment.getPropertySources().addFirst( - new MapPropertySource("commandLineArgs", Collections - .singletonMap("foo", "original"))); + environment.getPropertySources().addFirst(new MapPropertySource("commandLineArgs", + Collections.singletonMap("foo", "original"))); application.setEnvironment(environment); this.context = application.run("--foo=bar", "--bar=foo"); assertTrue(hasPropertySource(environment, CompositePropertySource.class, @@ -458,8 +458,8 @@ public class SpringApplicationTests { ConfigurableEnvironment environment = new StandardEnvironment(); application.setEnvironment(environment); this.context = application.run("--foo=bar"); - assertFalse(hasPropertySource(environment, PropertySource.class, - "commandLineArgs")); + assertFalse( + hasPropertySource(environment, PropertySource.class, "commandLineArgs")); } @Test @@ -485,7 +485,8 @@ public class SpringApplicationTests { @Test public void wildcardSources() { - Object[] sources = { "classpath:org/springframework/boot/sample-${sample.app.test.prop}.xml" }; + Object[] sources = { + "classpath:org/springframework/boot/sample-${sample.app.test.prop}.xml" }; TestSpringApplication application = new TestSpringApplication(sources); application.setWebEnvironment(false); this.context = application.run(); @@ -499,8 +500,8 @@ public class SpringApplicationTests { @Test public void runComponents() throws Exception { - this.context = SpringApplication.run(new Object[] { ExampleWebConfig.class, - Object.class }, new String[0]); + this.context = SpringApplication.run( + new Object[] { ExampleWebConfig.class, Object.class }, new String[0]); assertNotNull(this.context); } @@ -541,7 +542,8 @@ public class SpringApplicationTests { @Test public void commandLineArgsApplyToSpringApplication() throws Exception { - TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); + TestSpringApplication application = new TestSpringApplication( + ExampleConfig.class); application.setWebEnvironment(false); this.context = application.run("--spring.main.show_banner=false"); assertThat(application.getShowBanner(), is(false)); @@ -602,7 +604,8 @@ public class SpringApplicationTests { @Test public void headless() throws Exception { - TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); + TestSpringApplication application = new TestSpringApplication( + ExampleConfig.class); application.setWebEnvironment(false); this.context = application.run(); assertThat(System.getProperty("java.awt.headless"), equalTo("true")); @@ -610,7 +613,8 @@ public class SpringApplicationTests { @Test public void headlessFalse() throws Exception { - TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); + TestSpringApplication application = new TestSpringApplication( + ExampleConfig.class); application.setWebEnvironment(false); application.setHeadless(false); this.context = application.run(); @@ -620,7 +624,8 @@ public class SpringApplicationTests { @Test public void headlessSystemPropertyTakesPrecedence() throws Exception { System.setProperty("java.awt.headless", "false"); - TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); + TestSpringApplication application = new TestSpringApplication( + ExampleConfig.class); application.setWebEnvironment(false); this.context = application.run(); assertThat(System.getProperty("java.awt.headless"), equalTo("false")); @@ -628,7 +633,8 @@ public class SpringApplicationTests { @Test public void getApplicationArgumentsBean() throws Exception { - TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); + TestSpringApplication application = new TestSpringApplication( + ExampleConfig.class); application.setWebEnvironment(false); this.context = application.run("--debug", "spring", "boot"); ApplicationArguments args = this.context.getBean(ApplicationArguments.class); @@ -638,14 +644,16 @@ public class SpringApplicationTests { @Test public void webEnvironmentSwitchedOffInListener() throws Exception { - TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); - application - .addListeners(new ApplicationListener() { + TestSpringApplication application = new TestSpringApplication( + ExampleConfig.class); + application.addListeners( + new ApplicationListener() { @Override public void onApplicationEvent( ApplicationEnvironmentPreparedEvent event) { - assertTrue(event.getEnvironment() instanceof StandardServletEnvironment); + assertTrue(event + .getEnvironment() instanceof StandardServletEnvironment); EnvironmentTestUtils.addEnvironment(event.getEnvironment(), "foo=bar"); event.getSpringApplication().setWebEnvironment(false); @@ -655,8 +663,8 @@ public class SpringApplicationTests { this.context = application.run(); assertFalse(this.context.getEnvironment() instanceof StandardServletEnvironment); assertEquals("bar", this.context.getEnvironment().getProperty("foo")); - assertEquals("test", this.context.getEnvironment().getPropertySources() - .iterator().next().getName()); + assertEquals("test", this.context.getEnvironment().getPropertySources().iterator() + .next().getName()); } private boolean hasPropertySource(ConfigurableEnvironment environment, @@ -680,7 +688,8 @@ public class SpringApplicationTests { public static class SpyApplicationContext extends AnnotationConfigApplicationContext { - ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext()); + ConfigurableApplicationContext applicationContext = spy( + new AnnotationConfigApplicationContext()); @Override public void registerShutdownHook() { @@ -832,8 +841,8 @@ public class SpringApplicationTests { } - private static class TestCommandLineRunner extends AbstractTestRunner implements - CommandLineRunner { + private static class TestCommandLineRunner extends AbstractTestRunner + implements CommandLineRunner { TestCommandLineRunner(int order, String... expectedBefore) { super(order, expectedBefore); @@ -846,8 +855,8 @@ public class SpringApplicationTests { } - private static class TestApplicationRunner extends AbstractTestRunner implements - ApplicationRunner { + private static class TestApplicationRunner extends AbstractTestRunner + implements ApplicationRunner { TestApplicationRunner(int order, String... expectedBefore) { super(order, expectedBefore); diff --git a/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java b/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java index f84018425b..fd44298dc6 100644 --- a/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java @@ -58,7 +58,8 @@ public class AnsiPropertySourceTests { @Test public void getAnsi() throws Exception { - assertThat(this.source.getProperty("Ansi.BOLD"), equalTo((Object) AnsiStyle.BOLD)); + assertThat(this.source.getProperty("Ansi.BOLD"), + equalTo((Object) AnsiStyle.BOLD)); assertThat(this.source.getProperty("Ansi.RED"), equalTo((Object) AnsiColor.RED)); assertThat(this.source.getProperty("Ansi.BG_RED"), equalTo((Object) AnsiBackground.RED)); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcherTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcherTests.java index ed273d5d8c..7380119385 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcherTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcherTests.java @@ -39,8 +39,9 @@ public class DefaultPropertyNamePatternsMatcherTests { @Test public void namesExactMatch() { - assertTrue(new DefaultPropertyNamePatternsMatcher(DELIMITERS, "aaaa", "bbbb", - "cccc").matches("bbbb")); + assertTrue( + new DefaultPropertyNamePatternsMatcher(DELIMITERS, "aaaa", "bbbb", "cccc") + .matches("bbbb")); } @Test @@ -51,20 +52,23 @@ public class DefaultPropertyNamePatternsMatcherTests { @Test public void nameWithDot() throws Exception { - assertTrue(new DefaultPropertyNamePatternsMatcher(DELIMITERS, "aaaa", "bbbb", - "cccc").matches("bbbb.anything")); + assertTrue( + new DefaultPropertyNamePatternsMatcher(DELIMITERS, "aaaa", "bbbb", "cccc") + .matches("bbbb.anything")); } @Test public void nameWithUnderscore() throws Exception { - assertTrue(new DefaultPropertyNamePatternsMatcher(DELIMITERS, "aaaa", "bbbb", - "cccc").matches("bbbb_anything")); + assertTrue( + new DefaultPropertyNamePatternsMatcher(DELIMITERS, "aaaa", "bbbb", "cccc") + .matches("bbbb_anything")); } @Test public void namesMatchWithDifferentLengths() throws Exception { - assertTrue(new DefaultPropertyNamePatternsMatcher(DELIMITERS, "aaa", "bbbb", - "ccccc").matches("bbbb")); + assertTrue( + new DefaultPropertyNamePatternsMatcher(DELIMITERS, "aaa", "bbbb", "ccccc") + .matches("bbbb")); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryParameterizedTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryParameterizedTests.java index f7dd003791..6e9aa5c32f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryParameterizedTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryParameterizedTests.java @@ -51,9 +51,8 @@ public class PropertiesConfigurationFactoryParameterizedTests { @Parameters public static Object[] parameters() { - return new Object[] { new Object[] { false, false }, - new Object[] { false, true }, new Object[] { true, false }, - new Object[] { true, true } }; + return new Object[] { new Object[] { false, false }, new Object[] { false, true }, + new Object[] { true, false }, new Object[] { true, true } }; } public PropertiesConfigurationFactoryParameterizedTests(boolean ignoreUnknownFields, diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java index 7f1fec63a8..0b444de215 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java @@ -409,8 +409,8 @@ public class RelaxedDataBinderTests { bind(target, "nested.foo: bar.key\n" + "nested[bar.key].spam: bucket\n" + "nested[bar.key].value: 123\nnested[bar.key].foo: crap"); assertEquals(2, target.getNested().size()); - Map nestedMap = (Map) target.getNested().get( - "bar.key"); + Map nestedMap = (Map) target.getNested() + .get("bar.key"); assertNotNull("nested map should be registered with 'bar.key'", nestedMap); assertEquals(3, nestedMap.size()); assertEquals("123", nestedMap.get("value")); diff --git a/spring-boot/src/test/java/org/springframework/boot/cloud/cloudfoundry/CloudFoundryVcapEnvironmentPostProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/cloud/cloudfoundry/CloudFoundryVcapEnvironmentPostProcessorTests.java index 89cdb1b0f8..a878574257 100644 --- a/spring-boot/src/test/java/org/springframework/boot/cloud/cloudfoundry/CloudFoundryVcapEnvironmentPostProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/cloud/cloudfoundry/CloudFoundryVcapEnvironmentPostProcessorTests.java @@ -39,21 +39,19 @@ public class CloudFoundryVcapEnvironmentPostProcessorTests { @Test public void testApplicationProperties() { - EnvironmentTestUtils - .addEnvironment( - this.context, - "VCAP_APPLICATION:{\"application_users\":[]," - + "\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\"," - + "\"instance_index\":0,\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\"," - + "\"name\":\"foo\",\"uris\":[\"foo.cfapps.io\"]," - + "\"started_at\":\"2013-05-29 02:37:59 +0000\"," - + "\"started_at_timestamp\":1369795079," - + "\"host\":\"0.0.0.0\",\"port\":61034," - + "\"limits\":{\"mem\":128,\"disk\":1024,\"fds\":16384}," - + "\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\"," - + "\"name\":\"dsyerenv\",\"uris\":[\"dsyerenv.cfapps.io\"]," - + "\"users\":[],\"start\":\"2013-05-29 02:37:59 +0000\"," - + "\"state_timestamp\":1369795079}"); + EnvironmentTestUtils.addEnvironment(this.context, + "VCAP_APPLICATION:{\"application_users\":[]," + + "\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\"," + + "\"instance_index\":0,\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\"," + + "\"name\":\"foo\",\"uris\":[\"foo.cfapps.io\"]," + + "\"started_at\":\"2013-05-29 02:37:59 +0000\"," + + "\"started_at_timestamp\":1369795079," + + "\"host\":\"0.0.0.0\",\"port\":61034," + + "\"limits\":{\"mem\":128,\"disk\":1024,\"fds\":16384}," + + "\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\"," + + "\"name\":\"dsyerenv\",\"uris\":[\"dsyerenv.cfapps.io\"]," + + "\"users\":[],\"start\":\"2013-05-29 02:37:59 +0000\"," + + "\"state_timestamp\":1369795079}"); this.initializer.postProcessEnvironment(this.context.getEnvironment(), null); assertEquals("bb7935245adf3e650dfb7c58a06e9ece", this.context.getEnvironment() .getProperty("vcap.application.instance_id")); @@ -61,10 +59,8 @@ public class CloudFoundryVcapEnvironmentPostProcessorTests { @Test public void testApplicationUris() { - EnvironmentTestUtils - .addEnvironment( - this.context, - "VCAP_APPLICATION:{\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\",\"instance_index\":0,\"uris\":[\"foo.cfapps.io\"]}"); + EnvironmentTestUtils.addEnvironment(this.context, + "VCAP_APPLICATION:{\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\",\"instance_index\":0,\"uris\":[\"foo.cfapps.io\"]}"); this.initializer.postProcessEnvironment(this.context.getEnvironment(), null); assertEquals("foo.cfapps.io", this.context.getEnvironment().getProperty("vcap.application.uris[0]")); @@ -79,39 +75,35 @@ public class CloudFoundryVcapEnvironmentPostProcessorTests { @Test public void testNullApplicationProperties() { - EnvironmentTestUtils - .addEnvironment( - this.context, - "VCAP_APPLICATION:{\"application_users\":null," - + "\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\"," - + "\"instance_index\":0,\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\"," - + "\"name\":\"foo\",\"uris\":[\"foo.cfapps.io\"]," - + "\"started_at\":\"2013-05-29 02:37:59 +0000\"," - + "\"started_at_timestamp\":1369795079," - + "\"host\":\"0.0.0.0\",\"port\":61034," - + "\"limits\":{\"mem\":128,\"disk\":1024,\"fds\":16384}," - + "\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\"," - + "\"name\":\"dsyerenv\",\"uris\":[\"dsyerenv.cfapps.io\"]," - + "\"users\":[],\"start\":\"2013-05-29 02:37:59 +0000\"," - + "\"state_timestamp\":1369795079}"); + EnvironmentTestUtils.addEnvironment(this.context, + "VCAP_APPLICATION:{\"application_users\":null," + + "\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\"," + + "\"instance_index\":0,\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\"," + + "\"name\":\"foo\",\"uris\":[\"foo.cfapps.io\"]," + + "\"started_at\":\"2013-05-29 02:37:59 +0000\"," + + "\"started_at_timestamp\":1369795079," + + "\"host\":\"0.0.0.0\",\"port\":61034," + + "\"limits\":{\"mem\":128,\"disk\":1024,\"fds\":16384}," + + "\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\"," + + "\"name\":\"dsyerenv\",\"uris\":[\"dsyerenv.cfapps.io\"]," + + "\"users\":[],\"start\":\"2013-05-29 02:37:59 +0000\"," + + "\"state_timestamp\":1369795079}"); this.initializer.postProcessEnvironment(this.context.getEnvironment(), null); assertNull(getProperty("vcap")); } @Test public void testServiceProperties() { - EnvironmentTestUtils - .addEnvironment( - this.context, - "VCAP_SERVICES:{\"rds-mysql-n/a\":[{" - + "\"name\":\"mysql\",\"label\":\"rds-mysql-n/a\"," - + "\"plan\":\"10mb\",\"credentials\":{" - + "\"name\":\"d04fb13d27d964c62b267bbba1cffb9da\"," - + "\"hostname\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\"," - + "\"ssl\":true,\"location\":null," - + "\"host\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\"," - + "\"port\":3306,\"user\":\"urpRuqTf8Cpe6\",\"username\":" - + "\"urpRuqTf8Cpe6\",\"password\":\"pxLsGVpsC9A5S\"}}]}"); + EnvironmentTestUtils.addEnvironment(this.context, + "VCAP_SERVICES:{\"rds-mysql-n/a\":[{" + + "\"name\":\"mysql\",\"label\":\"rds-mysql-n/a\"," + + "\"plan\":\"10mb\",\"credentials\":{" + + "\"name\":\"d04fb13d27d964c62b267bbba1cffb9da\"," + + "\"hostname\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\"," + + "\"ssl\":true,\"location\":null," + + "\"host\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\"," + + "\"port\":3306,\"user\":\"urpRuqTf8Cpe6\",\"username\":" + + "\"urpRuqTf8Cpe6\",\"password\":\"pxLsGVpsC9A5S\"}}]}"); this.initializer.postProcessEnvironment(this.context.getEnvironment(), null); assertEquals("mysql", getProperty("vcap.services.mysql.name")); assertEquals("3306", getProperty("vcap.services.mysql.credentials.port")); @@ -121,17 +113,15 @@ public class CloudFoundryVcapEnvironmentPostProcessorTests { @Test public void testServicePropertiesWithoutNA() { - EnvironmentTestUtils - .addEnvironment( - this.context, - "VCAP_SERVICES:{\"rds-mysql\":[{" - + "\"name\":\"mysql\",\"label\":\"rds-mysql\",\"plan\":\"10mb\"," - + "\"credentials\":{\"name\":\"d04fb13d27d964c62b267bbba1cffb9da\"," - + "\"hostname\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\"," - + "\"host\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\"," - + "\"port\":3306,\"user\":\"urpRuqTf8Cpe6\"," - + "\"username\":\"urpRuqTf8Cpe6\"," - + "\"password\":\"pxLsGVpsC9A5S\"}}]}"); + EnvironmentTestUtils.addEnvironment(this.context, + "VCAP_SERVICES:{\"rds-mysql\":[{" + + "\"name\":\"mysql\",\"label\":\"rds-mysql\",\"plan\":\"10mb\"," + + "\"credentials\":{\"name\":\"d04fb13d27d964c62b267bbba1cffb9da\"," + + "\"hostname\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\"," + + "\"host\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\"," + + "\"port\":3306,\"user\":\"urpRuqTf8Cpe6\"," + + "\"username\":\"urpRuqTf8Cpe6\"," + + "\"password\":\"pxLsGVpsC9A5S\"}}]}"); this.initializer.postProcessEnvironment(this.context.getEnvironment(), null); assertEquals("mysql", getProperty("vcap.services.mysql.name")); assertEquals("3306", getProperty("vcap.services.mysql.credentials.port")); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileEnvironmentPostProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileEnvironmentPostProcessorTests.java index 97ef108cfb..2d9d4b8b6b 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileEnvironmentPostProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileEnvironmentPostProcessorTests.java @@ -149,21 +149,20 @@ public class ConfigFileEnvironmentPostProcessorTests { EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:" + "classpath:enableprofile.properties,classpath:enableother.properties"); this.initializer.postProcessEnvironment(this.environment, this.application); - assertEquals("other", StringUtils.arrayToCommaDelimitedString(this.environment - .getActiveProfiles())); + assertEquals("other", StringUtils + .arrayToCommaDelimitedString(this.environment.getActiveProfiles())); String property = this.environment.getProperty("my.property"); assertThat(property, equalTo("fromotherpropertiesfile")); } @Test public void loadTwoPropertiesFilesWithProfilesAndSwitchOneOff() throws Exception { - EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:" - + "classpath:enabletwoprofiles.properties," - + "classpath:enableprofile.properties"); + EnvironmentTestUtils.addEnvironment(this.environment, + "spring.config.location:" + "classpath:enabletwoprofiles.properties," + + "classpath:enableprofile.properties"); this.initializer.postProcessEnvironment(this.environment, this.application); - assertEquals("myprofile", - StringUtils.arrayToCommaDelimitedString(this.environment - .getActiveProfiles())); + assertEquals("myprofile", StringUtils + .arrayToCommaDelimitedString(this.environment.getActiveProfiles())); String property = this.environment.getProperty("the.property"); // The value from the second file wins (no profile specific configuration is // actually loaded) @@ -177,9 +176,8 @@ public class ConfigFileEnvironmentPostProcessorTests { "spring.config.name:enabletwoprofiles", "spring.config.location:classpath:enableprofile.properties"); this.initializer.postProcessEnvironment(this.environment, this.application); - assertEquals("myprofile", - StringUtils.arrayToCommaDelimitedString(this.environment - .getActiveProfiles())); + assertEquals("myprofile", StringUtils + .arrayToCommaDelimitedString(this.environment.getActiveProfiles())); String property = this.environment.getProperty("the.property"); // The value from the second file wins (no profile specific configuration is // actually loaded) @@ -220,10 +218,10 @@ public class ConfigFileEnvironmentPostProcessorTests { @Test public void loadTwoOfThreePropertiesFile() throws Exception { - EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:" - + "classpath:application.properties," - + "classpath:testproperties.properties," - + "classpath:nonexistent.properties"); + EnvironmentTestUtils.addEnvironment(this.environment, + "spring.config.location:" + "classpath:application.properties," + + "classpath:testproperties.properties," + + "classpath:nonexistent.properties"); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("the.property"); assertThat(property, equalTo("frompropertiesfile")); @@ -303,9 +301,9 @@ public class ConfigFileEnvironmentPostProcessorTests { @Test public void defaultPropertyAsFallback() throws Exception { - this.environment.getPropertySources().addLast( - new MapPropertySource("defaultProperties", Collections.singletonMap( - "my.fallback", (Object) "foo"))); + this.environment.getPropertySources() + .addLast(new MapPropertySource("defaultProperties", + Collections.singletonMap("my.fallback", (Object) "foo"))); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("my.fallback"); assertThat(property, equalTo("foo")); @@ -313,9 +311,9 @@ public class ConfigFileEnvironmentPostProcessorTests { @Test public void defaultPropertyAsFallbackDuringFileParsing() throws Exception { - this.environment.getPropertySources().addLast( - new MapPropertySource("defaultProperties", Collections.singletonMap( - "spring.config.name", (Object) "testproperties"))); + this.environment.getPropertySources() + .addLast(new MapPropertySource("defaultProperties", Collections + .singletonMap("spring.config.name", (Object) "testproperties"))); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("the.property"); assertThat(property, equalTo("frompropertiesfile")); @@ -407,8 +405,8 @@ public class ConfigFileEnvironmentPostProcessorTests { public void yamlSetsProfiles() throws Exception { this.initializer.setSearchNames("testsetprofiles"); this.initializer.postProcessEnvironment(this.environment, this.application); - assertEquals("dev", StringUtils.arrayToCommaDelimitedString(this.environment - .getActiveProfiles())); + assertEquals("dev", StringUtils + .arrayToCommaDelimitedString(this.environment.getActiveProfiles())); String property = this.environment.getProperty("my.property"); assertThat(Arrays.asList(this.environment.getActiveProfiles()), contains("dev")); assertThat(property, equalTo("fromdevprofile")); @@ -429,8 +427,7 @@ public class ConfigFileEnvironmentPostProcessorTests { names.add(source.getName()); } } - assertThat( - names, + assertThat(names, contains("applicationConfig: [classpath:/testsetprofiles.yml]#dev", "applicationConfig: [classpath:/testsetprofiles.yml]")); } @@ -441,7 +438,8 @@ public class ConfigFileEnvironmentPostProcessorTests { "spring.profiles.active:prod"); this.initializer.setSearchNames("testsetprofiles"); this.initializer.postProcessEnvironment(this.environment, this.application); - assertThat(this.environment.getActiveProfiles(), equalTo(new String[] { "prod" })); + assertThat(this.environment.getActiveProfiles(), + equalTo(new String[] { "prod" })); } @Test @@ -457,45 +455,45 @@ public class ConfigFileEnvironmentPostProcessorTests { @Test public void specificResource() throws Exception { String location = "classpath:specificlocation.properties"; - EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:" - + location); + EnvironmentTestUtils.addEnvironment(this.environment, + "spring.config.location:" + location); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("the.property"); assertThat(property, equalTo("fromspecificlocation")); - assertThat(this.environment, containsPropertySource("applicationConfig: " - + "[classpath:specificlocation.properties]")); + assertThat(this.environment, containsPropertySource( + "applicationConfig: " + "[classpath:specificlocation.properties]")); // The default property source is still there - assertThat(this.environment, containsPropertySource("applicationConfig: " - + "[classpath:/application.properties]")); + assertThat(this.environment, containsPropertySource( + "applicationConfig: " + "[classpath:/application.properties]")); assertThat(this.environment.getProperty("foo"), equalTo("bucket")); } @Test public void specificResourceAsFile() throws Exception { String location = "file:src/test/resources/specificlocation.properties"; - EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:" - + location); + EnvironmentTestUtils.addEnvironment(this.environment, + "spring.config.location:" + location); this.initializer.postProcessEnvironment(this.environment, this.application); - assertThat(this.environment, containsPropertySource("applicationConfig: [" - + location + "]")); + assertThat(this.environment, + containsPropertySource("applicationConfig: [" + location + "]")); } @Test public void specificResourceDefaultsToFile() throws Exception { String location = "src/test/resources/specificlocation.properties"; - EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:" - + location); + EnvironmentTestUtils.addEnvironment(this.environment, + "spring.config.location:" + location); this.initializer.postProcessEnvironment(this.environment, this.application); - assertThat(this.environment, containsPropertySource("applicationConfig: [file:" - + location + "]")); + assertThat(this.environment, + containsPropertySource("applicationConfig: [file:" + location + "]")); } @Test public void absoluteResourceDefaultsToFile() throws Exception { String location = new File("src/test/resources/specificlocation.properties") .getAbsolutePath(); - EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:" - + location); + EnvironmentTestUtils.addEnvironment(this.environment, + "spring.config.location:" + location); this.initializer.postProcessEnvironment(this.environment, this.application); assertThat(this.environment, containsPropertySource("applicationConfig: [file:" + location.replace(File.separatorChar, '/') + "]")); @@ -510,9 +508,8 @@ public class ConfigFileEnvironmentPostProcessorTests { assertThat(property, equalTo("fromspecificlocation")); property = context.getEnvironment().getProperty("my.property"); assertThat(property, equalTo("fromapplicationproperties")); - assertThat(context.getEnvironment(), - containsPropertySource("class path resource " - + "[specificlocation.properties]")); + assertThat(context.getEnvironment(), containsPropertySource( + "class path resource " + "[specificlocation.properties]")); context.close(); } @@ -527,9 +524,8 @@ public class ConfigFileEnvironmentPostProcessorTests { ConfigurableApplicationContext context = application.run(); String property = context.getEnvironment().getProperty("the.property"); assertThat(property, equalTo("fromspecificlocation")); - assertThat(context.getEnvironment(), - containsPropertySource("class path resource " - + "[specificlocation.properties]")); + assertThat(context.getEnvironment(), containsPropertySource( + "class path resource " + "[specificlocation.properties]")); context.close(); } @@ -554,11 +550,10 @@ public class ConfigFileEnvironmentPostProcessorTests { .run("--spring.profiles.active=myprofile"); String property = context.getEnvironment().getProperty("the.property"); assertThat(property, equalTo("frompropertiesfile")); - assertThat(context.getEnvironment(), - containsPropertySource("class path resource " - + "[enableprofile.properties]")); - assertThat(context.getEnvironment(), not(containsPropertySource("classpath:/" - + "enableprofile-myprofile.properties"))); + assertThat(context.getEnvironment(), containsPropertySource( + "class path resource " + "[enableprofile.properties]")); + assertThat(context.getEnvironment(), not(containsPropertySource( + "classpath:/" + "enableprofile-myprofile.properties"))); context.close(); } @@ -570,8 +565,8 @@ public class ConfigFileEnvironmentPostProcessorTests { ConfigurableApplicationContext context = application.run(); String property = context.getEnvironment().getProperty("my.property"); assertThat(property, equalTo("fromapplicationproperties")); - assertThat(context.getEnvironment(), not(containsPropertySource("classpath:" - + "/enableprofile-myprofile.properties"))); + assertThat(context.getEnvironment(), not(containsPropertySource( + "classpath:" + "/enableprofile-myprofile.properties"))); context.close(); } @@ -583,9 +578,8 @@ public class ConfigFileEnvironmentPostProcessorTests { ConfigurableApplicationContext context = application.run(); String property = context.getEnvironment().getProperty("the.property"); assertThat(property, equalTo("frommorepropertiesfile")); - assertThat(context.getEnvironment(), - containsPropertySource("class path resource " - + "[specificlocation.properties]")); + assertThat(context.getEnvironment(), containsPropertySource( + "class path resource " + "[specificlocation.properties]")); context.close(); } @@ -659,8 +653,8 @@ public class ConfigFileEnvironmentPostProcessorTests { MutablePropertySources sources = new MutablePropertySources( item.getPropertySources()); ConfigurationPropertySources.finishAndRelocate(sources); - mismatchDescription.appendText("Not matched against: ").appendValue( - sources); + mismatchDescription.appendText("Not matched against: ") + .appendValue(sources); return sources.contains(sourceName); } }; @@ -671,15 +665,15 @@ public class ConfigFileEnvironmentPostProcessorTests { return new TypeSafeDiagnosingMatcher() { @Override public void describeTo(Description description) { - description.appendText("environment accepting profiles ").appendValue( - profiles); + description.appendText("environment accepting profiles ") + .appendValue(profiles); } @Override protected boolean matchesSafely(ConfigurableEnvironment item, Description mismatchDescription) { - mismatchDescription.appendText("Not matched against: ").appendValue( - item.getActiveProfiles()); + mismatchDescription.appendText("Not matched against: ") + .appendValue(item.getActiveProfiles()); return item.acceptsProfiles(profiles); } }; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java index 842c953669..a504e88e5b 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java @@ -144,8 +144,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { this.container.stop(); this.thrown.expect(IOException.class); String response = getResponse(getLocalUrl(port, "/hello")); - throw new RuntimeException("Unexpected response on port " + port + " : " - + response); + throw new RuntimeException( + "Unexpected response on port " + port + " : " + response); } @Test @@ -174,9 +174,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { @Test public void startServletAndFilter() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); - this.container = factory.getEmbeddedServletContainer( - exampleServletRegistration(), new FilterRegistrationBean( - new ExampleFilter())); + this.container = factory.getEmbeddedServletContainer(exampleServletRegistration(), + new FilterRegistrationBean(new ExampleFilter())); this.container.start(); assertThat(getResponse(getLocalUrl("/hello")), equalTo("[Hello World]")); } @@ -260,8 +259,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { @Test public void contextRootPathMustNotBeSlash() throws Exception { this.thrown.expect(IllegalArgumentException.class); - this.thrown - .expectMessage("Root ContextPath must be specified using an empty string"); + this.thrown.expectMessage( + "Root ContextPath must be specified using an empty string"); getFactory().setContextPath("/"); } @@ -314,7 +313,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { this.container = factory.getEmbeddedServletContainer(); this.container.start(); ClientHttpResponse response = getClientResponse(getLocalUrl("/test.xxcss")); - assertThat(response.getHeaders().getContentType().toString(), equalTo("text/css")); + assertThat(response.getHeaders().getContentType().toString(), + equalTo("text/css")); response.close(); } @@ -322,8 +322,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { public void errorPage() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/hello")); - this.container = factory.getEmbeddedServletContainer( - exampleServletRegistration(), errorServletRegistration()); + this.container = factory.getEmbeddedServletContainer(exampleServletRegistration(), + errorServletRegistration()); this.container.start(); assertThat(getResponse(getLocalUrl("/hello")), equalTo("Hello World")); assertThat(getResponse(getLocalUrl("/bang")), equalTo("Hello World")); @@ -340,12 +340,12 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { Ssl ssl = getSsl(null, "password", "src/test/resources/test.jks"); ssl.setEnabled(false); factory.setSsl(ssl); - this.container = factory.getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(true), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean(new ExampleServlet(true), "/hello")); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( - new SSLContextBuilder().loadTrustMaterial(null, - new TrustSelfSignedStrategy()).build()); + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory) .build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory( @@ -358,12 +358,12 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { public void sslGetScheme() throws Exception { // gh-2232 AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks")); - this.container = factory.getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(true), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean(new ExampleServlet(true), "/hello")); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( - new SSLContextBuilder().loadTrustMaterial(null, - new TrustSelfSignedStrategy()).build()); + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory) .build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory( @@ -379,8 +379,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { this.container = factory.getEmbeddedServletContainer(); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( - new SSLContextBuilder().loadTrustMaterial(null, - new TrustSelfSignedStrategy()).build()); + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory) .build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory( @@ -441,12 +441,13 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); addTestTxtFile(factory); - factory.setSsl(getSsl(ClientAuth.NEED, "password", "src/test/resources/test.jks")); + factory.setSsl( + getSsl(ClientAuth.NEED, "password", "src/test/resources/test.jks")); this.container = factory.getEmbeddedServletContainer(); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( - new SSLContextBuilder().loadTrustMaterial(null, - new TrustSelfSignedStrategy()).build()); + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory) .build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory( @@ -459,7 +460,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); addTestTxtFile(factory); - factory.setSsl(getSsl(ClientAuth.WANT, "password", "src/test/resources/test.jks")); + factory.setSsl( + getSsl(ClientAuth.WANT, "password", "src/test/resources/test.jks")); this.container = factory.getEmbeddedServletContainer(); this.container.start(); KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); @@ -482,12 +484,13 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); addTestTxtFile(factory); - factory.setSsl(getSsl(ClientAuth.WANT, "password", "src/test/resources/test.jks")); + factory.setSsl( + getSsl(ClientAuth.WANT, "password", "src/test/resources/test.jks")); this.container = factory.getEmbeddedServletContainer(); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( - new SSLContextBuilder().loadTrustMaterial(null, - new TrustSelfSignedStrategy()).build()); + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory) .build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory( @@ -585,13 +588,12 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { String testContent = setUpFactoryForCompression(contentSize, mimeTypes, excludedUserAgents); TestGzipInputStreamFactory inputStreamFactory = new TestGzipInputStreamFactory(); - Map contentDecoderMap = Collections.singletonMap( - "gzip", (InputStreamFactory) inputStreamFactory); - String response = getResponse( - getLocalUrl("/test.txt"), - new HttpComponentsClientHttpRequestFactory(HttpClientBuilder.create() - .setUserAgent("testUserAgent") - .setContentDecoderRegistry(contentDecoderMap).build())); + Map contentDecoderMap = Collections + .singletonMap("gzip", (InputStreamFactory) inputStreamFactory); + String response = getResponse(getLocalUrl("/test.txt"), + new HttpComponentsClientHttpRequestFactory( + HttpClientBuilder.create().setUserAgent("testUserAgent") + .setContentDecoderRegistry(contentDecoderMap).build())); assertThat(response, equalTo(testContent)); return inputStreamFactory.wasCompressionUsed(); } @@ -638,8 +640,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { return "http://localhost:" + port + resourcePath; } - protected String getResponse(String url, String... headers) throws IOException, - URISyntaxException { + protected String getResponse(String url, String... headers) + throws IOException, URISyntaxException { ClientHttpResponse response = getClientResponse(url, headers); try { return StreamUtils.copyToString(response.getBody(), Charset.forName("UTF-8")); @@ -651,7 +653,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { protected String getResponse(String url, HttpComponentsClientHttpRequestFactory requestFactory, String... headers) - throws IOException, URISyntaxException { + throws IOException, URISyntaxException { ClientHttpResponse response = getClientResponse(url, requestFactory, headers); try { return StreamUtils.copyToString(response.getBody(), Charset.forName("UTF-8")); @@ -675,7 +677,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { protected ClientHttpResponse getClientResponse(String url, HttpComponentsClientHttpRequestFactory requestFactory, String... headers) - throws IOException, URISyntaxException { + throws IOException, URISyntaxException { ClientHttpRequest request = requestFactory.createRequest(new URI(url), HttpMethod.GET); request.getHeaders().add("Cookie", "JSESSIONID=" + "123"); @@ -689,8 +691,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { protected void assertForwardHeaderIsUsed(EmbeddedServletContainerFactory factory) throws IOException, URISyntaxException { - this.container = factory.getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(true), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean(new ExampleServlet(true), "/hello")); this.container.start(); assertThat(getResponse(getLocalUrl("/hello"), "X-Forwarded-For:140.211.11.130"), containsString("remoteaddr=140.211.11.130")); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java index 364e75c5d3..21122b49bf 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java @@ -194,8 +194,8 @@ public class JettyEmbeddedServletContainerFactoryTests @Override @SuppressWarnings("serial") // Workaround for Jetty issue - https://bugs.eclipse.org/bugs/show_bug.cgi?id=470646 - protected String setUpFactoryForCompression(final int contentSize, - String[] mimeTypes, String[] excludedUserAgents) throws Exception { + protected String setUpFactoryForCompression(final int contentSize, String[] mimeTypes, + String[] excludedUserAgents) throws Exception { char[] chars = new char[contentSize]; Arrays.fill(chars, 'F'); final String testContent = new String(chars); @@ -209,8 +209,8 @@ public class JettyEmbeddedServletContainerFactoryTests compression.setExcludedUserAgents(excludedUserAgents); } factory.setCompression(compression); - this.container = factory.getEmbeddedServletContainer(new ServletRegistrationBean( - new HttpServlet() { + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean(new HttpServlet() { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java index 49de3bd665..1b35ff356c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java @@ -65,8 +65,8 @@ import static org.mockito.Mockito.verify; * @author Dave Syer * @author Stephane Nicoll */ -public class TomcatEmbeddedServletContainerFactoryTests extends - AbstractEmbeddedServletContainerFactoryTests { +public class TomcatEmbeddedServletContainerFactoryTests + extends AbstractEmbeddedServletContainerFactoryTests { @Override protected TomcatEmbeddedServletContainerFactory getFactory() { @@ -348,7 +348,8 @@ public class TomcatEmbeddedServletContainerFactoryTests extends return (Wrapper) context.findChild("jsp"); } - private void assertTimeout(TomcatEmbeddedServletContainerFactory factory, int expected) { + private void assertTimeout(TomcatEmbeddedServletContainerFactory factory, + int expected) { Tomcat tomcat = getTomcat(factory); Context context = (Context) tomcat.getHost().findChildren()[0]; assertThat(context.getSessionTimeout(), equalTo(expected)); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistenceTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistenceTests.java index 572051649d..da7f16671e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistenceTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistenceTests.java @@ -73,8 +73,8 @@ public class FileSessionPersistenceTests { PersistentSession session = new PersistentSession(this.expiration, data); sessionData.put("abc", session); this.persistence.persistSessions("test", sessionData); - Map restored = this.persistence.loadSessionAttributes( - "test", this.classLoader); + Map restored = this.persistence + .loadSessionAttributes("test", this.classLoader); assertThat(restored, notNullValue()); assertThat(restored.get("abc").getExpiration(), equalTo(this.expiration)); assertThat(restored.get("abc").getSessionData().get("spring"), @@ -90,8 +90,8 @@ public class FileSessionPersistenceTests { PersistentSession session = new PersistentSession(expired, data); sessionData.put("abc", session); this.persistence.persistSessions("test", sessionData); - Map restored = this.persistence.loadSessionAttributes( - "test", this.classLoader); + Map restored = this.persistence + .loadSessionAttributes("test", this.classLoader); assertThat(restored, notNullValue()); assertThat(restored.containsKey("abc"), equalTo(false)); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/web/SpringBootServletInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/web/SpringBootServletInitializerTests.java index b40e7c8cab..d63fecf7a2 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/web/SpringBootServletInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/web/SpringBootServletInitializerTests.java @@ -117,8 +117,8 @@ public class SpringBootServletInitializerTests { } - private class CustomSpringBootServletInitializer extends - MockSpringBootServletInitializer { + private class CustomSpringBootServletInitializer + extends MockSpringBootServletInitializer { private final CustomSpringApplicationBuilder applicationBuilder = new CustomSpringApplicationBuilder(); @@ -128,7 +128,8 @@ public class SpringBootServletInitializerTests { } @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + protected SpringApplicationBuilder configure( + SpringApplicationBuilder application) { return application.sources(Config.class); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java index 6dc0b9c13d..f9a9a29f8a 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java @@ -137,18 +137,16 @@ public class LoggingApplicationListenerTests { EnvironmentTestUtils.addEnvironment(this.context, "logging.config: doesnotexist.xml"); this.thrown.expect(IllegalStateException.class); - this.outputCapture - .expect(containsString("Logging system failed to initialize using configuration from 'doesnotexist.xml'")); + this.outputCapture.expect(containsString( + "Logging system failed to initialize using configuration from 'doesnotexist.xml'")); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); } @Test public void azureDefaultLoggingConfigDoesNotCauseAFailure() throws Exception { - EnvironmentTestUtils - .addEnvironment( - this.context, - "logging.config: -Djava.util.logging.config.file=\"d:\\home\\site\\wwwroot\\bin\\apache-tomcat-7.0.52\\conf\\logging.properties\""); + EnvironmentTestUtils.addEnvironment(this.context, + "logging.config: -Djava.util.logging.config.file=\"d:\\home\\site\\wwwroot\\bin\\apache-tomcat-7.0.52\\conf\\logging.properties\""); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); this.logger.info("Hello world"); @@ -163,8 +161,8 @@ public class LoggingApplicationListenerTests { EnvironmentTestUtils.addEnvironment(this.context, "logging.config: classpath:logback-broken.xml"); this.thrown.expect(IllegalStateException.class); - this.outputCapture - .expect(containsString("Logging system failed to initialize using configuration from 'classpath:logback-broken.xml'")); + this.outputCapture.expect(containsString( + "Logging system failed to initialize using configuration from 'classpath:logback-broken.xml'")); this.outputCapture.expect(containsString("ConsolAppender")); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java index c2bccf3462..50286e8875 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java @@ -55,8 +55,8 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { }; - private final JavaLoggingSystem loggingSystem = new JavaLoggingSystem(getClass() - .getClassLoader()); + private final JavaLoggingSystem loggingSystem = new JavaLoggingSystem( + getClass().getClassLoader()); @Rule public OutputCapture output = new OutputCapture(); @@ -120,11 +120,8 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { public void testSystemPropertyInitializesFormat() throws Exception { System.setProperty("PID", "1234"); this.loggingSystem.beforeInitialize(); - this.loggingSystem.initialize( - null, - "classpath:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "logging.properties"), null); + this.loggingSystem.initialize(null, "classpath:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "logging.properties"), null); this.logger.info("Hello world"); this.logger.info("Hello world"); String output = this.output.toString().trim(); diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java index ded274f9d8..ab07dc8569 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java @@ -82,8 +82,9 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { assertTrue("Wrong output:\n" + output, output.contains("Hello world")); assertFalse("Output not hidden:\n" + output, output.contains("Hidden")); assertFalse(new File(tmpDir() + "/spring.log").exists()); - assertThat(this.loggingSystem.getConfiguration().getConfigurationSource() - .getFile(), is(notNullValue())); + assertThat( + this.loggingSystem.getConfiguration().getConfigurationSource().getFile(), + is(notNullValue())); } @Test @@ -96,8 +97,9 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { assertTrue("Wrong output:\n" + output, output.contains("Hello world")); assertFalse("Output not hidden:\n" + output, output.contains("Hidden")); assertTrue(new File(tmpDir() + "/spring.log").exists()); - assertThat(this.loggingSystem.getConfiguration().getConfigurationSource() - .getFile(), is(notNullValue())); + assertThat( + this.loggingSystem.getConfiguration().getConfigurationSource().getFile(), + is(notNullValue())); } @Test @@ -196,8 +198,8 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { Matcher expectedOutput = containsString("[junit-"); this.output.expect(expectedOutput); this.logger.warn("Expected exception", new RuntimeException("Expected")); - String fileContents = FileCopyUtils.copyToString(new FileReader(new File(tmpDir() - + "/spring.log"))); + String fileContents = FileCopyUtils + .copyToString(new FileReader(new File(tmpDir() + "/spring.log"))); assertThat(fileContents, is(expectedOutput)); } @@ -205,13 +207,13 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { public void rootCauseIsLoggedFirst() throws Exception { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, getLogFile(null, tmpDir())); - Matcher expectedOutput = containsString("Wrapped by: " - + "java.lang.RuntimeException: Expected"); + Matcher expectedOutput = containsString( + "Wrapped by: " + "java.lang.RuntimeException: Expected"); this.output.expect(expectedOutput); - this.logger.warn("Expected exception", new RuntimeException("Expected", - new RuntimeException("Cause"))); - String fileContents = FileCopyUtils.copyToString(new FileReader(new File(tmpDir() - + "/spring.log"))); + this.logger.warn("Expected exception", + new RuntimeException("Expected", new RuntimeException("Cause"))); + String fileContents = FileCopyUtils + .copyToString(new FileReader(new File(tmpDir() + "/spring.log"))); assertThat(fileContents, is(expectedOutput)); } @@ -226,10 +228,10 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { containsString("java.lang.RuntimeException: Expected"), not(containsString("Wrapped by:"))); this.output.expect(expectedOutput); - this.logger.warn("Expected exception", new RuntimeException("Expected", - new RuntimeException("Cause"))); - String fileContents = FileCopyUtils.copyToString(new FileReader(new File( - tmpDir() + "/spring.log"))); + this.logger.warn("Expected exception", + new RuntimeException("Expected", new RuntimeException("Cause"))); + String fileContents = FileCopyUtils + .copyToString(new FileReader(new File(tmpDir() + "/spring.log"))); assertThat(fileContents, is(expectedOutput)); } finally { diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java index 2a4a4f54c5..e16540ef93 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java @@ -275,8 +275,8 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { Matcher expectedOutput = containsString("[junit-"); this.output.expect(expectedOutput); this.logger.warn("Expected exception", new RuntimeException("Expected")); - String fileContents = FileCopyUtils.copyToString(new FileReader(new File(tmpDir() - + "/spring.log"))); + String fileContents = FileCopyUtils + .copyToString(new FileReader(new File(tmpDir() + "/spring.log"))); assertThat(fileContents, is(expectedOutput)); } @@ -285,13 +285,13 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(this.initializationContext, null, getLogFile(null, tmpDir())); - Matcher expectedOutput = containsString("Wrapped by: " - + "java.lang.RuntimeException: Expected"); + Matcher expectedOutput = containsString( + "Wrapped by: " + "java.lang.RuntimeException: Expected"); this.output.expect(expectedOutput); - this.logger.warn("Expected exception", new RuntimeException("Expected", - new RuntimeException("Cause"))); - String fileContents = FileCopyUtils.copyToString(new FileReader(new File(tmpDir() - + "/spring.log"))); + this.logger.warn("Expected exception", + new RuntimeException("Expected", new RuntimeException("Cause"))); + String fileContents = FileCopyUtils + .copyToString(new FileReader(new File(tmpDir() + "/spring.log"))); assertThat(fileContents, is(expectedOutput)); } @@ -307,10 +307,10 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { containsString("java.lang.RuntimeException: Expected"), not(containsString("Wrapped by:"))); this.output.expect(expectedOutput); - this.logger.warn("Expected exception", new RuntimeException("Expected", - new RuntimeException("Cause"))); - String fileContents = FileCopyUtils.copyToString(new FileReader(new File( - tmpDir() + "/spring.log"))); + this.logger.warn("Expected exception", + new RuntimeException("Expected", new RuntimeException("Cause"))); + String fileContents = FileCopyUtils + .copyToString(new FileReader(new File(tmpDir() + "/spring.log"))); assertThat(fileContents, is(expectedOutput)); } finally { diff --git a/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilderTests.java b/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilderTests.java index 91ac7522e1..3c1f7f19c9 100644 --- a/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilderTests.java @@ -63,8 +63,8 @@ public class EntityManagerFactoryBuilderTests { .dataSource(this.dataSource1) .properties(Collections.singletonMap("foo", "spam")).build(); assertFalse(result1.getJpaPropertyMap().isEmpty()); - LocalContainerEntityManagerFactoryBean result2 = factory.dataSource( - this.dataSource2).build(); + LocalContainerEntityManagerFactoryBean result2 = factory + .dataSource(this.dataSource2).build(); assertTrue(result2.getJpaPropertyMap().isEmpty()); } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletComponentScanIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletComponentScanIntegrationTests.java index 7d31db2ebb..77556aea34 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletComponentScanIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletComponentScanIntegrationTests.java @@ -52,8 +52,8 @@ public class ServletComponentScanIntegrationTests { new ServerPortInfoApplicationContextInitializer().initialize(this.context); this.context.refresh(); String port = this.context.getEnvironment().getProperty("local.server.port"); - String response = new RestTemplate().getForObject("http://localhost:" + port - + "/test", String.class); + String response = new RestTemplate() + .getForObject("http://localhost:" + port + "/test", String.class); assertThat(response, is(equalTo("alpha bravo"))); } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrarTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrarTests.java index 40b04cce01..bf5d6e5cf7 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrarTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrarTests.java @@ -68,8 +68,8 @@ public class ServletComponentScanRegistrarTests { this.context = new AnnotationConfigApplicationContext(BasePackageClasses.class); ServletComponentRegisteringPostProcessor postProcessor = this.context .getBean(ServletComponentRegisteringPostProcessor.class); - assertThat(postProcessor.getPackagesToScan(), containsInAnyOrder(getClass() - .getPackage().getName())); + assertThat(postProcessor.getPackagesToScan(), + containsInAnyOrder(getClass().getPackage().getName())); } @Test @@ -80,8 +80,8 @@ public class ServletComponentScanRegistrarTests { this.context = new AnnotationConfigApplicationContext(ValueAndBasePackages.class); ServletComponentRegisteringPostProcessor postProcessor = this.context .getBean(ServletComponentRegisteringPostProcessor.class); - assertThat(postProcessor.getPackagesToScan(), containsInAnyOrder(getClass() - .getPackage().getName())); + assertThat(postProcessor.getPackagesToScan(), + containsInAnyOrder(getClass().getPackage().getName())); } @Test @@ -90,10 +90,8 @@ public class ServletComponentScanRegistrarTests { AdditionalPackages.class); ServletComponentRegisteringPostProcessor postProcessor = this.context .getBean(ServletComponentRegisteringPostProcessor.class); - assertThat( - postProcessor.getPackagesToScan(), - containsInAnyOrder("com.example.foo", "com.example.bar", - "com.example.baz")); + assertThat(postProcessor.getPackagesToScan(), containsInAnyOrder( + "com.example.foo", "com.example.bar", "com.example.baz")); } @Configuration diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebFilterHandlerTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebFilterHandlerTests.java index cdde42b8db..abeca0e98d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebFilterHandlerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebFilterHandlerTests.java @@ -95,23 +95,27 @@ public class WebFilterHandlerTests { @Test public void asyncSupported() throws IOException { - BeanDefinition filterRegistrationBean = getBeanDefinition(AsyncSupportedFilter.class); + BeanDefinition filterRegistrationBean = getBeanDefinition( + AsyncSupportedFilter.class); MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues(); assertThat(propertyValues.get("asyncSupported"), is((Object) true)); } @Test public void dispatcherTypes() throws IOException { - BeanDefinition filterRegistrationBean = getBeanDefinition(DispatcherTypesFilter.class); + BeanDefinition filterRegistrationBean = getBeanDefinition( + DispatcherTypesFilter.class); MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues(); - assertThat(propertyValues.get("dispatcherTypes"), is((Object) EnumSet.of( - DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST))); + assertThat(propertyValues.get("dispatcherTypes"), + is((Object) EnumSet.of(DispatcherType.FORWARD, DispatcherType.INCLUDE, + DispatcherType.REQUEST))); } @SuppressWarnings("unchecked") @Test public void initParameters() throws IOException { - BeanDefinition filterRegistrationBean = getBeanDefinition(InitParametersFilter.class); + BeanDefinition filterRegistrationBean = getBeanDefinition( + InitParametersFilter.class); MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues(); assertThat((Map) propertyValues.get("initParameters"), hasEntry("a", "alpha")); @@ -121,7 +125,8 @@ public class WebFilterHandlerTests { @Test public void servletNames() throws IOException { - BeanDefinition filterRegistrationBean = getBeanDefinition(ServletNamesFilter.class); + BeanDefinition filterRegistrationBean = getBeanDefinition( + ServletNamesFilter.class); MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues(); assertThat((String[]) propertyValues.get("servletNames"), is(arrayContaining("alpha", "bravo"))); @@ -129,7 +134,8 @@ public class WebFilterHandlerTests { @Test public void urlPatterns() throws IOException { - BeanDefinition filterRegistrationBean = getBeanDefinition(UrlPatternsFilter.class); + BeanDefinition filterRegistrationBean = getBeanDefinition( + UrlPatternsFilter.class); MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues(); assertThat((String[]) propertyValues.get("urlPatterns"), is(arrayContaining("alpha", "bravo"))); @@ -137,7 +143,8 @@ public class WebFilterHandlerTests { @Test public void urlPatternsFromValue() throws IOException { - BeanDefinition filterRegistrationBean = getBeanDefinition(UrlPatternsFromValueFilter.class); + BeanDefinition filterRegistrationBean = getBeanDefinition( + UrlPatternsFromValueFilter.class); MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues(); assertThat((String[]) propertyValues.get("urlPatterns"), is(arrayContaining("alpha", "bravo"))); @@ -146,14 +153,15 @@ public class WebFilterHandlerTests { @Test public void urlPatternsDeclaredTwice() throws IOException { this.thrown.expect(IllegalStateException.class); - this.thrown.expectMessage("The urlPatterns and value attributes are mututally " - + "exclusive"); + this.thrown.expectMessage( + "The urlPatterns and value attributes are mututally " + "exclusive"); getBeanDefinition(UrlPatternsDeclaredTwiceFilter.class); } BeanDefinition getBeanDefinition(Class filterClass) throws IOException { ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition( - new SimpleMetadataReaderFactory().getMetadataReader(filterClass.getName())); + new SimpleMetadataReaderFactory() + .getMetadataReader(filterClass.getName())); this.handler.handle(scanned, this.registry); return this.registry.getBeanDefinition(filterClass.getName()); } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebListenerHandlerTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebListenerHandlerTests.java index 5aac52c2c2..17195f01c0 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebListenerHandlerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebListenerHandlerTests.java @@ -41,8 +41,8 @@ public class WebListenerHandlerTests { @Test public void listener() throws IOException { ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition( - new SimpleMetadataReaderFactory().getMetadataReader(TestListener.class - .getName())); + new SimpleMetadataReaderFactory() + .getMetadataReader(TestListener.class.getName())); this.handler.handle(scanned, this.registry); this.registry.getBeanDefinition(TestListener.class.getName()); } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebServletHandlerTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebServletHandlerTests.java index 08544b1745..018b369e55 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebServletHandlerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebServletHandlerTests.java @@ -89,7 +89,8 @@ public class WebServletHandlerTests { @Test public void asyncSupported() throws IOException { - BeanDefinition servletRegistrationBean = getBeanDefinition(AsyncSupportedServlet.class); + BeanDefinition servletRegistrationBean = getBeanDefinition( + AsyncSupportedServlet.class); MutablePropertyValues propertyValues = servletRegistrationBean .getPropertyValues(); assertThat(propertyValues.get("asyncSupported"), is((Object) true)); @@ -98,7 +99,8 @@ public class WebServletHandlerTests { @SuppressWarnings("unchecked") @Test public void initParameters() throws IOException { - BeanDefinition servletRegistrationBean = getBeanDefinition(InitParametersServlet.class); + BeanDefinition servletRegistrationBean = getBeanDefinition( + InitParametersServlet.class); MutablePropertyValues propertyValues = servletRegistrationBean .getPropertyValues(); assertThat((Map) propertyValues.get("initParameters"), @@ -109,7 +111,8 @@ public class WebServletHandlerTests { @Test public void urlMappings() throws IOException { - BeanDefinition servletRegistrationBean = getBeanDefinition(UrlPatternsServlet.class); + BeanDefinition servletRegistrationBean = getBeanDefinition( + UrlPatternsServlet.class); MutablePropertyValues propertyValues = servletRegistrationBean .getPropertyValues(); assertThat((String[]) propertyValues.get("urlMappings"), @@ -118,7 +121,8 @@ public class WebServletHandlerTests { @Test public void urlMappingsFromValue() throws IOException { - BeanDefinition servletRegistrationBean = getBeanDefinition(UrlPatternsFromValueServlet.class); + BeanDefinition servletRegistrationBean = getBeanDefinition( + UrlPatternsFromValueServlet.class); MutablePropertyValues propertyValues = servletRegistrationBean .getPropertyValues(); assertThat((String[]) propertyValues.get("urlMappings"), @@ -128,14 +132,15 @@ public class WebServletHandlerTests { @Test public void urlPatternsDeclaredTwice() throws IOException { this.thrown.expect(IllegalStateException.class); - this.thrown.expectMessage("The urlPatterns and value attributes are mututally " - + "exclusive"); + this.thrown.expectMessage( + "The urlPatterns and value attributes are mututally " + "exclusive"); getBeanDefinition(UrlPatternsDeclaredTwiceServlet.class); } BeanDefinition getBeanDefinition(Class filterClass) throws IOException { ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition( - new SimpleMetadataReaderFactory().getMetadataReader(filterClass.getName())); + new SimpleMetadataReaderFactory() + .getMetadataReader(filterClass.getName())); this.handler.handle(scanned, this.registry); return this.registry.getBeanDefinition(filterClass.getName()); } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/testcomponents/TestServlet.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/testcomponents/TestServlet.java index 9703c1e5b4..b9adfb54ad 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/testcomponents/TestServlet.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/testcomponents/TestServlet.java @@ -30,9 +30,10 @@ public class TestServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - resp.getWriter().print( - ((String) req.getServletContext().getAttribute("listenerAttribute")) - + " " + req.getAttribute("filterAttribute")); + resp.getWriter() + .print(((String) req.getServletContext() + .getAttribute("listenerAttribute")) + " " + + req.getAttribute("filterAttribute")); resp.getWriter().flush(); }