From 6ab376e2e88ac9f3a4b1aa3c2962cba29d44965b Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 7 Oct 2015 23:32:31 -0700 Subject: [PATCH] Reformat code use Eclipse Mars --- .../boot/actuate/audit/AuditEvent.java | 4 +- .../audit/listener/AuditApplicationEvent.java | 3 +- .../autoconfigure/CrshAutoConfiguration.java | 41 +++--- .../EndpointAutoConfiguration.java | 4 +- .../EndpointMBeanExportAutoConfiguration.java | 13 +- .../EndpointWebMvcAutoConfiguration.java | 52 +++---- ...dpointWebMvcChildContextConfiguration.java | 8 +- .../HealthIndicatorAutoConfiguration.java | 35 ++--- .../JolokiaAutoConfiguration.java | 4 +- .../ManagementSecurityAutoConfiguration.java | 39 +++--- .../ManagementServerProperties.java | 3 +- .../MetricRepositoryAutoConfiguration.java | 3 +- .../actuate/autoconfigure/MetricsFilter.java | 4 +- .../autoconfigure/ShellProperties.java | 23 ++-- .../condition/OnEnabledEndpointCondition.java | 8 +- .../actuate/endpoint/AbstractEndpoint.java | 4 +- .../boot/actuate/endpoint/BeansEndpoint.java | 4 +- ...ConfigurationPropertiesReportEndpoint.java | 37 +++-- .../endpoint/DataSourcePublicMetrics.java | 3 +- .../boot/actuate/endpoint/DumpEndpoint.java | 4 +- .../endpoint/RequestMappingEndpoint.java | 15 +- .../RichGaugeReaderPublicMetrics.java | 6 +- .../actuate/endpoint/ShutdownEndpoint.java | 4 +- .../actuate/endpoint/SystemPublicMetrics.java | 47 +++---- .../actuate/endpoint/TomcatPublicMetrics.java | 6 +- .../endpoint/jmx/EndpointMBeanExporter.java | 12 +- .../endpoint/mvc/EndpointHandlerMapping.java | 4 +- .../endpoint/mvc/EnvironmentMvcEndpoint.java | 4 +- .../endpoint/mvc/HealthMvcEndpoint.java | 9 +- .../actuate/endpoint/mvc/MvcEndpoints.java | 9 +- .../endpoint/mvc/ShutdownMvcEndpoint.java | 5 +- .../health/DataSourceHealthIndicator.java | 13 +- .../health/DiskSpaceHealthIndicator.java | 7 +- .../boot/actuate/metrics/Metric.java | 4 +- .../export/AbstractMetricExporter.java | 7 +- .../export/PrefixMetricGroupExporter.java | 7 +- .../reader/MetricRegistryMetricReader.java | 4 +- .../repository/InMemoryMetricRepository.java | 8 +- .../redis/RedisMetricRepository.java | 4 +- .../redis/RedisMultiMetricRepository.java | 4 +- .../boot/actuate/metrics/rich/RichGauge.java | 4 +- .../util/SimpleInMemoryRepository.java | 4 +- .../security/AuthorizationAuditListener.java | 3 +- .../system/ApplicationPidFileWriter.java | 7 +- .../system/EmbeddedServerPortFileWriter.java | 4 +- .../boot/actuate/system/SystemProperties.java | 4 +- .../actuate/trace/WebRequestTraceFilter.java | 6 +- .../boot/actuate/audit/AuditEventTests.java | 4 +- .../CrshAutoConfigurationTests.java | 29 ++-- ...ointMBeanExportAutoConfigurationTests.java | 26 ++-- .../EndpointMvcIntegrationTests.java | 8 +- .../EndpointWebMvcAutoConfigurationTests.java | 41 +++--- ...HealthIndicatorAutoConfigurationTests.java | 48 +++---- ...althMvcEndpointAutoConfigurationTests.java | 12 +- .../JolokiaAutoConfigurationTests.java | 12 +- ...agementSecurityAutoConfigurationTests.java | 23 ++-- .../MetricFilterAutoConfigurationTests.java | 67 ++++----- ...etricRepositoryAutoConfigurationTests.java | 7 +- .../PublicMetricsAutoConfigurationTests.java | 19 +-- .../autoconfigure/ShellPropertiesTests.java | 39 +++--- .../SpringApplicationHierarchyTests.java | 4 +- .../endpoint/AbstractEndpointTests.java | 10 +- .../AutoConfigurationReportEndpointTests.java | 8 +- ...ionPropertiesReportEndpointProxyTests.java | 4 +- ...gurationPropertiesReportEndpointTests.java | 4 +- .../endpoint/EnvironmentEndpointTests.java | 8 +- .../endpoint/MetricsEndpointTests.java | 4 +- .../endpoint/RequestMappingEndpointTests.java | 8 +- .../jmx/EndpointMBeanExporterTests.java | 89 ++++++------ .../mvc/EndpointHandlerMappingTests.java | 30 ++-- .../mvc/EnvironmentMvcEndpointTests.java | 4 +- .../endpoint/mvc/HealthMvcEndpointTests.java | 28 ++-- .../JolokiaMvcEndpointContextPathTests.java | 11 +- .../endpoint/mvc/JolokiaMvcEndpointTests.java | 4 +- .../health/CompositeHealthIndicatorTests.java | 68 ++++----- .../DataSourceHealthIndicatorTests.java | 4 +- .../health/DiskSpaceHealthIndicatorTests.java | 7 +- .../health/MongoHealthIndicatorTests.java | 4 +- .../health/OrderedHealthAggregatorTests.java | 7 +- .../health/RabbitHealthIndicatorTests.java | 5 +- .../health/RedisHealthIndicatorTests.java | 10 +- .../redis/RedisMetricRepositoryTests.java | 7 +- .../RedisMultiMetricRepositoryTests.java | 41 +++--- .../metrics/repository/redis/RedisServer.java | 7 +- .../rich/MultiMetricRichGaugeReaderTests.java | 3 +- .../metrics/util/InMemoryRepositoryTests.java | 3 +- .../writer/DropwizardMetricWriterTests.java | 2 +- .../MessageChannelMetricWriterTests.java | 4 +- .../AuthenticationAuditListenerTests.java | 9 +- .../AuthorizationAuditListenerTests.java | 7 +- .../system/ApplicationPidFileWriterTests.java | 19 ++- .../EmbeddedServerPortFileWriterTests.java | 19 ++- .../trace/WebRequestTraceFilterTests.java | 8 +- .../AutoConfigurationPackages.java | 4 +- .../AutoConfigurationSorter.java | 4 +- ...EnableAutoConfigurationImportSelector.java | 23 ++-- .../MessageSourceAutoConfiguration.java | 23 ++-- .../amqp/RabbitAutoConfiguration.java | 27 ++-- .../autoconfigure/amqp/RabbitProperties.java | 4 +- .../batch/BasicBatchConfigurer.java | 3 +- .../batch/BatchAutoConfiguration.java | 3 +- .../batch/JobExecutionExitCodeGenerator.java | 4 +- .../batch/JobLauncherCommandLineRunner.java | 13 +- .../condition/AnyNestedCondition.java | 8 +- .../condition/BeanTypeRegistry.java | 39 +++--- .../condition/ConditionEvaluationReport.java | 11 +- .../condition/ConditionOutcome.java | 4 +- .../condition/OnBeanCondition.java | 35 ++--- .../condition/OnClassCondition.java | 8 +- .../condition/OnExpressionCondition.java | 9 +- .../condition/OnJavaCondition.java | 7 +- .../condition/OnJndiCondition.java | 10 +- .../condition/OnPropertyCondition.java | 4 +- .../condition/OnResourceCondition.java | 8 +- .../condition/SpringBootCondition.java | 10 +- ...tRepositoryConfigurationSourceSupport.java | 10 +- .../ElasticsearchRepositoriesRegistrar.java | 4 +- ...yManagerFactoryDependsOnPostProcessor.java | 13 +- ...JpaRepositoriesAutoConfigureRegistrar.java | 4 +- ...ngoRepositoriesAutoConfigureRegistrar.java | 4 +- ...ingBootRepositoryRestMvcConfiguration.java | 4 +- .../flyway/FlywayAutoConfiguration.java | 13 +- .../FreeMarkerAutoConfiguration.java | 9 +- ...reeMarkerTemplateAvailabilityProvider.java | 4 +- .../template/GroovyTemplateResolver.java | 9 +- .../hateoas/HypermediaAutoConfiguration.java | 4 +- .../jackson/JacksonAutoConfiguration.java | 31 +++-- .../jdbc/DataSourceAutoConfiguration.java | 11 +- .../jdbc/DataSourceInitializer.java | 11 +- .../jdbc/DriverClassNameProvider.java | 5 +- .../jdbc/EmbeddedDatabaseConnection.java | 15 +- .../AbstractDataSourcePoolMetadata.java | 4 +- .../CommonsDbcpDataSourcePoolMetadata.java | 4 +- .../jdbc/metadata/DataSourcePoolMetadata.java | 3 +- .../HikariDataSourcePoolMetadata.java | 4 +- .../TomcatDataSourcePoolMetadata.java | 4 +- .../jersey/JerseyAutoConfiguration.java | 3 +- ...ndiConnectionFactoryAutoConfiguration.java | 3 +- ...ctiveMQConnectionFactoryConfiguration.java | 4 +- .../ActiveMQConnectionFactoryFactory.java | 4 +- .../HornetQConnectionFactoryFactory.java | 12 +- .../HornetQEmbeddedServerConfiguration.java | 9 +- ...rnetQXAConnectionFactoryConfiguration.java | 8 +- .../jmx/ParentAwareNamingStrategy.java | 7 +- .../jta/BitronixJtaConfiguration.java | 3 +- .../liquibase/LiquibaseAutoConfiguration.java | 19 +-- ...ConfigurationReportLoggingInitializer.java | 26 ++-- ...legatingViewResolverAutoConfiguration.java | 4 +- .../DeviceResolverAutoConfiguration.java | 3 +- .../SitePreferenceAutoConfiguration.java | 3 +- .../mongo/MongoDataAutoConfiguration.java | 9 +- .../autoconfigure/mongo/MongoProperties.java | 8 +- .../MustacheEnvironmentCollector.java | 8 +- .../MustacheResourceTemplateLoader.java | 9 +- .../MustacheTemplateAvailabilityProvider.java | 3 +- .../mustache/web/MustacheViewResolver.java | 4 +- .../jpa/DataSourceInitializedPublisher.java | 4 +- .../orm/jpa/EntityManagerFactoryBuilder.java | 12 +- .../jpa/HibernateJpaAutoConfiguration.java | 9 +- .../autoconfigure/orm/jpa/JpaProperties.java | 3 +- .../redis/RedisAutoConfiguration.java | 16 +-- .../AuthenticationManagerConfiguration.java | 31 +++-- ...BootGlobalAuthenticationConfiguration.java | 4 +- .../security/SecurityProperties.java | 3 +- .../SpringBootWebSecurityConfiguration.java | 12 +- .../social/SocialWebAutoConfiguration.java | 14 +- ...bstractTemplateViewResolverProperties.java | 4 +- .../AbstractViewResolverProperties.java | 5 +- ...ThymeleafTemplateAvailabilityProvider.java | 4 +- .../velocity/VelocityAutoConfiguration.java | 3 +- .../VelocityTemplateAvailabilityProvider.java | 3 +- .../web/BasicErrorController.java | 3 +- .../web/DefaultErrorAttributes.java | 4 +- .../DispatcherServletAutoConfiguration.java | 8 +- ...ddedServletContainerAutoConfiguration.java | 3 +- .../web/ErrorMvcAutoConfiguration.java | 8 +- .../web/GzipFilterAutoConfiguration.java | 3 +- .../web/HttpMapperProperties.java | 5 +- .../web/HttpMessageConverters.java | 4 +- .../web/MultipartProperties.java | 10 +- .../autoconfigure/web/ServerProperties.java | 9 +- .../ServerPropertiesAutoConfiguration.java | 7 +- .../web/WebMvcAutoConfiguration.java | 10 +- .../JettyWebSocketContainerCustomizer.java | 4 +- .../TomcatWebSocketContainerCustomizer.java | 8 +- .../UndertowWebSocketContainerCustomizer.java | 8 +- .../AutoConfigurationPackagesTests.java | 4 +- .../AutoConfigurationSorterTests.java | 8 +- .../AutoConfigureConfigurationClassTests.java | 3 +- ...urceAutoConfigurationIntegrationTests.java | 3 +- ...geSourceAutoConfigurationProfileTests.java | 3 +- ...ertyPlaceholderAutoConfigurationTests.java | 4 +- ...TestAutoConfigurationPackageRegistrar.java | 10 +- .../amqp/RabbitAutoConfigurationTests.java | 6 +- .../batch/BatchAutoConfigurationTests.java | 12 +- .../JobLauncherCommandLineRunnerTests.java | 7 +- .../ConditionEvaluationReportTests.java | 24 ++-- .../condition/ConditionalOnBeanTests.java | 4 +- .../condition/ConditionalOnJavaTests.java | 8 +- .../ConditionalOnMissingBeanTests.java | 14 +- .../condition/ConditionalOnPropertyTests.java | 3 +- .../condition/SpringBootConditionTests.java | 4 +- ...JpaRepositoriesAutoConfigurationTests.java | 4 +- .../jpa/JpaWebAutoConfigurationTests.java | 4 +- ...ngoRepositoriesAutoConfigurationTests.java | 3 +- ...positoryRestMvcAutoConfigurationTests.java | 3 +- .../flyway/FlywayAutoConfigurationTests.java | 25 ++-- .../FreeMarkerAutoConfigurationTests.java | 3 +- ...rkerTemplateAvailabilityProviderTests.java | 4 +- .../GroovyTemplateAutoConfigurationTests.java | 14 +- .../HypermediaAutoConfigurationTests.java | 4 +- .../JacksonAutoConfigurationTests.java | 82 ++++++----- .../CommonsDataSourceConfigurationTests.java | 12 +- .../DataSourceAutoConfigurationTests.java | 32 ++--- .../jdbc/DataSourceInitializerTests.java | 55 ++++---- .../DataSourceJsonSerializationTests.java | 8 +- ...nsactionManagerAutoConfigurationTests.java | 9 +- .../jdbc/DatabaseDriverTests.java | 8 +- .../HikariDataSourceConfigurationTests.java | 4 +- .../JndiDataSourceAutoConfigurationTests.java | 12 +- .../TomcatDataSourceConfigurationTests.java | 23 ++-- .../XADataSourceAutoConfigurationTests.java | 3 +- .../AbstractDataSourcePoolMetadataTests.java | 32 ++--- ...ommonsDbcpDataSourcePoolMetadataTests.java | 4 +- .../DataSourcePoolMetadataProvidersTests.java | 3 +- .../HikariDataSourcePoolMetadataTests.java | 11 +- .../TomcatDataSourcePoolMetadataTests.java | 7 +- ...toConfigurationDefaultFilterPathTests.java | 4 +- ...oConfigurationDefaultServletPathTests.java | 4 +- .../jms/JmsAutoConfigurationTests.java | 34 ++--- .../ActiveMQAutoConfigurationTests.java | 3 +- .../jms/activemq/ActiveMQPropertiesTests.java | 20 +-- .../HornetQAutoConfigurationTests.java | 16 ++- .../jta/JtaAutoConfigurationTests.java | 4 +- .../LiquibaseAutoConfigurationTests.java | 4 +- ...gurationReportLoggingInitializerTests.java | 12 +- ...ingViewResolverAutoConfigurationTests.java | 62 +++++---- .../DeviceResolverAutoConfigurationTests.java | 8 +- .../SitePreferenceAutoConfigurationTests.java | 16 +-- .../mongo/MongoAutoConfigurationTests.java | 8 +- .../MongoDataAutoConfigurationTests.java | 8 +- .../mongo/MongoPropertiesTests.java | 6 +- ...acheAutoConfigurationIntegrationTests.java | 8 +- .../MustacheStandaloneIntegrationTests.java | 19 ++- .../mustache/web/MustacheViewTests.java | 6 +- .../web/MustacheWebIntegrationTests.java | 14 +- .../AbstractJpaAutoConfigurationTests.java | 7 +- ...tomHibernateJpaAutoConfigurationTests.java | 8 +- .../jpa/EntityManagerFactoryBuilderTests.java | 4 +- .../HibernateJpaAutoConfigurationTests.java | 33 +++-- .../redis/RedisAutoConfigurationTests.java | 15 +- .../SecurityAutoConfigurationTests.java | 52 +++---- .../security/SecurityPropertiesTests.java | 32 ++--- ...ringBootWebSecurityConfigurationTests.java | 39 +++--- .../ThymeleafAutoConfigurationTests.java | 4 +- ...leafTemplateAvailabilityProviderTests.java | 4 +- .../VelocityAutoConfigurationTests.java | 16 ++- ...cityTemplateAvailabilityProviderTests.java | 4 +- ...asicErrorControllerDirectMockMvcTests.java | 14 +- .../BasicErrorControllerIntegrationTests.java | 23 ++-- .../web/BasicErrorControllerMockMvcTests.java | 6 +- .../web/DefaultErrorAttributesTests.java | 64 ++++----- .../web/DefaultErrorViewIntegrationTests.java | 15 +- ...ervletContainerAutoConfigurationTests.java | 4 +- ...tContainerServletContextListenerTests.java | 4 +- .../HttpEncodingAutoConfigurationTests.java | 4 +- ...ssageConvertersAutoConfigurationTests.java | 56 ++++---- .../web/HttpMessageConvertersTests.java | 33 +++-- .../web/MultipartAutoConfigurationTests.java | 17 ++- .../RemappedErrorViewIntegrationTests.java | 12 +- .../web/ServerPropertiesTests.java | 34 ++--- .../web/WebMvcAutoConfigurationTests.java | 37 +++-- .../WebSocketAutoConfigurationTests.java | 4 +- .../boot/cli/CommandLineIT.java | 12 +- .../boot/cli/JarCommandIT.java | 29 ++-- .../infrastructure/CommandLineInvoker.java | 12 +- .../springframework/boot/cli/SpringCli.java | 4 +- .../boot/cli/command/CommandRunner.java | 8 +- .../cli/command/OptionParsingCommand.java | 3 +- .../boot/cli/command/core/HintCommand.java | 4 +- .../boot/cli/command/init/InitCommand.java | 27 ++-- .../cli/command/init/InitializrService.java | 21 +-- .../init/InitializrServiceMetadata.java | 8 +- .../init/ProjectGenerationRequest.java | 8 +- .../cli/command/init/ProjectGenerator.java | 16 +-- .../ServiceCapabilitiesReportGenerator.java | 6 +- .../boot/cli/command/install/Installer.java | 4 +- .../boot/cli/command/jar/JarCommand.java | 29 ++-- .../boot/cli/command/jar/ResourceMatcher.java | 4 +- .../options/CompilerOptionHandler.java | 2 +- .../OptionSetGroovyCompilerConfiguration.java | 4 +- .../cli/command/options/SourceOptions.java | 4 +- .../boot/cli/command/run/RunCommand.java | 10 +- .../command/run/SpringApplicationRunner.java | 2 +- .../SpringApplicationRunnerConfiguration.java | 3 +- .../cli/command/shell/CommandCompleter.java | 8 +- .../boot/cli/command/shell/Shell.java | 5 +- .../boot/cli/command/test/TestRunner.java | 11 +- .../AnnotatedNodeASTTransformation.java | 4 +- .../boot/cli/compiler/AstUtils.java | 4 +- .../compiler/CompilerAutoConfiguration.java | 6 +- .../cli/compiler/DependencyCustomizer.java | 14 +- .../compiler/ExtendedGroovyClassLoader.java | 4 +- .../compiler/GrabMetadataTransformation.java | 33 +++-- .../compiler/GroovyBeansTransformation.java | 10 +- .../boot/cli/compiler/GroovyCompiler.java | 29 ++-- .../RepositoryConfigurationFactory.java | 4 +- ...veDependencyCoordinatesTransformation.java | 8 +- .../cli/compiler/SmartImportCustomizer.java | 8 +- ...ovyTemplatesCompilerAutoConfiguration.java | 4 +- .../JmsCompilerAutoConfiguration.java | 4 +- .../RabbitCompilerAutoConfiguration.java | 5 +- .../SpringBatchCompilerAutoConfiguration.java | 7 +- .../SpringBootCompilerAutoConfiguration.java | 6 +- ...gIntegrationCompilerAutoConfiguration.java | 10 +- .../SpringMvcCompilerAutoConfiguration.java | 11 +- ...cialFacebookCompilerAutoConfiguration.java | 10 +- ...cialLinkedInCompilerAutoConfiguration.java | 10 +- ...ocialTwitterCompilerAutoConfiguration.java | 7 +- .../SpringTestCompilerAutoConfiguration.java | 14 +- ...ingWebsocketCompilerAutoConfiguration.java | 4 +- ...onManagementCompilerAutoConfiguration.java | 11 +- ...pendenciesArtifactCoordinatesResolver.java | 7 +- .../cli/compiler/grape/AetherGrapeEngine.java | 23 ++-- .../grape/AetherGrapeEngineFactory.java | 18 +-- ...ositorySystemSessionAutoConfiguration.java | 4 +- .../grape/DetailedProgressReporter.java | 7 +- ...ositorySystemSessionAutoConfiguration.java | 4 +- ...ositorySystemSessionAutoConfiguration.java | 26 ++-- .../grape/SummaryProgressReporter.java | 9 +- .../PackagedSpringApplicationLauncher.java | 4 +- .../boot/cli/util/ResourceUtils.java | 9 +- .../boot/groovy/GroovyTemplate.java | 13 +- .../springframework/boot/cli/CliTester.java | 8 +- .../boot/cli/command/CommandRunnerTests.java | 12 +- .../init/AbstractHttpClientMockTests.java | 8 +- .../cli/command/init/InitCommandTests.java | 7 +- .../init/InitializrServiceMetadataTests.java | 12 +- .../command/init/InitializrServiceTests.java | 7 +- .../init/ProjectGenerationRequestTests.java | 14 +- .../GroovyGrabDependencyResolverTests.java | 14 +- .../cli/command/install/InstallerTests.java | 24 ++-- .../cli/command/jar/ResourceMatcherTests.java | 47 ++++--- ...AwareWhiteSpaceArgumentDelimiterTests.java | 35 ++--- .../compiler/DependencyCustomizerTests.java | 42 +++--- ...endencyCoordinatesTransformationTests.java | 11 +- .../grape/AetherGrapeEngineTests.java | 16 +-- ...rySystemSessionAutoConfigurationTests.java | 46 +++---- ...rySystemSessionAutoConfigurationTests.java | 50 +++---- .../SampleTomcatDeployApplicationIT.java | 2 +- .../SampleTomEEDeployApplicationIT.java | 2 +- .../boot/gradle/FlatdirTests.java | 4 +- .../gradle/MultiProjectRepackagingTests.java | 4 +- .../boot/gradle/RepackagingTests.java | 4 +- .../boot/gradle/SpringLoadedTests.java | 18 ++- .../boot/gradle/WarPackagingTests.java | 24 ++-- .../log4j/SampleActuatorApplicationTests.java | 4 +- .../SampleActuatorApplicationTests.java | 4 +- .../SampleActuatorUiApplicationPortTests.java | 4 +- .../ui/SampleActuatorUiApplicationTests.java | 24 ++-- ...gementAddressActuatorApplicationTests.java | 11 +- ...entPathSampleActuatorApplicationTests.java | 8 +- .../actuator/NonSensitiveHealthTests.java | 4 +- .../SampleActuatorApplicationTests.java | 43 +++--- ...letPathSampleActuatorApplicationTests.java | 8 +- ...nsecureSampleActuatorApplicationTests.java | 8 +- ...agementSampleActuatorApplicationTests.java | 15 +- ...nsecureSampleActuatorApplicationTests.java | 8 +- .../src/main/java/sample/ChatService.java | 4 +- .../SampleAtmosphereApplicationTests.java | 6 +- .../sample/batch/SampleBatchApplication.java | 4 +- .../batch/SampleBatchApplicationTests.java | 4 +- .../sample/data/gemfire/domain/Gemstone.java | 4 +- .../gemfire/service/GemstoneServiceImpl.java | 15 +- .../SampleDataGemFireApplicationTests.java | 16 +-- .../sample/data/jpa/domain/HotelSummary.java | 8 +- .../data/jpa/service/CityServiceImpl.java | 3 +- .../jpa/SampleDataJpaApplicationTests.java | 9 +- .../HotelRepositoryIntegrationTests.java | 8 +- .../flyway/SampleFlywayApplicationTests.java | 4 +- .../java/sample/web/CustomerController.java | 3 +- .../sample/SampleHateoasApplicationTests.java | 4 +- .../SampleIntegrationApplicationTests.java | 9 +- .../producer/ProducerApplication.java | 4 +- .../jersey/SampleJerseyApplication.java | 5 +- .../jersey/SampleJerseyApplicationTests.java | 8 +- .../SampleJersey1ApplicationTests.java | 4 +- .../jetty/SampleJettySslApplicationTests.java | 8 +- .../jetty/SampleJettyApplicationTests.java | 4 +- .../SampleJetty8SslApplicationTests.java | 8 +- .../jetty/SampleJetty8ApplicationTests.java | 4 +- .../atomikos/SampleAtomikosApplication.java | 4 +- .../bitronix/SampleBitronixApplication.java | 4 +- .../SampleLiquibaseApplicationTests.java | 21 ++- .../SampleParentContextApplication.java | 4 +- ...mpleIntegrationParentApplicationTests.java | 9 +- .../parent/producer/ProducerApplication.java | 4 +- .../secure/SampleSecureApplication.java | 6 +- .../secure/SampleSecureApplicationTests.java | 4 +- .../SampleServletApplicationTests.java | 4 +- .../testng/SampleTestNGApplicationTests.java | 4 +- .../jsp/SampleWebJspApplicationTests.java | 4 +- ...leTomcatTwoConnectorsApplicationTests.java | 22 +-- .../SampleTomcatSslApplicationTests.java | 8 +- ...igurationSampleTomcatApplicationTests.java | 7 +- .../tomcat/SampleTomcatApplicationTests.java | 4 +- .../jsp/SampleWebJspApplicationTests.java | 4 +- .../sample/traditional/config/WebConfig.java | 3 +- .../SampleTraditionalApplicationTests.java | 4 +- .../SampleUndertowSslApplicationTests.java | 8 +- .../SampleUndertowApplicationTests.java | 4 +- .../SampleWebFreeMarkerApplicationTests.java | 8 +- .../SampleGroovyTemplateApplicationTests.java | 16 +-- .../jsp/SampleWebJspApplicationTests.java | 4 +- .../SampleMethodSecurityApplication.java | 4 +- .../SampleMethodSecurityApplicationTests.java | 30 ++-- .../SampleWebMustacheApplicationTests.java | 8 +- ...SampleWebSecureCustomApplicationTests.java | 16 +-- ...SampleWebSecureCustomApplicationTests.java | 16 +-- .../secure/SampleSecureApplicationTests.java | 16 +-- .../ui/SampleWebStaticApplicationTests.java | 20 +-- .../ui/SampleWebUiApplicationTests.java | 16 +-- .../SampleWebVelocityApplicationTests.java | 8 +- .../reverse/ReverseWebSocketEndpoint.java | 4 +- .../snake/SnakeWebSocketHandler.java | 4 +- .../SampleWebSocketsApplicationTests.java | 11 +- ...omContainerWebSocketsApplicationTests.java | 10 +- .../reverse/ReverseWebSocketEndpoint.java | 4 +- .../snake/SnakeWebSocketHandler.java | 4 +- .../SampleWebSocketsApplicationTests.java | 11 +- ...omContainerWebSocketsApplicationTests.java | 10 +- .../reverse/ReverseWebSocketEndpoint.java | 4 +- .../snake/SnakeWebSocketHandler.java | 4 +- .../SampleWebSocketsApplicationTests.java | 11 +- ...omContainerWebSocketsApplicationTests.java | 10 +- .../main/java/sample/ws/WebServiceConfig.java | 3 +- .../sample/ws/endpoint/HolidayEndpoint.java | 8 +- .../sample/ws/SampleWsApplicationTests.java | 16 +-- ...figurationMetadataAnnotationProcessor.java | 47 +++---- .../MetadataCollector.java | 6 +- .../configurationprocessor/MetadataStore.java | 16 +-- .../TypeElementMembers.java | 14 +- .../configurationprocessor/TypeUtils.java | 10 +- .../fieldvalues/javac/ExpressionTree.java | 6 +- .../javac/JavaCompilerFieldValuesParser.java | 3 + .../fieldvalues/javac/Tree.java | 11 +- ...ationMetadataAnnotationProcessorTests.java | 95 +++++-------- .../ConfigurationMetadataMatchers.java | 14 +- .../configurationprocessor/TestCompiler.java | 7 +- ...figurationMetadataAnnotationProcessor.java | 8 +- .../configurationprocessor/TestProject.java | 4 +- .../AbstractFieldValuesProcessorTests.java | 11 +- ...JavaCompilerFieldValuesProcessorTests.java | 4 +- .../metadata/ConfigurationMetadataTests.java | 3 +- .../metadata/JsonMarshallerTests.java | 18 +-- .../simple/HierarchicalPropertiesParent.java | 4 +- .../dependency/tools/ManagedDependencies.java | 4 +- .../tools/ManagedDependenciesDelegate.java | 6 +- .../dependency/tools/PomDependencies.java | 4 +- .../ManagedDependenciesDelegateTests.java | 8 +- .../PropertiesFileDependenciesTests.java | 4 +- .../boot/loader/tools/FileUtils.java | 4 +- .../boot/loader/tools/JarWriter.java | 8 +- .../boot/loader/tools/JvmUtils.java | 4 +- .../boot/loader/tools/Layouts.java | 1 + .../boot/loader/tools/MainClassFinder.java | 6 +- .../boot/loader/tools/Repackager.java | 24 ++-- .../boot/loader/tools/RunProcess.java | 8 +- .../loader/tools/MainClassFinderTests.java | 4 +- .../boot/loader/tools/RepackagerTests.java | 12 +- .../boot/loader/LaunchedURLClassLoader.java | 3 +- .../springframework/boot/loader/Launcher.java | 3 +- .../boot/loader/MainMethodRunner.java | 4 +- .../boot/loader/PropertiesLauncher.java | 57 ++++---- .../boot/loader/archive/ExplodedArchive.java | 11 +- .../boot/loader/archive/FilteredArchive.java | 4 +- .../loader/data/RandomAccessDataFile.java | 5 +- .../loader/jar/CentralDirectoryEndRecord.java | 4 +- .../boot/loader/jar/Handler.java | 12 +- .../boot/loader/jar/JarEntryData.java | 14 +- .../boot/loader/jar/JarFile.java | 24 ++-- .../boot/loader/jar/JarURLConnection.java | 12 +- .../boot/loader/util/AsciiBytes.java | 4 +- .../boot/loader/util/SystemPropertyUtils.java | 15 +- .../ExecutableArchiveLauncherTests.java | 7 +- .../InputArgumentsJavaAgentDetectorTests.java | 27 ++-- .../loader/LaunchedURLClassLoaderTests.java | 34 ++--- .../boot/loader/PropertiesLauncherTests.java | 19 +-- .../boot/loader/WarLauncherTests.java | 20 ++- .../loader/archive/ExplodedArchiveTests.java | 26 ++-- .../loader/archive/JarFileArchiveTests.java | 4 +- .../data/ByteArrayRandomAccessDataTests.java | 10 +- .../data/RandomAccessDataFileTests.java | 4 +- .../boot/loader/jar/JarFileTests.java | 57 ++++---- .../loader/util/SystemPropertyUtilsTests.java | 3 +- .../maven/AbstractDependencyFilterMojo.java | 8 +- .../boot/maven/ArtifactsLibraries.java | 1 + .../PropertiesMergingResourceTransformer.java | 4 +- .../boot/maven/RepackageMojo.java | 12 +- .../boot/maven/RunArguments.java | 4 +- .../springframework/boot/maven/RunMojo.java | 38 +++--- .../boot/maven/DependencyFilterMojoTests.java | 4 +- .../boot/maven/ExcludeFilterTests.java | 35 ++--- .../boot/maven/IncludeFilterTests.java | 27 ++-- .../boot/maven/RunArgumentsTests.java | 3 +- .../springframework/boot/maven/Verify.java | 51 +++---- .../boot/BeanDefinitionLoader.java | 16 ++- .../springframework/boot/ResourceBanner.java | 13 +- .../boot/SpringApplication.java | 58 ++++---- .../boot/StartupInfoLogger.java | 3 +- .../DefaultPropertyNamePatternsMatcher.java | 3 +- .../bind/PropertiesConfigurationFactory.java | 17 ++- .../bind/PropertySourcesPropertyValues.java | 3 +- .../boot/bind/RelaxedConversionService.java | 16 +-- .../boot/bind/RelaxedDataBinder.java | 25 ++-- .../boot/bind/RelaxedNames.java | 7 +- .../boot/bind/RelaxedPropertyResolver.java | 4 +- .../SimplePropertyNamePatternsMatcher.java | 4 +- .../boot/bind/YamlConfigurationFactory.java | 15 +- ...tContextApplicationContextInitializer.java | 4 +- ...arentContextCloserApplicationListener.java | 10 +- .../builder/SpringApplicationBuilder.java | 3 +- .../cloudfoundry/VcapApplicationListener.java | 12 +- ...WarningsApplicationContextInitializer.java | 15 +- ...ontextIdApplicationContextInitializer.java | 4 +- .../FileEncodingApplicationListener.java | 7 +- .../config/AnsiOutputApplicationListener.java | 4 +- .../config/ConfigFileApplicationListener.java | 65 ++++----- ...legatingApplicationContextInitializer.java | 18 +-- .../config/DelegatingApplicationListener.java | 8 +- ...tConfigurableEmbeddedServletContainer.java | 4 +- ...stractEmbeddedServletContainerFactory.java | 15 +- ...onConfigEmbeddedWebApplicationContext.java | 4 +- ...tContainerCustomizerBeanPostProcessor.java | 12 +- .../EmbeddedWebApplicationContext.java | 25 ++-- .../embedded/FilterRegistrationBean.java | 12 +- ...rConfiguringServletContextInitializer.java | 4 +- .../boot/context/embedded/MimeMappings.java | 6 +- .../ServletContextInitializerBeans.java | 34 ++--- .../ServletListenerRegistrationBean.java | 10 +- ...onContextServletContextAwareProcessor.java | 4 +- .../jetty/JettyEmbeddedServletContainer.java | 8 +- .../JettyEmbeddedServletContainerFactory.java | 54 ++++---- .../tomcat/SkipPatternJarScanner.java | 10 +- .../tomcat/TomcatEmbeddedContext.java | 5 +- .../TomcatEmbeddedServletContainer.java | 12 +- ...TomcatEmbeddedServletContainerFactory.java | 32 +++-- .../TomcatEmbeddedWebappClassLoader.java | 4 +- .../embedded/tomcat/TomcatResources.java | 4 +- .../UndertowEmbeddedServletContainer.java | 4 +- ...dertowEmbeddedServletContainerFactory.java | 13 +- .../ConfigurationBeanFactoryMetaData.java | 7 +- ...urationPropertiesBindingPostProcessor.java | 37 +++-- ...opertiesBindingPostProcessorRegistrar.java | 8 +- ...ConfigurationPropertiesImportSelector.java | 23 ++-- .../boot/context/web/ErrorPageFilter.java | 23 ++-- .../web/OrderedCharacterEncodingFilter.java | 4 +- .../web/OrderedHiddenHttpMethodFilter.java | 4 +- .../web/SpringBootServletInitializer.java | 15 +- .../EnumerableCompositePropertySource.java | 11 +- .../boot/env/PropertySourcesLoader.java | 6 +- .../AtomikosConnectionFactoryBean.java | 6 +- ...ikosDependsOnBeanFactoryPostProcessor.java | 19 +-- .../boot/jta/atomikos/AtomikosProperties.java | 4 +- .../AtomikosXAConnectionFactoryWrapper.java | 3 +- ...onixDependentBeanFactoryPostProcessor.java | 8 +- .../BitronixXAConnectionFactoryWrapper.java | 3 +- .../bitronix/BitronixXADataSourceWrapper.java | 3 +- .../PoolingConnectionFactoryBean.java | 4 +- .../jta/bitronix/PoolingDataSourceBean.java | 4 +- ...baseServiceLocatorApplicationListener.java | 4 +- .../SpringPackageScanClassResolver.java | 11 +- .../boot/logging/AbstractLoggingSystem.java | 3 +- .../ClasspathLoggingApplicationListener.java | 8 +- .../logging/LoggingApplicationListener.java | 18 ++- .../boot/logging/LoggingSystem.java | 1 + .../boot/logging/java/JavaLoggingSystem.java | 9 +- .../logging/log4j/Log4JLoggingSystem.java | 9 +- .../logging/log4j2/Log4J2LoggingSystem.java | 9 +- .../boot/logging/logback/ColorConverter.java | 2 + .../logback/DefaultLogbackConfiguration.java | 4 +- .../logback/LevelRemappingAppender.java | 8 +- .../logging/logback/LogbackLoggingSystem.java | 28 ++-- .../boot/orm/jpa/EntityScanRegistrar.java | 23 ++-- .../boot/orm/jpa/SpringNamingStrategy.java | 4 +- .../org/springframework/boot/test/Base64.java | 101 +++++++------- ...nfigFileApplicationContextInitializer.java | 4 +- .../IntegrationTestPropertiesListener.java | 3 +- .../MergedContextConfigurationProperties.java | 7 +- ...PortInfoApplicationContextInitializer.java | 15 +- .../test/SpringApplicationContextLoader.java | 32 +++-- .../boot/test/TestRestTemplate.java | 20 +-- ...AppIntegrationTestContextBootstrapper.java | 4 +- .../velocity/EmbeddedVelocityToolboxView.java | 6 +- .../boot/yaml/ArrayDocumentMatcher.java | 4 +- .../boot/BeanDefinitionLoaderTests.java | 3 +- .../boot/OverrideSourcesTests.java | 8 +- .../org/springframework/boot/ReproTests.java | 20 ++- .../springframework/boot/SimpleMainTests.java | 4 +- .../boot/SpringApplicationTests.java | 56 ++++---- .../boot/StartUpLoggerTests.java | 4 +- .../boot/ansi/AnsiOutputTests.java | 4 +- ...faultPropertyNamePatternsMatcherTests.java | 4 +- ...ropertiesConfigurationFactoryMapTests.java | 8 +- .../PropertiesConfigurationFactoryTests.java | 8 +- .../PropertySourcesPropertyValuesTests.java | 12 +- .../boot/bind/RelaxedDataBinderTests.java | 36 ++--- .../bind/RelaxedPropertyResolverTests.java | 4 +- .../bind/YamlConfigurationFactoryTests.java | 4 +- .../SpringApplicationBuilderTests.java | 75 +++++----- .../VcapApplicationListenerTests.java | 104 +++++++------- ...ngsApplicationContextInitializerTests.java | 8 +- .../ConfigFileApplicationListenerTests.java | 129 ++++++++---------- ...ingApplicationContextInitializerTests.java | 20 +-- .../DelegatingApplicationListenerTests.java | 6 +- ...tEmbeddedServletContainerFactoryTests.java | 69 +++++----- ...figEmbeddedWebApplicationContextTests.java | 8 +- ...edServletContainerMvcIntegrationTests.java | 7 +- .../EmbeddedWebApplicationContextTests.java | 50 +++---- .../embedded/FilterRegistrationBeanTests.java | 15 +- .../MockEmbeddedServletContainerFactory.java | 28 ++-- .../boot/context/embedded/MockServlet.java | 4 +- .../ServletListenerRegistrationBeanTests.java | 4 +- ...XmlEmbeddedWebApplicationContextTests.java | 7 +- ...yEmbeddedServletContainerFactoryTests.java | 11 +- ...tEmbeddedServletContainerFactoryTests.java | 7 +- ...wEmbeddedServletContainerFactoryTests.java | 12 +- ...onPropertiesBindingPostProcessorTests.java | 5 +- .../EnableConfigurationPropertiesTests.java | 10 +- .../web/ErrorPageFilterIntegrationTests.java | 4 +- .../context/web/ErrorPageFilterTests.java | 19 +-- .../SpringBootServletInitializerTests.java | 7 +- .../PropertiesPropertySourceLoaderTests.java | 8 +- .../env/YamlPropertySourceLoaderTests.java | 3 +- .../boot/json/AbstractJsonParserTests.java | 4 +- .../AtomikosConnectionFactoryBeanTests.java | 7 +- ...ependsOnBeanFactoryPostProcessorTests.java | 4 +- .../CommonsLoggingLiquibaseLoggerTests.java | 3 +- .../boot/logging/LogFileTests.java | 3 +- .../LoggingApplicationListenerTests.java | 14 +- .../logging/java/JavaLoggerSystemTests.java | 10 +- .../log4j/Log4JLoggingSystemTests.java | 4 +- .../log4j2/Log4J2LoggingSystemTests.java | 3 +- .../boot/orm/jpa/EntityScanTests.java | 13 +- .../test/AbstractConfigurationClassTests.java | 4 +- .../ApplicationContextTestUtilsTests.java | 3 +- .../SpringApplicationContextLoaderTests.java | 7 +- ...SpringApplicationIntegrationTestTests.java | 4 +- ...ingApplicationWebIntegrationTestTests.java | 4 +- .../boot/test/TestRestTemplateTests.java | 6 +- .../EmbeddedVelocityToolboxViewTests.java | 8 +- .../boot/yaml/ArrayDocumentMatcherTests.java | 4 +- 652 files changed, 4150 insertions(+), 3918 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java index 1587f21ef8..2bf0b72295 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java @@ -135,8 +135,8 @@ public class AuditEvent implements Serializable { @Override public String toString() { - return "AuditEvent [timestamp=" + this.timestamp + ", principal=" - + this.principal + ", type=" + this.type + ", data=" + this.data + "]"; + return "AuditEvent [timestamp=" + this.timestamp + ", principal=" + this.principal + + ", type=" + this.type + ", data=" + this.data + "]"; } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/listener/AuditApplicationEvent.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/listener/AuditApplicationEvent.java index 94c8e2a25b..351f12b132 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/listener/AuditApplicationEvent.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/listener/AuditApplicationEvent.java @@ -40,7 +40,8 @@ public class AuditApplicationEvent extends ApplicationEvent { * @param data the event data * @see AuditEvent#AuditEvent(String, String, Map) */ - public AuditApplicationEvent(String principal, String type, Map data) { + public AuditApplicationEvent(String principal, String type, + Map data) { this(new AuditEvent(principal, type, data)); } 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 1ce38e694b..2b7d9b56a1 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 @@ -104,11 +104,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 classpath*:/commands/**. To - * add different locations or override the default use - * 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 + * classpath*:/commands/**. To add different locations or override the + * default use shell.command_path_patterns in your application configuration. * * @author Christian Dupuis * @see ShellProperties @@ -180,8 +180,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; } @@ -240,8 +240,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; @@ -273,9 +273,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; @@ -347,8 +347,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; @@ -356,7 +356,7 @@ public class CrshAutoConfiguration { public BeanFactoryFilteringPluginDiscovery(ClassLoader classLoader, ListableBeanFactory beanFactory, String[] disabledPlugins) - throws NullPointerException { + throws NullPointerException { super(classLoader); this.beanFactory = beanFactory; this.disabledPlugins = disabledPlugins; @@ -373,8 +373,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); @@ -405,8 +405,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; } } @@ -507,7 +507,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/EndpointAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java index d0960dd5f5..43b18f4709 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java @@ -234,8 +234,8 @@ public class EndpointAutoConfiguration { private String time; public String getId() { - return this.id == null ? "" : (this.id.length() > 7 ? this.id.substring( - 0, 7) : this.id); + return this.id == null ? "" + : (this.id.length() > 7 ? this.id.substring(0, 7) : this.id); } public void setId(String id) { 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 ab141a0ea3..2c12ca645e 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 @@ -74,12 +74,13 @@ public class EndpointMBeanExportAutoConfiguration { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - String endpointEnabled = context.getEnvironment().getProperty( - "endpoints.jmx.enabled", "true"); - String jmxEnabled = context.getEnvironment().getProperty( - "spring.jmx.enabled", "true"); - return new ConditionOutcome("true".equalsIgnoreCase(endpointEnabled) - && "true".equalsIgnoreCase(jmxEnabled), + String endpointEnabled = context.getEnvironment() + .getProperty("endpoints.jmx.enabled", "true"); + String jmxEnabled = context.getEnvironment().getProperty("spring.jmx.enabled", + "true"); + return new ConditionOutcome( + "true".equalsIgnoreCase(endpointEnabled) + && "true".equalsIgnoreCase(jmxEnabled), "JMX endpoint and JMX enabled"); } 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 1bc0c4edb3..f116e83344 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 @@ -94,8 +94,8 @@ import org.springframework.web.servlet.DispatcherServlet; EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class, ManagementServerPropertiesAutoConfiguration.class }) @EnableConfigurationProperties(HealthMvcEndpointProperties.class) -public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, - SmartInitializingSingleton { +public class EndpointWebMvcAutoConfiguration + implements ApplicationContextAware, SmartInitializingSingleton { private static Log logger = LogFactory.getLog(EndpointWebMvcAutoConfiguration.class); @@ -119,9 +119,10 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, @Bean @ConditionalOnMissingBean public EndpointHandlerMapping endpointHandlerMapping() { - EndpointHandlerMapping mapping = new EndpointHandlerMapping(mvcEndpoints() - .getEndpoints()); - boolean disabled = ManagementServerPort.get(this.applicationContext) != ManagementServerPort.SAME; + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + mvcEndpoints().getEndpoints()); + boolean disabled = ManagementServerPort + .get(this.applicationContext) != ManagementServerPort.SAME; mapping.setDisabled(disabled); if (!disabled) { mapping.setPrefix(this.managementServerProperties.getContextPath()); @@ -144,10 +145,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()); } } @@ -172,8 +173,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, 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; } @@ -210,14 +211,16 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, // Ensure close on the parent also closes the child if (this.applicationContext instanceof ConfigurableApplicationContext) { ((ConfigurableApplicationContext) this.applicationContext) - .addApplicationListener(new ApplicationListener() { - @Override - public void onApplicationEvent(ContextClosedEvent event) { - if (event.getApplicationContext() == EndpointWebMvcAutoConfiguration.this.applicationContext) { - childContext.close(); - } - } - }); + .addApplicationListener( + new ApplicationListener() { + @Override + public void onApplicationEvent(ContextClosedEvent event) { + if (event + .getApplicationContext() == EndpointWebMvcAutoConfiguration.this.applicationContext) { + childContext.close(); + } + } + }); } try { childContext.refresh(); @@ -227,7 +230,8 @@ 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 container (management endpoints are still available through JMX)"); + logger.warn( + "Could not start embedded container (management endpoints are still available through JMX)"); } else { throw ex; @@ -242,8 +246,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)) { @@ -283,7 +287,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); @@ -328,7 +332,7 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, return ((port == null) || (serverProperties.getPort() == null && port.equals(8080)) || (port != 0 && port.equals(serverProperties.getPort())) ? SAME - : DIFFERENT); + : DIFFERENT); } } 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 119e1fdd55..f78d7dc757 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 @@ -79,8 +79,8 @@ public class EndpointWebMvcChildContextConfiguration { private List mappingCustomizers; @Configuration - protected static class ServerCustomization implements - EmbeddedServletContainerCustomizer, Ordered { + protected static class ServerCustomization + implements EmbeddedServletContainerCustomizer, Ordered { @Value("${error.path:/error}") private String errorPath = "/error"; @@ -198,8 +198,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, 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 db4dbd1b8e..90d73762bc 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 @@ -158,15 +158,16 @@ public class HealthIndicatorAutoConfiguration { @ConditionalOnMissingBean(name = "mongoHealthIndicator") public HealthIndicator mongoHealthIndicator() { if (this.mongoTemplates.size() == 1) { - return new MongoHealthIndicator(this.mongoTemplates.values().iterator() - .next()); + return new MongoHealthIndicator( + this.mongoTemplates.values().iterator().next()); } CompositeHealthIndicator composite = new CompositeHealthIndicator( this.healthAggregator); - for (Map.Entry entry : this.mongoTemplates.entrySet()) { - composite.addHealthIndicator(entry.getKey(), new MongoHealthIndicator( - entry.getValue())); + for (Map.Entry entry : this.mongoTemplates + .entrySet()) { + composite.addHealthIndicator(entry.getKey(), + new MongoHealthIndicator(entry.getValue())); } return composite; } @@ -187,16 +188,16 @@ public class HealthIndicatorAutoConfiguration { @ConditionalOnMissingBean(name = "redisHealthIndicator") public HealthIndicator redisHealthIndicator() { if (this.redisConnectionFactories.size() == 1) { - return new RedisHealthIndicator(this.redisConnectionFactories.values() - .iterator().next()); + return new RedisHealthIndicator( + this.redisConnectionFactories.values().iterator().next()); } CompositeHealthIndicator composite = new CompositeHealthIndicator( this.healthAggregator); for (Map.Entry entry : this.redisConnectionFactories .entrySet()) { - composite.addHealthIndicator(entry.getKey(), new RedisHealthIndicator( - entry.getValue())); + composite.addHealthIndicator(entry.getKey(), + new RedisHealthIndicator(entry.getValue())); } return composite; } @@ -217,16 +218,16 @@ public class HealthIndicatorAutoConfiguration { @ConditionalOnMissingBean(name = "rabbitHealthIndicator") public HealthIndicator rabbitHealthIndicator() { if (this.rabbitTemplates.size() == 1) { - return new RabbitHealthIndicator(this.rabbitTemplates.values().iterator() - .next()); + return new RabbitHealthIndicator( + this.rabbitTemplates.values().iterator().next()); } CompositeHealthIndicator composite = new CompositeHealthIndicator( this.healthAggregator); for (Map.Entry entry : this.rabbitTemplates .entrySet()) { - composite.addHealthIndicator(entry.getKey(), new RabbitHealthIndicator( - entry.getValue())); + composite.addHealthIndicator(entry.getKey(), + new RabbitHealthIndicator(entry.getValue())); } return composite; } @@ -247,15 +248,15 @@ public class HealthIndicatorAutoConfiguration { @ConditionalOnMissingBean(name = "solrHealthIndicator") public HealthIndicator solrHealthIndicator() { if (this.solrServers.size() == 1) { - return new SolrHealthIndicator(this.solrServers.entrySet().iterator() - .next().getValue()); + return new SolrHealthIndicator( + this.solrServers.entrySet().iterator().next().getValue()); } CompositeHealthIndicator composite = new CompositeHealthIndicator( this.healthAggregator); for (Map.Entry entry : this.solrServers.entrySet()) { - composite.addHealthIndicator(entry.getKey(), new SolrHealthIndicator( - entry.getValue())); + composite.addHealthIndicator(entry.getKey(), + new SolrHealthIndicator(entry.getValue())); } return composite; } 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 3cfe63c42f..a5e5317578 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 @@ -44,8 +44,8 @@ import org.springframework.context.annotation.Configuration; * *

* Additional configuration parameters for Jolokia can be provided by specifying - * jolokia.config.* properties. See the http://jolokia.org web site for more information on + * 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/ManagementSecurityAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfiguration.java index a190a16d84..ca7ec170f0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfiguration.java @@ -94,8 +94,8 @@ public class ManagementSecurityAutoConfiguration { } @Configuration - protected static class ManagementSecurityPropertiesConfiguration implements - SecurityPrerequisite { + protected static class ManagementSecurityPropertiesConfiguration + implements SecurityPrerequisite { @Autowired(required = false) private SecurityProperties security; @@ -115,8 +115,8 @@ public class ManagementSecurityAutoConfiguration { // 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; @@ -145,8 +145,8 @@ public class ManagementSecurityAutoConfiguration { List ignored = SpringBootWebSecurityConfiguration .getIgnored(this.security); if (!this.management.getSecurity().isEnabled()) { - ignored.addAll(Arrays - .asList(getEndpointPaths(this.endpointHandlerMapping))); + ignored.addAll( + Arrays.asList(getEndpointPaths(this.endpointHandlerMapping))); } if (ignored.contains("none")) { ignored.remove("none"); @@ -185,12 +185,13 @@ public class ManagementSecurityAutoConfiguration { @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"); } @@ -200,8 +201,8 @@ public class ManagementSecurityAutoConfiguration { @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; @@ -233,8 +234,8 @@ public class ManagementSecurityAutoConfiguration { http.exceptionHandling().authenticationEntryPoint(entryPoint); paths = this.server.getPathsArray(paths); http.requestMatchers().antMatchers(paths); - String[] endpointPaths = this.server.getPathsArray(getEndpointPaths( - this.endpointHandlerMapping, false)); + String[] endpointPaths = this.server.getPathsArray( + getEndpointPaths(this.endpointHandlerMapping, false)); configureAuthorizeRequests(endpointPaths, http.authorizeRequests()); http.httpBasic().authenticationEntryPoint(entryPoint); // No cookies for management endpoints by default @@ -252,8 +253,7 @@ public class ManagementSecurityAutoConfiguration { return entryPoint; } - private void configureAuthorizeRequests( - String[] endpointPaths, + private void configureAuthorizeRequests(String[] endpointPaths, ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry requests) { requests.antMatchers(endpointPaths).permitAll(); requests.anyRequest().hasRole(this.management.getSecurity().getRole()); @@ -261,7 +261,8 @@ public class ManagementSecurityAutoConfiguration { } - private static String[] getEndpointPaths(EndpointHandlerMapping endpointHandlerMapping) { + private static String[] getEndpointPaths( + EndpointHandlerMapping endpointHandlerMapping) { return StringUtils.mergeStringArrays( getEndpointPaths(endpointHandlerMapping, false), getEndpointPaths(endpointHandlerMapping, true)); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java index fbd4fcc92e..f71b8bbcd3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java @@ -53,7 +53,8 @@ public class ManagementServerProperties implements SecurityPrerequisite { * management endpoints. This is a useful place to put user-defined access rules if * you want to override the default access rules. */ - public static final int ACCESS_OVERRIDE_ORDER = ManagementServerProperties.BASIC_AUTH_ORDER - 1; + public static final int ACCESS_OVERRIDE_ORDER = ManagementServerProperties.BASIC_AUTH_ORDER + - 1; /** * Management endpoint HTTP port. Use the same port as the applicationby default. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java index b3e8a4ab81..0266177609 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java @@ -162,7 +162,8 @@ public class MetricRepositoryAutoConfiguration { } @Bean - public DropwizardMetricWriter dropwizardMetricWriter(MetricRegistry metricRegistry) { + public DropwizardMetricWriter dropwizardMetricWriter( + MetricRegistry metricRegistry) { return new DropwizardMetricWriter(metricRegistry); } 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 b045e5da65..e1ae8b00a6 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 @@ -67,8 +67,8 @@ final class MetricsFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, - HttpServletResponse response, FilterChain chain) throws ServletException, - IOException { + HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { StopWatch stopWatch = createStopWatchIfNecessary(request); String path = new UrlPathHelper().getPathWithinApplication(request); int status = HttpStatus.INTERNAL_SERVER_ERROR.value(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java index f519e4f819..fbf746fd75 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java @@ -51,7 +51,8 @@ public class ShellProperties { private boolean defaultAuth = true; @Autowired(required = false) - private CrshShellProperties[] additionalProperties = new CrshShellProperties[] { new SimpleAuthenticationProperties() }; + private CrshShellProperties[] additionalProperties = new CrshShellProperties[] { + new SimpleAuthenticationProperties() }; /** * Scan for changes and update the command if necessary (in seconds). @@ -216,8 +217,8 @@ public class ShellProperties { /** * Base class for Auth specific properties. */ - public static abstract class CrshShellAuthenticationProperties extends - CrshShellProperties { + public static abstract class CrshShellAuthenticationProperties + extends CrshShellProperties { } @@ -326,8 +327,8 @@ public class ShellProperties { * Auth specific properties for JAAS authentication */ @ConfigurationProperties(prefix = "shell.auth.jaas", ignoreUnknownFields = false) - public static class JaasAuthenticationProperties extends - CrshShellAuthenticationProperties { + public static class JaasAuthenticationProperties + extends CrshShellAuthenticationProperties { /** * JAAS domain. @@ -355,8 +356,8 @@ public class ShellProperties { * Auth specific properties for key authentication */ @ConfigurationProperties(prefix = "shell.auth.key", ignoreUnknownFields = false) - public static class KeyAuthenticationProperties extends - CrshShellAuthenticationProperties { + public static class KeyAuthenticationProperties + extends CrshShellAuthenticationProperties { /** * Path to the authentication key. This should point to a valid ".pem" file. @@ -386,8 +387,8 @@ public class ShellProperties { * Auth specific properties for simple authentication */ @ConfigurationProperties(prefix = "shell.auth.simple", ignoreUnknownFields = false) - public static class SimpleAuthenticationProperties extends - CrshShellAuthenticationProperties { + public static class SimpleAuthenticationProperties + extends CrshShellAuthenticationProperties { private static Log logger = LogFactory .getLog(SimpleAuthenticationProperties.class); @@ -461,8 +462,8 @@ public class ShellProperties { * Auth specific properties for Spring authentication */ @ConfigurationProperties(prefix = "shell.auth.spring", ignoreUnknownFields = false) - public static class SpringAuthenticationProperties extends - CrshShellAuthenticationProperties { + public static class SpringAuthenticationProperties + extends CrshShellAuthenticationProperties { /** * Comma-separated list of required roles to login to the CRaSH console. 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 89c1d9fb43..27a2dc9982 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 @@ -53,8 +53,8 @@ class OnEnabledEndpointCondition extends SpringBootCondition { if (resolver.containsProperty("enabled") || !enabledByDefault) { boolean match = resolver.getProperty("enabled", Boolean.class, enabledByDefault); - return new ConditionOutcome(match, "The " + endpointName + " is " - + (match ? "enabled" : "disabled")); + return new ConditionOutcome(match, + "The " + endpointName + " is " + (match ? "enabled" : "disabled")); } return null; } @@ -63,8 +63,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/AbstractEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java index a7e4436b3a..eb3d880a33 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java @@ -109,8 +109,8 @@ public abstract class AbstractEndpoint implements Endpoint, EnvironmentAwa return this.enabled; } if (this.environment != null) { - return this.environment.getProperty(ENDPOINTS_ENABLED_PROPERTY, - Boolean.class, true); + return this.environment.getProperty(ENDPOINTS_ENABLED_PROPERTY, Boolean.class, + true); } return true; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java index b129b1b2e2..03c0615035 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java @@ -36,8 +36,8 @@ import org.springframework.core.env.Environment; * @author Dave Syer */ @ConfigurationProperties(prefix = "endpoints.beans", ignoreUnknownFields = false) -public class BeansEndpoint extends AbstractEndpoint> implements - ApplicationContextAware { +public class BeansEndpoint extends AbstractEndpoint> + implements ApplicationContextAware { private final LiveBeansView liveBeansView = new LiveBeansView(); 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 a7aeb59bfc..f68ac5974f 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 @@ -71,8 +71,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"; @@ -128,7 +128,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()) { @@ -179,8 +180,8 @@ public class ConfigurationPropertiesReportEndpoint extends } try { @SuppressWarnings("unchecked") - Map result = new HashMap(mapper.convertValue( - this.metadata.extractMap(bean, prefix), Map.class)); + Map result = new HashMap(mapper + .convertValue(this.metadata.extractMap(bean, prefix), Map.class)); return result; } catch (Exception ex) { @@ -230,8 +231,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 @@ -267,8 +268,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) { @@ -330,9 +331,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, @@ -387,9 +387,8 @@ public class ConfigurationPropertiesReportEndpoint extends private Set findKeys(String prefix) { HashSet keys = new HashSet(); for (String key : getKeys()) { - if (key.length() > prefix.length() - && key.startsWith(prefix) - && ".".equals(key.substring(prefix.length(), prefix.length() + 1))) { + if (key.length() > prefix.length() && key.startsWith(prefix) && "." + .equals(key.substring(prefix.length(), prefix.length() + 1))) { keys.add(key.substring(prefix.length() + 1)); } } @@ -416,8 +415,8 @@ public class ConfigurationPropertiesReportEndpoint extends } @SuppressWarnings("unchecked") - private void addKeys(ObjectMapper mapper, Resource resource) throws IOException, - JsonParseException, JsonMappingException { + private void addKeys(ObjectMapper mapper, Resource resource) + throws IOException, JsonParseException, JsonMappingException { InputStream inputStream = resource.getInputStream(); Map map = mapper.readValue(inputStream, Map.class); Collection> metadata = (Collection>) map @@ -448,8 +447,8 @@ public class ConfigurationPropertiesReportEndpoint extends @SuppressWarnings("unchecked") private void addProperty(Object bean, String key, Map map) { String prefix = (key.contains(".") ? StringUtils.split(key, ".")[0] : key); - String suffix = (key.length() > prefix.length() ? key.substring(prefix - .length() + 1) : null); + String suffix = (key.length() > prefix.length() + ? key.substring(prefix.length() + 1) : null); String property = prefix; if (bean instanceof Map) { Map value = (Map) bean; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java index 43530f7ef6..de201e33a4 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java @@ -84,7 +84,8 @@ public class DataSourcePublicMetrics implements PublicMetrics { return metrics; } - private void addMetric(Set> metrics, String name, T value) { + private void addMetric(Set> metrics, String name, + T value) { if (value != null) { metrics.add(new Metric(name, value)); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DumpEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DumpEndpoint.java index 497f4823e8..ce34dae2f3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DumpEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DumpEndpoint.java @@ -40,8 +40,8 @@ public class DumpEndpoint extends AbstractEndpoint> { @Override public List invoke() { - return Arrays.asList(ManagementFactory.getThreadMXBean().dumpAllThreads(true, - true)); + return Arrays + .asList(ManagementFactory.getThreadMXBean().dumpAllThreads(true, true)); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java index 79f4562e3e..335d7039da 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java @@ -84,11 +84,12 @@ public class RequestMappingEndpoint extends AbstractEndpoint protected void extractMethodMappings(ApplicationContext applicationContext, Map result) { if (applicationContext != null) { - for (String name : applicationContext.getBeansOfType( - AbstractHandlerMethodMapping.class).keySet()) { + for (String name : applicationContext + .getBeansOfType(AbstractHandlerMethodMapping.class).keySet()) { @SuppressWarnings("unchecked") - Map methods = applicationContext.getBean(name, - AbstractHandlerMethodMapping.class).getHandlerMethods(); + Map methods = applicationContext + .getBean(name, AbstractHandlerMethodMapping.class) + .getHandlerMethods(); for (Object key : methods.keySet()) { Map map = new LinkedHashMap(); map.put("bean", name); @@ -142,10 +143,8 @@ public class RequestMappingEndpoint extends AbstractEndpoint for (AbstractHandlerMethodMapping mapping : methodMappings) { Map methods = mapping.getHandlerMethods(); for (Map.Entry entry : methods.entrySet()) { - result.put( - String.valueOf(entry.getKey()), - Collections.singletonMap("method", - String.valueOf(entry.getValue()))); + result.put(String.valueOf(entry.getKey()), Collections + .singletonMap("method", String.valueOf(entry.getValue()))); } } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java index ad05ffeabb..922b79dc8b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java @@ -51,11 +51,13 @@ public class RichGaugeReaderPublicMetrics implements PublicMetrics { private List> convert(RichGauge gauge) { List> result = new ArrayList>(6); - result.add(new Metric(gauge.getName() + RichGauge.AVG, gauge.getAverage())); + result.add( + new Metric(gauge.getName() + RichGauge.AVG, gauge.getAverage())); result.add(new Metric(gauge.getName() + RichGauge.VAL, gauge.getValue())); result.add(new Metric(gauge.getName() + RichGauge.MIN, gauge.getMin())); result.add(new Metric(gauge.getName() + RichGauge.MAX, gauge.getMax())); - result.add(new Metric(gauge.getName() + RichGauge.ALPHA, gauge.getAlpha())); + result.add( + new Metric(gauge.getName() + RichGauge.ALPHA, gauge.getAlpha())); result.add(new Metric(gauge.getName() + RichGauge.COUNT, gauge.getCount())); return result; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java index 5ad68a7f72..6de9ca8d64 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java @@ -32,8 +32,8 @@ import org.springframework.context.ConfigurableApplicationContext; * @author Christian Dupuis */ @ConfigurationProperties(prefix = "endpoints.shutdown", ignoreUnknownFields = false) -public class ShutdownEndpoint extends AbstractEndpoint> implements - ApplicationContextAware { +public class ShutdownEndpoint extends AbstractEndpoint> + implements ApplicationContextAware { private ConfigurableApplicationContext context; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java index bc0ffad3d3..23f9c069aa 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java @@ -66,11 +66,12 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { protected void addBasicMetrics(Collection> result) { // NOTE: ManagementFactory must not be used here since it fails on GAE result.add(new Metric("mem", Runtime.getRuntime().totalMemory() / 1024)); - result.add(new Metric("mem.free", Runtime.getRuntime().freeMemory() / 1024)); - result.add(new Metric("processors", Runtime.getRuntime() - .availableProcessors())); - result.add(new Metric("instance.uptime", System.currentTimeMillis() - - this.timestamp)); + result.add( + new Metric("mem.free", Runtime.getRuntime().freeMemory() / 1024)); + result.add(new Metric("processors", + Runtime.getRuntime().availableProcessors())); + result.add(new Metric("instance.uptime", + System.currentTimeMillis() - this.timestamp)); } /** @@ -80,10 +81,10 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { private void addManagementMetrics(Collection> result) { try { // Add JVM up time in ms - result.add(new Metric("uptime", ManagementFactory.getRuntimeMXBean() - .getUptime())); - result.add(new Metric("systemload.average", ManagementFactory - .getOperatingSystemMXBean().getSystemLoadAverage())); + result.add(new Metric("uptime", + ManagementFactory.getRuntimeMXBean().getUptime())); + result.add(new Metric("systemload.average", + ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage())); addHeapMetrics(result); addThreadMetrics(result); addClassLoadingMetrics(result); @@ -113,10 +114,10 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { */ protected void addThreadMetrics(Collection> result) { ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean(); - result.add(new Metric("threads.peak", (long) threadMxBean - .getPeakThreadCount())); - result.add(new Metric("threads.daemon", (long) threadMxBean - .getDaemonThreadCount())); + result.add(new Metric("threads.peak", + (long) threadMxBean.getPeakThreadCount())); + result.add(new Metric("threads.daemon", + (long) threadMxBean.getDaemonThreadCount())); result.add(new Metric("threads", (long) threadMxBean.getThreadCount())); } @@ -126,12 +127,12 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { */ protected void addClassLoadingMetrics(Collection> result) { ClassLoadingMXBean classLoadingMxBean = ManagementFactory.getClassLoadingMXBean(); - result.add(new Metric("classes", (long) classLoadingMxBean - .getLoadedClassCount())); - result.add(new Metric("classes.loaded", classLoadingMxBean - .getTotalLoadedClassCount())); - result.add(new Metric("classes.unloaded", classLoadingMxBean - .getUnloadedClassCount())); + result.add(new Metric("classes", + (long) classLoadingMxBean.getLoadedClassCount())); + result.add(new Metric("classes.loaded", + classLoadingMxBean.getTotalLoadedClassCount())); + result.add(new Metric("classes.unloaded", + classLoadingMxBean.getUnloadedClassCount())); } /** @@ -143,10 +144,10 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { .getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMxBeans) { String name = beautifyGcName(garbageCollectorMXBean.getName()); - result.add(new Metric("gc." + name + ".count", garbageCollectorMXBean - .getCollectionCount())); - result.add(new Metric("gc." + name + ".time", garbageCollectorMXBean - .getCollectionTime())); + result.add(new Metric("gc." + name + ".count", + garbageCollectorMXBean.getCollectionCount())); + result.add(new Metric("gc." + name + ".time", + garbageCollectorMXBean.getCollectionTime())); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java index 97e8ba596d..71ea6487e3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java @@ -47,7 +47,8 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa @Override public Collection> metrics() { if (this.applicationContext instanceof EmbeddedWebApplicationContext) { - Manager manager = getManager((EmbeddedWebApplicationContext) this.applicationContext); + Manager manager = getManager( + (EmbeddedWebApplicationContext) this.applicationContext); if (manager != null) { return metrics(manager); } @@ -65,7 +66,8 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa } private Manager getManager(TomcatEmbeddedServletContainer servletContainer) { - for (Container container : servletContainer.getTomcat().getHost().findChildren()) { + for (Container container : servletContainer.getTomcat().getHost() + .findChildren()) { if (container instanceof Context) { return ((Context) container).getManager(); } 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 6181539867..97315f5701 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 @@ -56,8 +56,8 @@ import org.springframework.util.ObjectUtils; * * @author Christian Dupuis */ -public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecycle, - BeanFactoryAware, ApplicationContextAware { +public class EndpointMBeanExporter extends MBeanExporter + implements SmartLifecycle, BeanFactoryAware, ApplicationContextAware { public static final String DEFAULT_DOMAIN = "org.springframework.boot"; @@ -121,7 +121,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; } @@ -191,9 +192,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/EndpointHandlerMapping.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java index 74cb67ed96..35077c19a0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java @@ -48,8 +48,8 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl * @author Christian Dupuis * @author Dave Syer */ -public class EndpointHandlerMapping extends RequestMappingHandlerMapping implements - ApplicationContextAware { +public class EndpointHandlerMapping extends RequestMappingHandlerMapping + implements ApplicationContextAware { private final Set endpoints; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java index 3915131ded..15f622bda4 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java @@ -33,8 +33,8 @@ import org.springframework.web.bind.annotation.ResponseStatus; * @author Christian Dupuis * @author Andy Wilkinson */ -public class EnvironmentMvcEndpoint extends EndpointMvcAdapter implements - EnvironmentAware { +public class EnvironmentMvcEndpoint extends EndpointMvcAdapter + implements EnvironmentAware { private Environment environment; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java index 6f3de12c1f..122f781e4c 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java @@ -124,8 +124,9 @@ public class HealthMvcEndpoint implements MvcEndpoint, EnvironmentAware { public Object invoke(Principal principal) { if (!this.delegate.isEnabled()) { // Shouldn't happen because the request mapping should not be registered - return new ResponseEntity>(Collections.singletonMap( - "message", "This endpoint is disabled"), HttpStatus.NOT_FOUND); + return new ResponseEntity>( + Collections.singletonMap("message", "This endpoint is disabled"), + HttpStatus.NOT_FOUND); } Health health = getHealth(principal); HttpStatus status = this.statusMapping.get(health.getStatus().getCode()); @@ -159,8 +160,8 @@ public class HealthMvcEndpoint implements MvcEndpoint, EnvironmentAware { } private boolean isSecure(Principal principal) { - return (principal != null && !principal.getClass().getName() - .contains("Anonymous")); + return (principal != null + && !principal.getClass().getName().contains("Anonymous")); } private boolean isUnrestricted() { 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 abbd74df11..82719ed7ea 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 @@ -52,13 +52,14 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean { @Override public void afterPropertiesSet() throws Exception { - Collection existing = this.applicationContext.getBeansOfType( - MvcEndpoint.class).values(); + Collection existing = this.applicationContext + .getBeansOfType(MvcEndpoint.class).values(); 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()) { this.endpoints.add(new EndpointMvcAdapter(endpoint)); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java index 4e4eefcddc..c38098f559 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java @@ -42,8 +42,9 @@ public class ShutdownMvcEndpoint extends EndpointMvcAdapter { @Override public Object invoke() { if (!getDelegate().isEnabled()) { - return new ResponseEntity>(Collections.singletonMap( - "message", "This endpoint is disabled"), HttpStatus.NOT_FOUND); + return new ResponseEntity>( + Collections.singletonMap("message", "This endpoint is disabled"), + HttpStatus.NOT_FOUND); } return super.invoke(); } 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 1cfc68f15c..392f7d4684 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 @@ -48,14 +48,15 @@ import org.springframework.util.StringUtils; * @author Stephane Nicoll * @since 1.1.0 */ -public class DataSourceHealthIndicator extends AbstractHealthIndicator implements - InitializingBean { +public class DataSourceHealthIndicator extends AbstractHealthIndicator + implements InitializingBean { private static final Map PRODUCT_SPECIFIC_QUERIES; + static { Map queries = new HashMap(); - queries.put("HSQL Database Engine", "SELECT COUNT(*) FROM " - + "INFORMATION_SCHEMA.SYSTEM_USERS"); + queries.put("HSQL Database Engine", + "SELECT COUNT(*) FROM " + "INFORMATION_SCHEMA.SYSTEM_USERS"); queries.put("Oracle", "SELECT 'Hello' from DUAL"); queries.put("Apache Derby", "SELECT 1 FROM SYSIBM.SYSDUMMY1"); PRODUCT_SPECIFIC_QUERIES = Collections.unmodifiableMap(queries); @@ -133,8 +134,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/DiskSpaceHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java index 293c44b617..bef576bae5 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java @@ -50,9 +50,10 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator { builder.up(); } else { - logger.warn(String.format("Free disk space below threshold. " - + "Available: %d bytes (threshold: %d bytes)", diskFreeInBytes, - this.properties.getThreshold())); + logger.warn(String.format( + "Free disk space below threshold. " + + "Available: %d bytes (threshold: %d bytes)", + diskFreeInBytes, this.properties.getThreshold())); builder.down(); } builder.withDetail("free", diskFreeInBytes).withDetail("threshold", diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java index c16b62706d..f8d71c61fb 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java @@ -91,8 +91,8 @@ public class Metric { * @return a new {@link Metric} instance */ public Metric increment(int amount) { - return new Metric(this.getName(), new Long(this.getValue().longValue() - + amount)); + return new Metric(this.getName(), + new Long(this.getValue().longValue() + amount)); } /** 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 e030657b29..ba759ffe0c 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 @@ -43,8 +43,8 @@ public abstract class AbstractMetricExporter implements Exporter { private final String prefix; public AbstractMetricExporter(String prefix) { - this.prefix = !StringUtils.hasText(prefix) ? "" : (prefix.endsWith(".") ? prefix - : prefix + "."); + this.prefix = !StringUtils.hasText(prefix) ? "" + : (prefix.endsWith(".") ? prefix : prefix + "."); } /** @@ -76,7 +76,8 @@ public abstract class AbstractMetricExporter implements Exporter { Metric value = new Metric(this.prefix + metric.getName(), metric.getValue(), metric.getTimestamp()); Date timestamp = metric.getTimestamp(); - if (!this.ignoreTimestamps && this.earliestTimestamp.after(timestamp)) { + if (!this.ignoreTimestamps + && this.earliestTimestamp.after(timestamp)) { continue; } values.add(value); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java index dac8f16b11..a8200db731 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java @@ -45,7 +45,8 @@ public class PrefixMetricGroupExporter extends AbstractMetricExporter { * @param reader a reader as the source of metrics * @param writer the writer to send the metrics to */ - public PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer) { + public PrefixMetricGroupExporter(PrefixMetricReader reader, + PrefixMetricWriter writer) { this(reader, writer, ""); } @@ -56,8 +57,8 @@ public class PrefixMetricGroupExporter extends AbstractMetricExporter { * @param writer the writer to send the metrics to * @param prefix the prefix for metrics to export */ - public PrefixMetricGroupExporter(PrefixMetricReader reader, - PrefixMetricWriter writer, String prefix) { + public PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer, + String prefix) { super(prefix); this.reader = reader; this.writer = writer; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java index 1ce9373e15..140cad0122 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java @@ -240,8 +240,8 @@ public class MetricRegistryMetricReader implements MetricReader, MetricRegistryL result = new HashSet(); } if (result.isEmpty()) { - for (PropertyDescriptor descriptor : BeanUtils.getPropertyDescriptors(metric - .getClass())) { + for (PropertyDescriptor descriptor : BeanUtils + .getPropertyDescriptors(metric.getClass())) { if (ClassUtils.isAssignable(Number.class, descriptor.getPropertyType())) { result.add(descriptor.getName()); } 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 f296bf8f55..cda14f1fc7 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 @@ -34,8 +34,8 @@ import org.springframework.boot.actuate.metrics.writer.Delta; * * @author Dave Syer */ -public class InMemoryMetricRepository implements MetricRepository, MultiMetricRepository, - PrefixMetricReader { +public class InMemoryMetricRepository + implements MetricRepository, MultiMetricRepository, PrefixMetricReader { private final SimpleInMemoryRepository> metrics = new SimpleInMemoryRepository>(); @@ -55,8 +55,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/repository/redis/RedisMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java index fb9dca99df..cf928034ae 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java @@ -146,8 +146,8 @@ public class RedisMetricRepository implements MetricRepository { String name = delta.getName(); String key = keyFor(name); trackMembership(key); - double value = this.zSetOperations.incrementScore(key, delta.getValue() - .doubleValue()); + double value = this.zSetOperations.incrementScore(key, + delta.getValue().doubleValue()); String raw = serialize(new Metric(name, value, delta.getTimestamp())); this.redisOperations.opsForValue().set(key, raw); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java index 9c142538f3..21674a1954 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java @@ -108,8 +108,8 @@ public class RedisMultiMetricRepository implements MultiMetricRepository { .boundZSetOps(groupKey); String key = keyFor(delta.getName()); double value = zSetOperations.incrementScore(key, delta.getValue().doubleValue()); - String raw = serialize(new Metric(delta.getName(), value, - delta.getTimestamp())); + String raw = serialize( + new Metric(delta.getName(), value, delta.getTimestamp())); this.redisOperations.opsForValue().set(key, raw); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java index 2a44c9f45e..3788a9cbf7 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGauge.java @@ -23,8 +23,8 @@ import org.springframework.util.Assert; *

* The value of the average will depend on whether a weight ('alpha') is set for the * gauge. If it is unset, the average will contain a simple arithmetic mean. If a weight - * is set, an exponential moving average will be calculated as defined in this NIST + * is set, an exponential moving average will be calculated as defined in this + * NIST * document. * * @author Luke Taylor diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java index e256884f4e..bbddd9fbdd 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java @@ -94,8 +94,8 @@ public class SimpleInMemoryRepository { if (!prefix.endsWith(".")) { prefix = prefix + "."; } - return new ArrayList(this.values.subMap(prefix, false, prefix + "~", true) - .values()); + return new ArrayList( + this.values.subMap(prefix, false, prefix + "~", true).values()); } public void setValues(ConcurrentNavigableMap values) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java index 2b8622f0ec..b441727ae6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java @@ -47,7 +47,8 @@ public class AuthorizationAuditListener implements @Override public void onApplicationEvent(AbstractAuthorizationEvent event) { if (event instanceof AuthenticationCredentialsNotFoundEvent) { - onAuthenticationCredentialsNotFoundEvent((AuthenticationCredentialsNotFoundEvent) event); + onAuthenticationCredentialsNotFoundEvent( + (AuthenticationCredentialsNotFoundEvent) event); } else if (event instanceof AuthorizationFailureEvent) { onAuthorizationFailureEvent((AuthorizationFailureEvent) event); 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 6ae378fe6e..9f57613b1d 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 @@ -43,8 +43,8 @@ import org.springframework.util.Assert; * @author Phillip Webb * @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); @@ -108,7 +108,8 @@ public class ApplicationPidFileWriter implements writePidFile(event); } catch (Exception ex) { - logger.warn(String.format("Cannot create pid file %s", this.file), ex); + logger.warn(String.format("Cannot create pid file %s", this.file), + ex); } } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriter.java index 3fbbe8db60..307eb87d9a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriter.java @@ -39,8 +39,8 @@ import org.springframework.util.StringUtils; * * @since 1.2.0 */ -public class EmbeddedServerPortFileWriter implements - ApplicationListener { +public class EmbeddedServerPortFileWriter + implements ApplicationListener { private static final String DEFAULT_FILE_NAME = "application.port"; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/SystemProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/SystemProperties.java index 63d1fb24ef..87b22278d4 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/SystemProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/SystemProperties.java @@ -31,8 +31,8 @@ class SystemProperties { } } catch (Throwable ex) { - System.err.println("Could not resolve '" + property - + "' as system property: " + ex); + System.err.println( + "Could not resolve '" + property + "' as system property: " + ex); } } return null; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java index 410364a27e..df85cd81a3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java @@ -85,7 +85,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) - throws ServletException, IOException { + throws ServletException, IOException { Map trace = getTrace(request); if (this.logger.isTraceEnabled()) { @@ -147,8 +147,8 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order .getAttribute("javax.servlet.error.exception"); if (exception != null && this.errorAttributes != null) { RequestAttributes requestAttributes = new ServletRequestAttributes(request); - Map error = this.errorAttributes.getErrorAttributes( - requestAttributes, true); + Map error = this.errorAttributes + .getErrorAttributes(requestAttributes, true); trace.put("error", error); } return trace; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java index 9fe24d833d..844cbc4428 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java @@ -32,8 +32,8 @@ public class AuditEventTests { @Test public void testNowEvent() throws Exception { - AuditEvent event = new AuditEvent("phil", "UNKNOWN", Collections.singletonMap( - "a", (Object) "b")); + AuditEvent event = new AuditEvent("phil", "UNKNOWN", + Collections.singletonMap("a", (Object) "b")); assertEquals("b", event.getData().get("a")); assertEquals("UNKNOWN", event.getType()); assertEquals("phil", event.getPrincipal()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java index 8f6581fd3d..6aee020a46 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java @@ -193,8 +193,8 @@ public class CrshAutoConfigurationTests { PluginContext pluginContext = lifeCycle.getContext(); int count = 0; - Iterator plugins = pluginContext.getPlugins( - AuthenticationPlugin.class).iterator(); + Iterator plugins = pluginContext + .getPlugins(AuthenticationPlugin.class).iterator(); while (plugins.hasNext()) { count++; plugins.next(); @@ -229,8 +229,8 @@ public class CrshAutoConfigurationTests { PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); assertEquals("jaas", lifeCycle.getConfig().get("crash.auth")); - assertEquals("my-test-domain", lifeCycle.getConfig() - .get("crash.auth.jaas.domain")); + assertEquals("my-test-domain", + lifeCycle.getConfig().get("crash.auth.jaas.domain")); } @Test @@ -269,8 +269,8 @@ public class CrshAutoConfigurationTests { AuthenticationPlugin authenticationPlugin = null; String authentication = lifeCycle.getConfig().getProperty("crash.auth"); assertNotNull(authentication); - for (AuthenticationPlugin plugin : lifeCycle.getContext().getPlugins( - AuthenticationPlugin.class)) { + for (AuthenticationPlugin plugin : lifeCycle.getContext() + .getPlugins(AuthenticationPlugin.class)) { if (authentication.equals(plugin.getName())) { authenticationPlugin = plugin; break; @@ -298,8 +298,8 @@ public class CrshAutoConfigurationTests { AuthenticationPlugin authenticationPlugin = null; String authentication = lifeCycle.getConfig().getProperty("crash.auth"); assertNotNull(authentication); - for (AuthenticationPlugin plugin : lifeCycle.getContext().getPlugins( - AuthenticationPlugin.class)) { + for (AuthenticationPlugin plugin : lifeCycle.getContext() + .getPlugins(AuthenticationPlugin.class)) { if (authentication.equals(plugin.getName())) { authenticationPlugin = plugin; break; @@ -313,7 +313,8 @@ public class CrshAutoConfigurationTests { } @Test - public void testSpringAuthenticationProviderAsDefaultConfiguration() throws Exception { + public void testSpringAuthenticationProviderAsDefaultConfiguration() + throws Exception { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(ManagementServerPropertiesAutoConfiguration.class); @@ -327,8 +328,8 @@ public class CrshAutoConfigurationTests { AuthenticationPlugin authenticationPlugin = null; String authentication = lifeCycle.getConfig().getProperty("crash.auth"); assertNotNull(authentication); - for (AuthenticationPlugin plugin : lifeCycle.getContext().getPlugins( - AuthenticationPlugin.class)) { + for (AuthenticationPlugin plugin : lifeCycle.getContext() + .getPlugins(AuthenticationPlugin.class)) { if (authentication.equals(plugin.getName())) { authenticationPlugin = plugin; break; @@ -359,12 +360,12 @@ public class CrshAutoConfigurationTests { && authentication.getCredentials().equals(PASSWORD)) { authentication = new UsernamePasswordAuthenticationToken( authentication.getPrincipal(), - authentication.getCredentials(), - Collections + authentication.getCredentials(), Collections .singleton(new SimpleGrantedAuthority("ADMIN"))); } else { - throw new BadCredentialsException("Invalid username and password"); + throw new BadCredentialsException( + "Invalid username and password"); } return authentication; } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfigurationTests.java index 3e2ef0a5b7..e891bdf0ed 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfigurationTests.java @@ -98,8 +98,7 @@ public class EndpointMBeanExportAutoConfigurationTests { throws Exception { this.context = new AnnotationConfigApplicationContext(); this.context.register(TestConfiguration.class, JmxAutoConfiguration.class, - NestedInManagedEndpoint.class, - EndpointMBeanExportAutoConfiguration.class, + NestedInManagedEndpoint.class, EndpointMBeanExportAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertNotNull(this.context.getBean(EndpointMBeanExporter.class)); @@ -116,8 +115,7 @@ public class EndpointMBeanExportAutoConfigurationTests { environment.setProperty("endpoints.jmx.enabled", "false"); this.context = new AnnotationConfigApplicationContext(); this.context.setEnvironment(environment); - this.context.register(JmxAutoConfiguration.class, - EndpointAutoConfiguration.class, + this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class, EndpointMBeanExportAutoConfiguration.class); this.context.refresh(); this.context.getBean(EndpointMBeanExporter.class); @@ -133,26 +131,24 @@ public class EndpointMBeanExportAutoConfigurationTests { environment.setProperty("endpoints.jmx.static_names", "key1=value1, key2=value2"); this.context = new AnnotationConfigApplicationContext(); this.context.setEnvironment(environment); - this.context.register(JmxAutoConfiguration.class, - EndpointAutoConfiguration.class, + this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class, EndpointMBeanExportAutoConfiguration.class); this.context.refresh(); this.context.getBean(EndpointMBeanExporter.class); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); - assertNotNull(mbeanExporter.getServer().getMBeanInfo( - ObjectNameManager.getInstance(getObjectName("test-domain", - "healthEndpoint", this.context).toString() - + ",key1=value1,key2=value2"))); + assertNotNull(mbeanExporter.getServer() + .getMBeanInfo(ObjectNameManager.getInstance( + getObjectName("test-domain", "healthEndpoint", this.context) + .toString() + ",key1=value1,key2=value2"))); } @Test public void testEndpointMBeanExporterInParentChild() throws IntrospectionException, InstanceNotFoundException, MalformedObjectNameException, ReflectionException { this.context = new AnnotationConfigApplicationContext(); - this.context.register(JmxAutoConfiguration.class, - EndpointAutoConfiguration.class, + this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class, EndpointMBeanExportAutoConfiguration.class); AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext(); @@ -177,10 +173,8 @@ public class EndpointMBeanExportAutoConfigurationTests { } if (applicationContext.getEnvironment().getProperty("endpoints.jmx.unique_names", Boolean.class, false)) { - name = name - + ",identity=" - + ObjectUtils.getIdentityHexString(applicationContext - .getBean(beanKey)); + name = name + ",identity=" + ObjectUtils + .getIdentityHexString(applicationContext.getBean(beanKey)); } if (applicationContext.getParent() != null) { return ObjectNameManager.getInstance(String.format(name, domain, beanKey, 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 ec42c628ae..8633784b80 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 @@ -82,8 +82,8 @@ public class EndpointMvcIntegrationTests { @Test public void envEndpointNotHidden() 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 { @Import({ EmbeddedServletContainerAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - ErrorMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) protected static @interface MinimalWebConfiguration { } 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 c6ad430f12..ae574b6cd9 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 @@ -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); } @@ -421,8 +423,7 @@ public class EndpointWebMvcAutoConfigurationTests { @Configuration @Import({ PropertyPlaceholderAutoConfiguration.class, EmbeddedServletContainerAutoConfiguration.class, - EndpointAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, + EndpointAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, ManagementServerPropertiesAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, WebMvcAutoConfiguration.class }) @@ -582,8 +583,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 56ac8fbb53..58db300e59 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 @@ -84,8 +84,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 @@ -99,8 +99,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(RedisHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(RedisHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -115,8 +115,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 @@ -131,8 +131,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(MongoHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(MongoHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -148,8 +148,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 @@ -175,8 +175,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(DataSourceHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(DataSourceHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -212,8 +212,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 @@ -227,8 +227,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(RabbitHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(RabbitHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -243,8 +243,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 @@ -258,8 +258,8 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(SolrHealthIndicator.class, beans.values().iterator().next() - .getClass()); + assertEquals(SolrHealthIndicator.class, + beans.values().iterator().next().getClass()); } @Test @@ -274,8 +274,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 @@ -286,8 +286,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()); } @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 787ad9d3ed..e384f10adf 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 @@ -56,8 +56,8 @@ public class HealthMvcEndpointAutoConfigurationTests { EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class, TestHealthIndicator.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,11 +73,11 @@ 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( - "healthMvcEndpointAutoConfigurationTests.Test"); + Health map = (Health) health.getDetails() + .get("healthMvcEndpointAutoConfigurationTests.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 dae25a2d46..b2e0df945f 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 @@ -64,7 +64,8 @@ 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); } @Test @@ -79,7 +80,8 @@ public class JolokiaAutoConfigurationTests { @Test public void endpointEnabledAsOverride() throws Exception { - assertEndpointEnabled("endpoints.enabled:false", "endpoints.jolokia.enabled:true"); + assertEndpointEnabled("endpoints.enabled:false", + "endpoints.jolokia.enabled:true"); } private void assertEndpointDisabled(String... pairs) { @@ -91,7 +93,8 @@ public class JolokiaAutoConfigurationTests { HttpMessageConvertersAutoConfiguration.class, JolokiaAutoConfiguration.class); this.context.refresh(); - assertEquals(0, this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); + assertEquals(0, + this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length); } private void assertEndpointEnabled(String... pairs) { @@ -103,7 +106,8 @@ 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); } @Configuration diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfigurationTests.java index 4097b46669..c9cf85872e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfigurationTests.java @@ -94,7 +94,8 @@ public class ManagementSecurityAutoConfigurationTests { 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 @@ -116,9 +117,8 @@ public class ManagementSecurityAutoConfigurationTests { PropertyPlaceholderAutoConfiguration.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() { @@ -126,8 +126,8 @@ public class ManagementSecurityAutoConfigurationTests { .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; } @@ -144,8 +144,8 @@ public class ManagementSecurityAutoConfigurationTests { 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 @@ -163,8 +163,8 @@ public class ManagementSecurityAutoConfigurationTests { 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 @@ -200,8 +200,7 @@ public class ManagementSecurityAutoConfigurationTests { public void realmSameForManagement() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); - this.context.register(AuthenticationConfig.class, - SecurityAutoConfiguration.class, + this.context.register(AuthenticationConfig.class, SecurityAutoConfiguration.class, ManagementSecurityAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class, diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java index ce02fc469d..3e149e0c6c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java @@ -110,10 +110,10 @@ public class MetricFilterAutoConfigurationTests { MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController()) .addFilter(filter).build(); mvc.perform(get("/templateVarTest/foo")).andExpect(status().isOk()); - verify(context.getBean(CounterService.class)).increment( - "status.200.templateVarTest.someVariable"); - verify(context.getBean(GaugeService.class)).submit( - eq("response.templateVarTest.someVariable"), anyDouble()); + verify(context.getBean(CounterService.class)) + .increment("status.200.templateVarTest.someVariable"); + verify(context.getBean(GaugeService.class)) + .submit(eq("response.templateVarTest.someVariable"), anyDouble()); context.close(); } @@ -126,10 +126,10 @@ public class MetricFilterAutoConfigurationTests { MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController()) .addFilter(filter).build(); mvc.perform(get("/knownPath/foo")).andExpect(status().isNotFound()); - verify(context.getBean(CounterService.class)).increment( - "status.404.knownPath.someVariable"); - verify(context.getBean(GaugeService.class)).submit( - eq("response.knownPath.someVariable"), anyDouble()); + verify(context.getBean(CounterService.class)) + .increment("status.404.knownPath.someVariable"); + verify(context.getBean(GaugeService.class)) + .submit(eq("response.knownPath.someVariable"), anyDouble()); context.close(); } @@ -142,10 +142,10 @@ public class MetricFilterAutoConfigurationTests { .addFilter(filter).build(); mvc.perform(get("/unknownPath/1")).andExpect(status().isNotFound()); mvc.perform(get("/unknownPath/2")).andExpect(status().isNotFound()); - verify(context.getBean(CounterService.class), times(2)).increment( - "status.404.unmapped"); - verify(context.getBean(GaugeService.class), times(2)).submit( - eq("response.unmapped"), anyDouble()); + verify(context.getBean(CounterService.class), times(2)) + .increment("status.404.unmapped"); + verify(context.getBean(GaugeService.class), times(2)) + .submit(eq("response.unmapped"), anyDouble()); context.close(); } @@ -159,10 +159,10 @@ public class MetricFilterAutoConfigurationTests { .build(); mvc.perform(get("/unknownPath/1")).andExpect(status().is3xxRedirection()); mvc.perform(get("/unknownPath/2")).andExpect(status().is3xxRedirection()); - verify(context.getBean(CounterService.class), times(2)).increment( - "status.302.unmapped"); - verify(context.getBean(GaugeService.class), times(2)).submit( - eq("response.unmapped"), anyDouble()); + verify(context.getBean(CounterService.class), times(2)) + .increment("status.302.unmapped"); + verify(context.getBean(GaugeService.class), times(2)) + .submit(eq("response.unmapped"), anyDouble()); context.close(); } @@ -182,16 +182,16 @@ public class MetricFilterAutoConfigurationTests { MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController()) .addFilter(filter).build(); try { - mvc.perform(get("/unhandledException")).andExpect( - status().isInternalServerError()); + mvc.perform(get("/unhandledException")) + .andExpect(status().isInternalServerError()); } catch (NestedServletException ex) { // Expected } - verify(context.getBean(CounterService.class)).increment( - "status.500.unhandledException"); - verify(context.getBean(GaugeService.class)).submit( - eq("response.unhandledException"), anyDouble()); + verify(context.getBean(CounterService.class)) + .increment("status.500.unhandledException"); + verify(context.getBean(GaugeService.class)) + .submit(eq("response.unhandledException"), anyDouble()); context.close(); } @@ -206,10 +206,10 @@ public class MetricFilterAutoConfigurationTests { MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController()) .addFilter(filter).build(); mvc.perform(get("/templateVarTest/foo")).andExpect(status().isOk()); - verify(context.getBean(CounterService.class)).increment( - "status.200.templateVarTest.someVariable"); - verify(context.getBean(GaugeService.class)).submit( - eq("response.templateVarTest.someVariable"), anyDouble()); + verify(context.getBean(CounterService.class)) + .increment("status.200.templateVarTest.someVariable"); + verify(context.getBean(GaugeService.class)) + .submit(eq("response.templateVarTest.someVariable"), anyDouble()); context.close(); } @@ -237,7 +237,8 @@ public class MetricFilterAutoConfigurationTests { } @Test - public void correctlyRecordsMetricsForFailedDeferredResultResponse() throws Exception { + public void correctlyRecordsMetricsForFailedDeferredResultResponse() + throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( Config.class, MetricFilterAutoConfiguration.class); MetricsFilter filter = context.getBean(MetricsFilter.class); @@ -259,8 +260,8 @@ public class MetricFilterAutoConfigurationTests { } catch (Exception ex) { assertThat(result.getRequest().getAttribute(attributeName), is(nullValue())); - verify(context.getBean(CounterService.class)).increment( - "status.500.createFailure"); + verify(context.getBean(CounterService.class)) + .increment("status.500.createFailure"); } finally { context.close(); @@ -321,8 +322,8 @@ public class MetricFilterAutoConfigurationTests { public void run() { try { MetricFilterTestController.this.latch.await(); - result.setResult(new ResponseEntity("Done", - HttpStatus.CREATED)); + result.setResult( + new ResponseEntity("Done", HttpStatus.CREATED)); } catch (InterruptedException ex) { } @@ -357,8 +358,8 @@ public class MetricFilterAutoConfigurationTests { @Override protected void doFilterInternal(HttpServletRequest request, - HttpServletResponse response, FilterChain chain) throws ServletException, - IOException { + HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { // send redirect before filter chain is executed, like Spring Security sending // us back to a login page response.sendRedirect("http://example.com"); 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 78fbf1f4b8..c10c115559 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 @@ -73,8 +73,8 @@ public class MetricRepositoryAutoConfigurationTests { assertNotNull(gaugeService); assertNotNull(context.getBean(DefaultCounterService.class)); gaugeService.submit("foo", 2.7); - assertEquals(2.7, context.getBean(MetricReader.class).findOne("gauge.foo") - .getValue()); + assertEquals(2.7, + context.getBean(MetricReader.class).findOne("gauge.foo").getValue()); context.close(); } @@ -111,7 +111,8 @@ public class MetricRepositoryAutoConfigurationTests { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( Config.class, MetricRepositoryAutoConfiguration.class); assertThat(context.getBeansOfType(DefaultGaugeService.class).size(), equalTo(0)); - assertThat(context.getBeansOfType(DefaultCounterService.class).size(), equalTo(0)); + assertThat(context.getBeansOfType(DefaultCounterService.class).size(), + equalTo(0)); context.close(); } 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 24cc15bf01..a1a449a649 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 @@ -86,8 +86,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 @@ -98,8 +98,8 @@ public class PublicMetricsAutoConfigurationTests { 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); @@ -122,7 +122,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 @@ -142,12 +143,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/ShellPropertiesTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java index 18e14fbb23..8444a2820e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java @@ -56,8 +56,8 @@ public class ShellPropertiesTests { public void testBindingAuth() { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); - binder.bind(new MutablePropertyValues(Collections.singletonMap("shell.auth", - "spring"))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("shell.auth", "spring"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals("spring", props.getAuth()); } @@ -66,7 +66,8 @@ public class ShellPropertiesTests { public void testBindingAuthIfEmpty() { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); - binder.bind(new MutablePropertyValues(Collections.singletonMap("shell.auth", ""))); + binder.bind( + new MutablePropertyValues(Collections.singletonMap("shell.auth", ""))); assertTrue(binder.getBindingResult().hasErrors()); assertEquals("simple", props.getAuth()); } @@ -76,8 +77,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.command_refresh_interval", "1"))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("shell.command_refresh_interval", "1"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(1, props.getCommandRefreshInterval()); } @@ -87,8 +88,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.command_path_patterns", "pattern1, pattern2"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.command_path_patterns", "pattern1, pattern2"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(2, props.getCommandPathPatterns().length); Assert.assertArrayEquals(new String[] { "pattern1", "pattern2" }, @@ -100,8 +101,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.config_path_patterns", "pattern1, pattern2"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.config_path_patterns", "pattern1, pattern2"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(2, props.getConfigPathPatterns().length); Assert.assertArrayEquals(new String[] { "pattern1", "pattern2" }, @@ -113,8 +114,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.disabled_plugins", "pattern1, pattern2"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.disabled_plugins", "pattern1, pattern2"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(2, props.getDisabledPlugins().length); assertArrayEquals(new String[] { "pattern1", "pattern2" }, @@ -126,8 +127,8 @@ public class ShellPropertiesTests { ShellProperties props = new ShellProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell"); binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.disabled_commands", "pattern1, pattern2"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.disabled_commands", "pattern1, pattern2"))); assertFalse(binder.getBindingResult().hasErrors()); assertEquals(2, props.getDisabledCommands().length); assertArrayEquals(new String[] { "pattern1", "pattern2" }, @@ -271,8 +272,8 @@ public class ShellPropertiesTests { public void testDefaultPasswordAutogeneratedIfUnresolovedPlaceholder() { SimpleAuthenticationProperties security = new SimpleAuthenticationProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(security, "security"); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.auth.simple.user.password", "${ADMIN_PASSWORD}"))); + binder.bind(new MutablePropertyValues(Collections + .singletonMap("shell.auth.simple.user.password", "${ADMIN_PASSWORD}"))); assertFalse(binder.getBindingResult().hasErrors()); assertTrue(security.getUser().isDefaultPassword()); } @@ -281,8 +282,8 @@ public class ShellPropertiesTests { public void testDefaultPasswordAutogeneratedIfEmpty() { SimpleAuthenticationProperties security = new SimpleAuthenticationProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(security, "security"); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.auth.simple.user.password", ""))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("shell.auth.simple.user.password", ""))); assertFalse(binder.getBindingResult().hasErrors()); assertTrue(security.getUser().isDefaultPassword()); } @@ -291,8 +292,8 @@ public class ShellPropertiesTests { public void testBindingSpring() { SpringAuthenticationProperties props = new SpringAuthenticationProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.spring"); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "shell.auth.spring.roles", "role1, role2"))); + binder.bind(new MutablePropertyValues( + Collections.singletonMap("shell.auth.spring.roles", "role1, role2"))); assertFalse(binder.getBindingResult().hasErrors()); Properties p = new Properties(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/SpringApplicationHierarchyTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/SpringApplicationHierarchyTests.java index b648d52694..83d031fe37 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/SpringApplicationHierarchyTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/SpringApplicationHierarchyTests.java @@ -46,8 +46,8 @@ public class SpringApplicationHierarchyTests { @Test public void testChild() { - this.context = new SpringApplicationBuilder(Parent.class).child(Child.class).run( - "--server.port=0"); + this.context = new SpringApplicationBuilder(Parent.class).child(Child.class) + .run("--server.port=0"); } @EnableAutoConfiguration diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java index ffb2fd4105..211ba1905a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java @@ -113,9 +113,8 @@ public abstract class AbstractEndpointTests> { @Test public void isEnabledFallbackToEnvironment() throws Exception { this.context = new AnnotationConfigApplicationContext(); - PropertySource propertySource = new MapPropertySource("test", - Collections.singletonMap(this.property + ".enabled", - false)); + PropertySource propertySource = new MapPropertySource("test", Collections + .singletonMap(this.property + ".enabled", false)); this.context.getEnvironment().getPropertySources().addFirst(propertySource); this.context.register(this.configClass); this.context.refresh(); @@ -126,9 +125,8 @@ public abstract class AbstractEndpointTests> { @SuppressWarnings("rawtypes") public void isExplicitlyEnabled() throws Exception { this.context = new AnnotationConfigApplicationContext(); - PropertySource propertySource = new MapPropertySource("test", - Collections.singletonMap(this.property + ".enabled", - false)); + PropertySource propertySource = new MapPropertySource("test", Collections + .singletonMap(this.property + ".enabled", false)); this.context.getEnvironment().getPropertySources().addFirst(propertySource); this.context.register(this.configClass); this.context.refresh(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java index 4b5477fa40..1e488e38a6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java @@ -38,8 +38,8 @@ import static org.mockito.Mockito.mock; * @author Greg Turnquist * @author Phillip Webb */ -public class AutoConfigurationReportEndpointTests extends - AbstractEndpointTests { +public class AutoConfigurationReportEndpointTests + extends AbstractEndpointTests { public AutoConfigurationReportEndpointTests() { super(Config.class, AutoConfigurationReportEndpoint.class, "autoconfig", true, @@ -62,8 +62,8 @@ public class AutoConfigurationReportEndpointTests extends @PostConstruct public void setupAutoConfigurationReport() { - ConditionEvaluationReport report = ConditionEvaluationReport.get(this.context - .getBeanFactory()); + ConditionEvaluationReport report = ConditionEvaluationReport + .get(this.context.getBeanFactory()); report.recordConditionEvaluation("a", mock(Condition.class), mock(ConditionOutcome.class)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointProxyTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointProxyTests.java index 1c2b9c14e6..883f88a31c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointProxyTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointProxyTests.java @@ -66,8 +66,8 @@ public class ConfigurationPropertiesReportEndpointProxyTests { public void testWithProxyClass() throws Exception { this.context.register(Config.class, SqlExecutor.class); this.context.refresh(); - Map report = this.context.getBean( - ConfigurationPropertiesReportEndpoint.class).invoke(); + Map report = this.context + .getBean(ConfigurationPropertiesReportEndpoint.class).invoke(); assertThat(report.toString(), containsString("prefix=executor.sql")); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java index 11cf9eaae2..63ccf146cd 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java @@ -37,8 +37,8 @@ import static org.junit.Assert.assertThat; * * @author Dave Syer */ -public class ConfigurationPropertiesReportEndpointTests extends - AbstractEndpointTests { +public class ConfigurationPropertiesReportEndpointTests + extends AbstractEndpointTests { public ConfigurationPropertiesReportEndpointTests() { super(Config.class, ConfigurationPropertiesReportEndpoint.class, "configprops", 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 cf5d31c00e..0a8151124a 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 @@ -54,10 +54,10 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests env = report.invoke(); assertEquals("bar", ((Map) env.get("composite:one")).get("foo")); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java index 5eb60461a3..f9235fd556 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java @@ -62,8 +62,8 @@ public class MetricsEndpointTests extends AbstractEndpointTests @Test public void ordered() { List publicMetrics = new ArrayList(); - publicMetrics.add(new TestPublicMetrics(2, this.metric2, this.metric2, - this.metric3)); + publicMetrics + .add(new TestPublicMetrics(2, this.metric2, this.metric2, this.metric3)); publicMetrics.add(new TestPublicMetrics(1, this.metric1)); Map metrics = new MetricsEndpoint(publicMetrics).invoke(); Iterator> iterator = metrics.entrySet().iterator(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java index 0cf90b0066..9509df3633 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java @@ -52,8 +52,8 @@ public class RequestMappingEndpointTests { mapping.setUrlMap(Collections.singletonMap("/foo", new Object())); mapping.setApplicationContext(new StaticApplicationContext()); mapping.initApplicationContext(); - this.endpoint.setHandlerMappings(Collections - .singletonList(mapping)); + this.endpoint.setHandlerMappings( + Collections.singletonList(mapping)); Map result = this.endpoint.invoke(); assertEquals(1, result.size()); @SuppressWarnings("unchecked") @@ -113,8 +113,8 @@ public class RequestMappingEndpointTests { Arrays.asList(new EndpointMvcAdapter(new DumpEndpoint()))); mapping.setApplicationContext(new StaticApplicationContext()); mapping.afterPropertiesSet(); - this.endpoint.setMethodMappings(Collections - .>singletonList(mapping)); + this.endpoint.setMethodMappings( + Collections.>singletonList(mapping)); Map result = this.endpoint.invoke(); assertEquals(1, result.size()); assertTrue(result.keySet().iterator().next().contains("/dump")); 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 4f11375cf8..e9f1ea6af3 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 @@ -62,14 +62,14 @@ 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); @@ -82,12 +82,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 @@ -97,12 +97,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 @@ -110,30 +110,29 @@ 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); @@ -151,8 +150,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); @@ -175,16 +174,16 @@ 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,8 +191,8 @@ 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); @@ -202,8 +201,8 @@ public class EndpointMBeanExporterTests { 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(); } @@ -215,17 +214,15 @@ 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)))); } else { - return ObjectNameManager.getInstance(String.format( - "%s:type=Endpoint,name=%s", domain, beanKey)); + return ObjectNameManager.getInstance( + String.format("%s:type=Endpoint,name=%s", domain, beanKey)); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java index 761e1947f8..ba712a974a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java @@ -56,15 +56,15 @@ public class EndpointHandlerMappingTests { public void withoutPrefix() throws Exception { TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("/a")); TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("/b")); - EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( - endpointA, endpointB)); + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + Arrays.asList(endpointA, endpointB)); mapping.setApplicationContext(this.context); mapping.afterPropertiesSet(); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")) - .getHandler(), + assertThat( + mapping.getHandler(new MockHttpServletRequest("GET", "/a")).getHandler(), equalTo((Object) new HandlerMethod(endpointA, this.method))); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/b")) - .getHandler(), + assertThat( + mapping.getHandler(new MockHttpServletRequest("GET", "/b")).getHandler(), equalTo((Object) new HandlerMethod(endpointB, this.method))); assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/c")), nullValue()); @@ -74,16 +74,18 @@ public class EndpointHandlerMappingTests { public void withPrefix() throws Exception { TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("/a")); TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("/b")); - EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( - endpointA, endpointB)); + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + Arrays.asList(endpointA, endpointB)); mapping.setApplicationContext(this.context); mapping.setPrefix("/a"); mapping.afterPropertiesSet(); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a/a")) - .getHandler(), + assertThat( + mapping.getHandler(new MockHttpServletRequest("GET", "/a/a")) + .getHandler(), equalTo((Object) new HandlerMethod(endpointA, this.method))); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a/b")) - .getHandler(), + assertThat( + mapping.getHandler(new MockHttpServletRequest("GET", "/a/b")) + .getHandler(), equalTo((Object) new HandlerMethod(endpointB, this.method))); assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")), nullValue()); @@ -137,8 +139,8 @@ public class EndpointHandlerMappingTests { public void duplicatePath() throws Exception { TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("/a")); TestActionEndpoint other = new TestActionEndpoint(new TestEndpoint("/a")); - EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( - endpoint, other)); + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + Arrays.asList(endpoint, other)); mapping.setDisabled(true); mapping.setApplicationContext(this.context); mapping.afterPropertiesSet(); 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 fa1f71dd16..6e19c9b5a7 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 @@ -63,8 +63,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"); + EnvironmentTestUtils.addEnvironment((ConfigurableApplicationContext) this.context, + "foo:bar"); } @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 68c949200c..7b5d3b2f43 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 @@ -93,10 +93,10 @@ public class HealthMvcEndpointTests { @SuppressWarnings("unchecked") @Test 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; @@ -106,8 +106,8 @@ public class HealthMvcEndpointTests { @Test public void secure() { - 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.user); assertTrue(result instanceof Health); @@ -119,8 +119,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.user); assertTrue(result instanceof Health); Health health = (Health) result; @@ -140,8 +140,8 @@ public class HealthMvcEndpointTests { @Test public void unsecureAnonymousAccessUnrestricted() { 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); @@ -151,8 +151,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); @@ -167,8 +167,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/JolokiaMvcEndpointContextPathTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java index f50fb4f05c..8d3d069d19 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java @@ -49,7 +49,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Dave Syer */ @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = { Config.class }, initializers = ContextPathListener.class) +@SpringApplicationConfiguration(classes = { + Config.class }, initializers = ContextPathListener.class) @WebAppConfiguration public class JolokiaMvcEndpointContextPathTests { @@ -64,8 +65,8 @@ public class JolokiaMvcEndpointContextPathTests { @Before public void setUp() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); - EnvironmentTestUtils.addEnvironment( - (ConfigurableApplicationContext) this.context, "foo:bar"); + EnvironmentTestUtils.addEnvironment((ConfigurableApplicationContext) this.context, + "foo:bar"); } @Test @@ -83,8 +84,8 @@ public class JolokiaMvcEndpointContextPathTests { public static class Config { } - public static class ContextPathListener implements - ApplicationContextInitializer { + public static class ContextPathListener + implements ApplicationContextInitializer { @Override public void initialize(ConfigurableApplicationContext context) { EnvironmentTestUtils.addEnvironment(context, "management.contextPath:/admin"); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java index 9b02bb663c..0a181084af 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java @@ -68,8 +68,8 @@ public class JolokiaMvcEndpointTests { @Before public void setUp() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); - EnvironmentTestUtils.addEnvironment( - (ConfigurableApplicationContext) this.context, "foo:bar"); + EnvironmentTestUtils.addEnvironment((ConfigurableApplicationContext) this.context, + "foo:bar"); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java index ea39c588de..9cc7220eb7 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java @@ -55,12 +55,12 @@ public class CompositeHealthIndicatorTests { @Before public void setup() { MockitoAnnotations.initMocks(this); - given(this.one.health()).willReturn( - new Health.Builder().unknown().withDetail("1", "1").build()); - given(this.two.health()).willReturn( - new Health.Builder().unknown().withDetail("2", "2").build()); - given(this.three.health()).willReturn( - new Health.Builder().unknown().withDetail("3", "3").build()); + given(this.one.health()) + .willReturn(new Health.Builder().unknown().withDetail("1", "1").build()); + given(this.two.health()) + .willReturn(new Health.Builder().unknown().withDetail("2", "2").build()); + given(this.three.health()) + .willReturn(new Health.Builder().unknown().withDetail("3", "3").build()); this.healthAggregator = new OrderedHealthAggregator(); } @@ -74,16 +74,10 @@ public class CompositeHealthIndicatorTests { this.healthAggregator, indicators); Health result = composite.health(); assertThat(result.getDetails().size(), equalTo(2)); - assertThat( - result.getDetails(), - hasEntry("one", - (Object) new Health.Builder().unknown().withDetail("1", "1") - .build())); - assertThat( - result.getDetails(), - hasEntry("two", - (Object) new Health.Builder().unknown().withDetail("2", "2") - .build())); + assertThat(result.getDetails(), hasEntry("one", + (Object) new Health.Builder().unknown().withDetail("1", "1").build())); + assertThat(result.getDetails(), hasEntry("two", + (Object) new Health.Builder().unknown().withDetail("2", "2").build())); } @Test @@ -96,21 +90,12 @@ public class CompositeHealthIndicatorTests { composite.addHealthIndicator("three", this.three); Health result = composite.health(); assertThat(result.getDetails().size(), equalTo(3)); - assertThat( - result.getDetails(), - hasEntry("one", - (Object) new Health.Builder().unknown().withDetail("1", "1") - .build())); - assertThat( - result.getDetails(), - hasEntry("two", - (Object) new Health.Builder().unknown().withDetail("2", "2") - .build())); - assertThat( - result.getDetails(), - hasEntry("three", - (Object) new Health.Builder().unknown().withDetail("3", "3") - .build())); + assertThat(result.getDetails(), hasEntry("one", + (Object) new Health.Builder().unknown().withDetail("1", "1").build())); + assertThat(result.getDetails(), hasEntry("two", + (Object) new Health.Builder().unknown().withDetail("2", "2").build())); + assertThat(result.getDetails(), hasEntry("three", + (Object) new Health.Builder().unknown().withDetail("3", "3").build())); } @Test @@ -121,16 +106,10 @@ public class CompositeHealthIndicatorTests { composite.addHealthIndicator("two", this.two); Health result = composite.health(); assertThat(result.getDetails().size(), equalTo(2)); - assertThat( - result.getDetails(), - hasEntry("one", - (Object) new Health.Builder().unknown().withDetail("1", "1") - .build())); - assertThat( - result.getDetails(), - hasEntry("two", - (Object) new Health.Builder().unknown().withDetail("2", "2") - .build())); + assertThat(result.getDetails(), hasEntry("one", + (Object) new Health.Builder().unknown().withDetail("1", "1").build())); + assertThat(result.getDetails(), hasEntry("two", + (Object) new Health.Builder().unknown().withDetail("2", "2").build())); } @Test @@ -147,9 +126,10 @@ public class CompositeHealthIndicatorTests { Health result = composite.health(); ObjectMapper mapper = new ObjectMapper(); - assertEquals("{\"status\":\"UNKNOWN\",\"db\":{\"status\":\"UNKNOWN\"" - + ",\"db1\":{\"status\":\"UNKNOWN\",\"1\":\"1\"}," - + "\"db2\":{\"status\":\"UNKNOWN\",\"2\":\"2\"}}}", + assertEquals( + "{\"status\":\"UNKNOWN\",\"db\":{\"status\":\"UNKNOWN\"" + + ",\"db1\":{\"status\":\"UNKNOWN\",\"1\":\"1\"}," + + "\"db2\":{\"status\":\"UNKNOWN\",\"2\":\"2\"}}}", mapper.writeValueAsString(result)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java index 0eb4e05bae..9595f745cb 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java @@ -88,8 +88,8 @@ public class DataSourceHealthIndicatorTests { public void connectionClosed() throws Exception { DataSource dataSource = mock(DataSource.class); Connection connection = mock(Connection.class); - given(connection.getMetaData()).willReturn( - this.dataSource.getConnection().getMetaData()); + given(connection.getMetaData()) + .willReturn(this.dataSource.getConnection().getMetaData()); given(dataSource.getConnection()).willReturn(connection); this.indicator.setDataSource(dataSource); Health health = this.indicator.health(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java index 1846bc7f59..05e6e6ffc2 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java @@ -51,8 +51,8 @@ public class DiskSpaceHealthIndicatorTests { public void setUp() throws Exception { given(this.fileMock.exists()).willReturn(true); given(this.fileMock.canRead()).willReturn(true); - this.healthIndicator = new DiskSpaceHealthIndicator(createProperties( - this.fileMock, THRESHOLD_BYTES)); + this.healthIndicator = new DiskSpaceHealthIndicator( + createProperties(this.fileMock, THRESHOLD_BYTES)); } @Test @@ -73,7 +73,8 @@ public class DiskSpaceHealthIndicatorTests { assertEquals(THRESHOLD_BYTES - 10, health.getDetails().get("free")); } - private DiskSpaceHealthIndicatorProperties createProperties(File path, long threshold) { + private DiskSpaceHealthIndicatorProperties createProperties(File path, + long threshold) { DiskSpaceHealthIndicatorProperties properties = new DiskSpaceHealthIndicatorProperties(); properties.setPath(path); properties.setThreshold(threshold); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java index ae5fc29882..b540d22958 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java @@ -83,8 +83,8 @@ public class MongoHealthIndicatorTests { @Test public void mongoIsDown() throws Exception { MongoTemplate mongoTemplate = mock(MongoTemplate.class); - given(mongoTemplate.executeCommand("{ buildInfo: 1 }")).willThrow( - new MongoException("Connection failed")); + given(mongoTemplate.executeCommand("{ buildInfo: 1 }")) + .willThrow(new MongoException("Connection failed")); MongoHealthIndicator healthIndicator = new MongoHealthIndicator(mongoTemplate); Health health = healthIndicator.health(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java index 5516e028c7..a2185250ac 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java @@ -58,7 +58,8 @@ public class OrderedHealthAggregatorTests { healths.put("h2", new Health.Builder().status(Status.UP).build()); healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build()); healths.put("h4", new Health.Builder().status(Status.OUT_OF_SERVICE).build()); - assertEquals(Status.UNKNOWN, this.healthAggregator.aggregate(healths).getStatus()); + assertEquals(Status.UNKNOWN, + this.healthAggregator.aggregate(healths).getStatus()); } @Test @@ -74,8 +75,8 @@ public class OrderedHealthAggregatorTests { @Test public void customOrderWithCustomStatus() { - this.healthAggregator.setStatusOrder(Arrays.asList("DOWN", "OUT_OF_SERVICE", - "UP", "UNKNOWN", "CUSTOM")); + this.healthAggregator.setStatusOrder( + Arrays.asList("DOWN", "OUT_OF_SERVICE", "UP", "UNKNOWN", "CUSTOM")); Map healths = new HashMap(); healths.put("h1", new Health.Builder().status(Status.DOWN).build()); healths.put("h2", new Health.Builder().status(Status.UP).build()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RabbitHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RabbitHealthIndicatorTests.java index 4220b88ad7..6e18e9dcc6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RabbitHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RabbitHealthIndicatorTests.java @@ -47,9 +47,8 @@ public class RabbitHealthIndicatorTests { @Test public void indicatorExists() { this.context = new AnnotationConfigApplicationContext( - PropertyPlaceholderAutoConfiguration.class, - RabbitAutoConfiguration.class, EndpointAutoConfiguration.class, - HealthIndicatorAutoConfiguration.class); + PropertyPlaceholderAutoConfiguration.class, RabbitAutoConfiguration.class, + EndpointAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); assertEquals(1, this.context.getBeanNamesForType(RabbitAdmin.class).length); RabbitHealthIndicator healthIndicator = this.context .getBean(RabbitHealthIndicator.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RedisHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RedisHealthIndicatorTests.java index 87bb844100..e18b32fa9f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RedisHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RedisHealthIndicatorTests.java @@ -70,7 +70,8 @@ public class RedisHealthIndicatorTests { info.put("redis_version", "2.8.9"); RedisConnection redisConnection = mock(RedisConnection.class); - RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class); + RedisConnectionFactory redisConnectionFactory = mock( + RedisConnectionFactory.class); given(redisConnectionFactory.getConnection()).willReturn(redisConnection); given(redisConnection.info()).willReturn(info); RedisHealthIndicator healthIndicator = new RedisHealthIndicator( @@ -87,10 +88,11 @@ public class RedisHealthIndicatorTests { @Test public void redisIsDown() throws Exception { RedisConnection redisConnection = mock(RedisConnection.class); - RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class); + RedisConnectionFactory redisConnectionFactory = mock( + RedisConnectionFactory.class); given(redisConnectionFactory.getConnection()).willReturn(redisConnection); - given(redisConnection.info()).willThrow( - new RedisConnectionFailureException("Connection failed")); + given(redisConnection.info()) + .willThrow(new RedisConnectionFailureException("Connection failed")); RedisHealthIndicator healthIndicator = new RedisHealthIndicator( redisConnectionFactory); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepositoryTests.java index e9f76f28c6..8acf51b5e3 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepositoryTests.java @@ -42,7 +42,8 @@ public class RedisMetricRepositoryTests { @Before public void init() { this.prefix = "spring.test." + System.currentTimeMillis(); - this.repository = new RedisMetricRepository(this.redis.getResource(), this.prefix); + this.repository = new RedisMetricRepository(this.redis.getResource(), + this.prefix); } @After @@ -51,8 +52,8 @@ public class RedisMetricRepositoryTests { .get(this.prefix + ".foo")); this.repository.reset("foo"); this.repository.reset("bar"); - assertNull(new StringRedisTemplate(this.redis.getResource()).opsForValue().get( - this.prefix + ".foo")); + assertNull(new StringRedisTemplate(this.redis.getResource()).opsForValue() + .get(this.prefix + ".foo")); } @Test 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 9fb60e6ae3..429deac523 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 @@ -72,14 +72,14 @@ public class RedisMultiMetricRepositoryTests { @After public void clear() { - assertTrue(new StringRedisTemplate(this.redis.getResource()).opsForZSet().size( - "keys." + this.prefix) > 0); + assertTrue(new StringRedisTemplate(this.redis.getResource()).opsForZSet() + .size("keys." + this.prefix) > 0); this.repository.reset("foo"); this.repository.reset("bar"); - assertNull(new StringRedisTemplate(this.redis.getResource()).opsForValue().get( - this.prefix + ".foo")); - assertNull(new StringRedisTemplate(this.redis.getResource()).opsForValue().get( - this.prefix + ".bar")); + assertNull(new StringRedisTemplate(this.redis.getResource()).opsForValue() + .get(this.prefix + ".foo")); + assertNull(new StringRedisTemplate(this.redis.getResource()).opsForValue() + .get(this.prefix + ".bar")); } @Test @@ -88,23 +88,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")); @@ -112,10 +115,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/repository/redis/RedisServer.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisServer.java index d0e2a3293d..b7a9531f36 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisServer.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisServer.java @@ -97,9 +97,10 @@ public class RedisServer implements TestRule { @Override public void evaluate() throws Throwable { - Assume.assumeTrue("Skipping test due to " - + RedisServer.this.resourceDescription - + " not being available", false); + Assume.assumeTrue( + "Skipping test due to " + RedisServer.this.resourceDescription + + " not being available", + false); } }; } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java index 9be99aece3..f9c2ca067d 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java @@ -35,7 +35,8 @@ public class MultiMetricRichGaugeReaderTests { private MultiMetricRichGaugeReader reader = new MultiMetricRichGaugeReader( this.repository); private InMemoryRichGaugeRepository data = new InMemoryRichGaugeRepository(); - private RichGaugeExporter exporter = new RichGaugeExporter(this.data, this.repository); + private RichGaugeExporter exporter = new RichGaugeExporter(this.data, + this.repository); @Test public void countOne() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/InMemoryRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/InMemoryRepositoryTests.java index 0349376bd3..b5c455731f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/InMemoryRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/InMemoryRepositoryTests.java @@ -74,7 +74,8 @@ public class InMemoryRepositoryTests { this.repository.set("foo.bar", "one"); this.repository.set("foo.min", "two"); this.repository.set("foo.max", "three"); - assertEquals(3, ((Collection) this.repository.findAllWithPrefix("foo")).size()); + assertEquals(3, + ((Collection) this.repository.findAllWithPrefix("foo")).size()); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DropwizardMetricWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DropwizardMetricWriterTests.java index 0167bf88bf..4f673b7d1a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DropwizardMetricWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/DropwizardMetricWriterTests.java @@ -30,7 +30,7 @@ import static org.junit.Assert.assertFalse; /** * Tests for {@link DropwizardMetricWriter}. - * + * * @author Dave Syer */ public class DropwizardMetricWriterTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java index f819815608..3786149725 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java @@ -54,8 +54,8 @@ public class MessageChannelMetricWriterTests { @Override public Object answer(InvocationOnMock invocation) throws Throwable { - MessageChannelMetricWriterTests.this.handler.handleMessage(invocation - .getArgumentAt(0, Message.class)); + MessageChannelMetricWriterTests.this.handler + .handleMessage(invocation.getArgumentAt(0, Message.class)); return true; } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java index 94b0be51ff..2b96ef66d8 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java @@ -39,7 +39,8 @@ public class AuthenticationAuditListenerTests { private final AuthenticationAuditListener listener = new AuthenticationAuditListener(); - private final ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class); + private final ApplicationEventPublisher publisher = mock( + ApplicationEventPublisher.class); @Before public void init() { @@ -64,9 +65,9 @@ public class AuthenticationAuditListenerTests { @Test public void testAuthenticationSwitch() { this.listener.onApplicationEvent(new AuthenticationSwitchUserEvent( - new UsernamePasswordAuthenticationToken("user", "password"), new User( - "user", "password", AuthorityUtils - .commaSeparatedStringToAuthorityList("USER")))); + new UsernamePasswordAuthenticationToken("user", "password"), + new User("user", "password", + AuthorityUtils.commaSeparatedStringToAuthorityList("USER")))); verify(this.publisher).publishEvent((ApplicationEvent) anyObject()); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java index 1ba2b3082e..f5ce55d1f5 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java @@ -39,7 +39,8 @@ public class AuthorizationAuditListenerTests { private final AuthorizationAuditListener listener = new AuthorizationAuditListener(); - private final ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class); + private final ApplicationEventPublisher publisher = mock( + ApplicationEventPublisher.class); @Before public void init() { @@ -48,8 +49,8 @@ public class AuthorizationAuditListenerTests { @Test public void testAuthenticationSuccess() { - this.listener.onApplicationEvent(new AuthorizationFailureEvent(this, Arrays - .asList(new SecurityConfig("USER")), + this.listener.onApplicationEvent(new AuthorizationFailureEvent(this, + Arrays.asList(new SecurityConfig("USER")), new UsernamePasswordAuthenticationToken("user", "password"), new AccessDeniedException("Bad user"))); verify(this.publisher).publishEvent((ApplicationEvent) anyObject()); 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 d46ea346eb..ac8aea2c2d 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 @@ -68,7 +68,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 @@ -89,13 +90,15 @@ public class ApplicationPidFileWriterTests { MockPropertySource propertySource = new MockPropertySource(); propertySource.setProperty("spring.pidfile", file.getAbsolutePath()); environment.getPropertySources().addLast(propertySource); - ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class); + ConfigurableApplicationContext context = mock( + ConfigurableApplicationContext.class); given(context.getEnvironment()).willReturn(environment); ApplicationPreparedEvent event = new ApplicationPreparedEvent( new SpringApplication(), new String[] {}, context); ApplicationPidFileWriter listener = new ApplicationPidFileWriter(); listener.onApplicationEvent(event); - assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString())); + assertThat(FileCopyUtils.copyToString(new FileReader(file)), + not(isEmptyString())); } @Test @@ -112,7 +115,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 @@ -120,9 +124,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())); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriterTests.java index 5393cf0c55..f1cc5a2970 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/EmbeddedServerPortFileWriterTests.java @@ -70,8 +70,8 @@ public class EmbeddedServerPortFileWriterTests { System.setProperty("PORTFILE", this.temporaryFolder.newFile().getAbsolutePath()); EmbeddedServerPortFileWriter listener = new EmbeddedServerPortFileWriter(file); listener.onApplicationEvent(mockEvent("", 8080)); - assertThat(FileCopyUtils.copyToString(new FileReader(System - .getProperty("PORTFILE"))), equalTo("8080")); + assertThat(FileCopyUtils.copyToString( + new FileReader(System.getProperty("PORTFILE"))), equalTo("8080")); } @Test @@ -86,8 +86,10 @@ public class EmbeddedServerPortFileWriterTests { - StringUtils.getFilenameExtension(managementFile).length() - 1); managementFile = managementFile + "-management." + StringUtils.getFilenameExtension(file.getName()); - assertThat(FileCopyUtils.copyToString(new FileReader(new File(file - .getParentFile(), managementFile))), equalTo("9090")); + assertThat( + FileCopyUtils.copyToString( + new FileReader(new File(file.getParentFile(), managementFile))), + equalTo("9090")); assertThat(collectFileNames(file.getParentFile()), hasItem(managementFile)); } @@ -102,13 +104,16 @@ public class EmbeddedServerPortFileWriterTests { - StringUtils.getFilenameExtension(managementFile).length() - 1); managementFile = managementFile + "-MANAGEMENT." + StringUtils.getFilenameExtension(file.getName()); - assertThat(FileCopyUtils.copyToString(new FileReader(new File(file - .getParentFile(), managementFile))), equalTo("9090")); + assertThat( + FileCopyUtils.copyToString( + new FileReader(new File(file.getParentFile(), managementFile))), + equalTo("9090")); assertThat(collectFileNames(file.getParentFile()), hasItem(managementFile)); } private EmbeddedServletContainerInitializedEvent mockEvent(String name, int port) { - EmbeddedWebApplicationContext applicationContext = mock(EmbeddedWebApplicationContext.class); + EmbeddedWebApplicationContext applicationContext = mock( + EmbeddedWebApplicationContext.class); EmbeddedServletContainer source = mock(EmbeddedServletContainer.class); given(applicationContext.getNamespace()).willReturn(name); given(source.getPort()).willReturn(port); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java index 24c0b05f35..d2fa44cfca 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java @@ -56,8 +56,8 @@ public class WebRequestTraceFilterTests { this.filter.enhanceTrace(trace, response); @SuppressWarnings("unchecked") Map map = (Map) trace.get("headers"); - assertEquals("{Content-Type=application/json, status=200}", map.get("response") - .toString()); + assertEquals("{Content-Type=application/json, status=200}", + map.get("response").toString()); } @Test @@ -80,8 +80,8 @@ public class WebRequestTraceFilterTests { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo"); MockHttpServletResponse response = new MockHttpServletResponse(); response.setStatus(500); - request.setAttribute("javax.servlet.error.exception", new IllegalStateException( - "Foo")); + request.setAttribute("javax.servlet.error.exception", + new IllegalStateException("Foo")); response.addHeader("Content-Type", "application/json"); Map trace = this.filter.getTrace(request); this.filter.enhanceTrace(trace, response); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java index c2de9a13cb..46715d5e15 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java @@ -110,8 +110,8 @@ public abstract class AutoConfigurationPackages { private static String[] addBasePackages( ConstructorArgumentValues constructorArguments, String[] packageNames) { - String[] existing = (String[]) constructorArguments.getIndexedArgumentValue(0, - String[].class).getValue(); + String[] existing = (String[]) constructorArguments + .getIndexedArgumentValue(0, String[].class).getValue(); Set merged = new LinkedHashSet(); merged.addAll(Arrays.asList(existing)); merged.addAll(Arrays.asList(packageNames)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java index 60962a61d1..e1a7bd14dd 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java @@ -156,8 +156,8 @@ class AutoConfigurationSorter { } private Set getAnnotationValue(Class annotation) { - Map attributes = this.metadata.getAnnotationAttributes( - annotation.getName(), true); + Map attributes = this.metadata + .getAnnotationAttributes(annotation.getName(), true); if (attributes == null) { return Collections.emptySet(); } 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 fc5a0bde10..37b55758b9 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 @@ -42,8 +42,8 @@ import org.springframework.util.Assert; * @see EnableAutoConfiguration */ @Order(Ordered.LOWEST_PRECEDENCE) -class EnableAutoConfigurationImportSelector implements DeferredImportSelector, - BeanClassLoaderAware, ResourceLoaderAware { +class EnableAutoConfigurationImportSelector + implements DeferredImportSelector, BeanClassLoaderAware, ResourceLoaderAware { private ClassLoader beanClassLoader; @@ -52,18 +52,19 @@ class EnableAutoConfigurationImportSelector implements DeferredImportSelector, @Override public String[] selectImports(AnnotationMetadata metadata) { try { - AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(EnableAutoConfiguration.class.getName(), - true)); + AnnotationAttributes attributes = AnnotationAttributes + .fromMap(metadata.getAnnotationAttributes( + EnableAutoConfiguration.class.getName(), true)); - Assert.notNull(attributes, "No auto-configuration attributes found. Is " - + metadata.getClassName() - + " annotated with @EnableAutoConfiguration?"); + Assert.notNull(attributes, + "No auto-configuration attributes found. Is " + + metadata.getClassName() + + " annotated with @EnableAutoConfiguration?"); // Find all possible auto configuration classes, filtering duplicates - List factories = new ArrayList(new LinkedHashSet( - SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, - this.beanClassLoader))); + List factories = new ArrayList( + new LinkedHashSet(SpringFactoriesLoader.loadFactoryNames( + EnableAutoConfiguration.class, this.beanClassLoader))); // Remove those specifically disabled factories.removeAll(Arrays.asList(attributes.getStringArray("exclude"))); 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 4d833b548c..096a9c75f2 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 @@ -81,8 +81,8 @@ public class MessageSourceAutoConfiguration { public MessageSource messageSource() { ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); if (StringUtils.hasText(this.basename)) { - messageSource - .setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(this.basename))); + messageSource.setBasenames( + commaDelimitedListToStringArray(trimAllWhitespace(this.basename))); } messageSource.setDefaultEncoding(this.encoding); messageSource.setCacheSeconds(this.cacheSeconds); @@ -120,8 +120,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); @@ -132,7 +132,8 @@ public class MessageSourceAutoConfiguration { private ConditionOutcome getMatchOutcomeForBasename(ConditionContext context, String basename) { - for (String name : commaDelimitedListToStringArray(trimAllWhitespace(basename))) { + for (String name : commaDelimitedListToStringArray( + trimAllWhitespace(basename))) { for (Resource resource : getResources(context.getClassLoader(), name)) { if (resource.exists()) { return ConditionOutcome.match("Bundle found for " @@ -140,8 +141,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) { @@ -160,10 +161,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 { @@ -203,7 +205,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/amqp/RabbitAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java index 6fee9ffc4e..28bf1d5e0f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java @@ -42,30 +42,25 @@ import com.rabbitmq.client.Channel; *

* Registers the following beans: *

    - *
  • - * {@link org.springframework.amqp.rabbit.core.RabbitTemplate RabbitTemplate} if there is - * no other bean of the same type in the context.
  • - *
  • - * {@link org.springframework.amqp.rabbit.connection.CachingConnectionFactory + *
  • {@link org.springframework.amqp.rabbit.core.RabbitTemplate RabbitTemplate} if there + * is no other bean of the same type in the context.
  • + *
  • {@link org.springframework.amqp.rabbit.connection.CachingConnectionFactory * CachingConnectionFactory} instance if there is no other bean of the same type in the * context.
  • - *
  • - * {@link org.springframework.amqp.core.AmqpAdmin } instance as long as + *
  • {@link org.springframework.amqp.core.AmqpAdmin } instance as long as * {@literal spring.rabbitmq.dynamic=true}.
  • *
*

* The {@link org.springframework.amqp.rabbit.connection.CachingConnectionFactory} honors * the following properties: *

    - *
  • - * {@literal spring.rabbitmq.port} is used to specify the port to which the client should - * connect, and defaults to 5672.
  • - *
  • - * {@literal spring.rabbitmq.username} is used to specify the (optional) username.
  • - *
  • - * {@literal spring.rabbitmq.password} is used to specify the (optional) password.
  • - *
  • - * {@literal spring.rabbitmq.host} is used to specify the host, and defaults to + *
  • {@literal spring.rabbitmq.port} is used to specify the port to which the client + * should connect, and defaults to 5672.
  • + *
  • {@literal spring.rabbitmq.username} is used to specify the (optional) username. + *
  • + *
  • {@literal spring.rabbitmq.password} is used to specify the (optional) password. + *
  • + *
  • {@literal spring.rabbitmq.host} is used to specify the host, and defaults to * {@literal localhost}.
  • *
  • {@literal spring.rabbitmq.virtualHost} is used to specify the (optional) virtual * host to which the client should connect.
  • diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java index 773253d831..2756047e36 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java @@ -124,8 +124,8 @@ public class RabbitProperties { } result.add(address); } - return (result.isEmpty() ? null : StringUtils - .collectionToCommaDelimitedString(result)); + return (result.isEmpty() ? null + : StringUtils.collectionToCommaDelimitedString(result)); } public void setPort(int port) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java index 6622eb5719..2eb421c9d8 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BasicBatchConfigurer.java @@ -127,7 +127,8 @@ public class BasicBatchConfigurer implements BatchConfigurer { JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); factory.setDataSource(this.dataSource); if (this.entityManagerFactory != null) { - logger.warn("JPA does not support custom isolation levels, so locks may not be taken when launching Jobs"); + logger.warn( + "JPA does not support custom isolation levels, so locks may not be taken when launching Jobs"); factory.setIsolationLevelForCreate("ISOLATION_DEFAULT"); } factory.setTransactionManager(getTransactionManager()); 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 5dc30d5d3b..7aabdcc2a5 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 @@ -109,7 +109,8 @@ public class BatchAutoConfiguration { @Bean @ConditionalOnMissingBean public JobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher, - ListableJobLocator jobRegistry, JobRepository jobRepository) throws Exception { + 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/batch/JobExecutionExitCodeGenerator.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java index 5e016b6683..074b8a4825 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java @@ -28,8 +28,8 @@ import org.springframework.context.ApplicationListener; * * @author Dave Syer */ -public class JobExecutionExitCodeGenerator implements - ApplicationListener, ExitCodeGenerator { +public class JobExecutionExitCodeGenerator + implements ApplicationListener, ExitCodeGenerator { private final List executions = new ArrayList(); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java index 0577fed22d..b840e00e6b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java @@ -61,8 +61,8 @@ import org.springframework.util.StringUtils; * @author Dave Syer */ @Component -public class JobLauncherCommandLineRunner implements CommandLineRunner, - ApplicationEventPublisherAware { +public class JobLauncherCommandLineRunner + implements CommandLineRunner, ApplicationEventPublisherAware { private static Log logger = LogFactory.getLog(JobLauncherCommandLineRunner.class); @@ -80,7 +80,8 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, private ApplicationEventPublisher publisher; - public JobLauncherCommandLineRunner(JobLauncher jobLauncher, JobExplorer jobExplorer) { + public JobLauncherCommandLineRunner(JobLauncher jobLauncher, + JobExplorer jobExplorer) { this.jobLauncher = jobLauncher; this.jobExplorer = jobExplorer; } @@ -122,7 +123,8 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, executeRegisteredJobs(jobParameters); } - private JobParameters getNextJobParameters(Job job, JobParameters additionalParameters) { + private JobParameters getNextJobParameters(Job job, + JobParameters additionalParameters) { String name = job.getName(); JobParameters parameters = new JobParameters(); List lastInstances = this.jobExplorer.getJobInstances(name, 0, 1); @@ -164,7 +166,8 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, } private void removeNonIdentifying(Map parameters) { - HashMap copy = new HashMap(parameters); + HashMap copy = new HashMap( + parameters); for (Map.Entry parameter : copy.entrySet()) { if (!parameter.getValue().isIdentifying()) { parameters.remove(parameter.getKey()); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AnyNestedCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AnyNestedCondition.java index 963ed222fb..6f6e83faf1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AnyNestedCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AnyNestedCondition.java @@ -61,8 +61,8 @@ import org.springframework.util.StringUtils; * @since 1.2.0 */ @Order(Ordered.LOWEST_PRECEDENCE - 20) -public abstract class AnyNestedCondition extends SpringBootCondition implements - ConfigurationCondition { +public abstract class AnyNestedCondition extends SpringBootCondition + implements ConfigurationCondition { private final ConfigurationPhase configurationPhase; @@ -79,8 +79,8 @@ public abstract class AnyNestedCondition extends SpringBootCondition implements @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - MemberConditions memberConditions = new MemberConditions(context, getClass() - .getName()); + MemberConditions memberConditions = new MemberConditions(context, + getClass().getName()); List outcomes = memberConditions.getMatchOutcomes(); List match = new ArrayList(); List nonMatch = new ArrayList(); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java index c4a7e83382..5a62caa587 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java @@ -96,8 +96,8 @@ abstract class BeanTypeRegistry { } private Class doGetFactoryBeanGeneric(ConfigurableListableBeanFactory beanFactory, - BeanDefinition definition, String name) throws Exception, - ClassNotFoundException, LinkageError { + BeanDefinition definition, String name) + throws Exception, ClassNotFoundException, LinkageError { if (StringUtils.hasLength(definition.getFactoryBeanName()) && StringUtils.hasLength(definition.getFactoryMethodName())) { return getConfigurationClassFactoryBeanGeneric(beanFactory, definition, name); @@ -116,8 +116,8 @@ abstract class BeanTypeRegistry { .as(FactoryBean.class).resolveGeneric(); if ((generic == null || generic.equals(Object.class)) && definition.hasAttribute(FACTORY_BEAN_OBJECT_TYPE)) { - generic = getTypeFromAttribute(definition - .getAttribute(FACTORY_BEAN_OBJECT_TYPE)); + generic = getTypeFromAttribute( + definition.getAttribute(FACTORY_BEAN_OBJECT_TYPE)); } return generic; } @@ -132,12 +132,12 @@ abstract class BeanTypeRegistry { .getIntrospectedMethod(); } } - BeanDefinition factoryDefinition = beanFactory.getBeanDefinition(definition - .getFactoryBeanName()); + BeanDefinition factoryDefinition = beanFactory + .getBeanDefinition(definition.getFactoryBeanName()); Class factoryClass = ClassUtils.forName(factoryDefinition.getBeanClassName(), beanFactory.getBeanClassLoader()); - return ReflectionUtils - .findMethod(factoryClass, definition.getFactoryMethodName()); + return ReflectionUtils.findMethod(factoryClass, + definition.getFactoryMethodName()); } private Class getDirectFactoryBeanGeneric( @@ -145,12 +145,12 @@ abstract class BeanTypeRegistry { String name) throws ClassNotFoundException, LinkageError { Class factoryBeanClass = ClassUtils.forName(definition.getBeanClassName(), beanFactory.getBeanClassLoader()); - Class generic = ResolvableType.forClass(factoryBeanClass) - .as(FactoryBean.class).resolveGeneric(); + Class generic = ResolvableType.forClass(factoryBeanClass).as(FactoryBean.class) + .resolveGeneric(); if ((generic == null || generic.equals(Object.class)) && definition.hasAttribute(FACTORY_BEAN_OBJECT_TYPE)) { - generic = getTypeFromAttribute(definition - .getAttribute(FACTORY_BEAN_OBJECT_TYPE)); + generic = getTypeFromAttribute( + definition.getAttribute(FACTORY_BEAN_OBJECT_TYPE)); } return generic; } @@ -195,8 +195,8 @@ abstract class BeanTypeRegistry { @Override public Set getNamesForType(Class type) { Set result = new LinkedHashSet(); - result.addAll(Arrays.asList(this.beanFactory.getBeanNamesForType(type, true, - false))); + result.addAll(Arrays + .asList(this.beanFactory.getBeanNamesForType(type, true, false))); if (this.beanFactory instanceof ConfigurableListableBeanFactory) { collectBeanNamesForTypeFromFactoryBeans(result, (ConfigurableListableBeanFactory) this.beanFactory, type); @@ -225,8 +225,8 @@ abstract class BeanTypeRegistry { * {@link BeanTypeRegistry} optimized for {@link DefaultListableBeanFactory} * implementations that allow eager class loading. */ - static class OptimizedBeanTypeRegistry extends BeanTypeRegistry implements - SmartInitializingSingleton { + static class OptimizedBeanTypeRegistry extends BeanTypeRegistry + implements SmartInitializingSingleton { private static final String BEAN_NAME = BeanTypeRegistry.class.getName(); @@ -249,7 +249,8 @@ abstract class BeanTypeRegistry { @Override public Set getNamesForType(Class type) { - if (this.lastBeanDefinitionCount != this.beanFactory.getBeanDefinitionCount()) { + if (this.lastBeanDefinitionCount != this.beanFactory + .getBeanDefinitionCount()) { Iterator names = this.beanFactory.getBeanNamesIterator(); while (names.hasNext()) { String name = names.next(); @@ -315,8 +316,8 @@ abstract class BeanTypeRegistry { private boolean requiresEagerInit(String factoryBeanName) { return (factoryBeanName != null - && this.beanFactory.isFactoryBean(factoryBeanName) && !this.beanFactory - .containsSingleton(factoryBeanName)); + && this.beanFactory.isFactoryBean(factoryBeanName) + && !this.beanFactory.containsSingleton(factoryBeanName)); } /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java index 0fd8d031b8..941e4a1b6d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java @@ -84,7 +84,8 @@ public class ConditionEvaluationReport { */ public Map getConditionAndOutcomesBySource() { if (!this.addedAncestorOutcomes) { - for (Map.Entry entry : this.outcomes.entrySet()) { + for (Map.Entry entry : this.outcomes + .entrySet()) { if (!entry.getValue().isFullMatch()) { addNoMatchOutcomeToAncestors(entry.getKey()); } @@ -98,8 +99,8 @@ public class ConditionEvaluationReport { String prefix = source + "$"; for (Entry entry : this.outcomes.entrySet()) { if (entry.getKey().startsWith(prefix)) { - ConditionOutcome outcome = new ConditionOutcome(false, "Ancestor '" - + source + "' did not match"); + ConditionOutcome outcome = new ConditionOutcome(false, + "Ancestor '" + source + "' did not match"); entry.getValue().add(ANCESTOR_CONDITION, outcome); } } @@ -206,8 +207,8 @@ public class ConditionEvaluationReport { } ConditionAndOutcome other = (ConditionAndOutcome) obj; return (ObjectUtils.nullSafeEquals(this.condition.getClass(), - other.condition.getClass()) && ObjectUtils.nullSafeEquals( - this.outcome, other.outcome)); + other.condition.getClass()) + && ObjectUtils.nullSafeEquals(this.outcome, other.outcome)); } @Override diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java index a004c86067..61a9d1fccc 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java @@ -92,8 +92,8 @@ public class ConditionOutcome { } if (getClass() == obj.getClass()) { ConditionOutcome other = (ConditionOutcome) obj; - return (this.match == other.match && ObjectUtils.nullSafeEquals(this.message, - other.message)); + return (this.match == other.match + && ObjectUtils.nullSafeEquals(this.message, other.message)); } return super.equals(obj); } 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 26461ff827..d05571c672 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 @@ -56,8 +56,8 @@ import org.springframework.util.StringUtils; * @author Andy Wilkinson */ @Order(Ordered.LOWEST_PRECEDENCE) -public class OnBeanCondition extends SpringBootCondition implements - ConfigurationCondition { +public class OnBeanCondition extends SpringBootCondition + implements ConfigurationCondition { private static final Log logger = LogFactory.getLog(OnBeanCondition.class); @@ -83,11 +83,11 @@ public class OnBeanCondition extends SpringBootCondition implements 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(ConditionalOnMissingBean.class.getName())) { BeanSearchSpec spec = new BeanSearchSpec(context, metadata, @@ -103,7 +103,8 @@ public class OnBeanCondition extends SpringBootCondition implements 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(); @@ -146,7 +147,7 @@ public class OnBeanCondition extends SpringBootCondition implements private Collection getBeanNamesForType(ListableBeanFactory beanFactory, String type, ClassLoader classLoader, boolean considerHierarchy) - throws LinkageError { + throws LinkageError { try { Set result = new LinkedHashSet(); collectBeanNamesForType(result, beanFactory, @@ -181,7 +182,8 @@ public class OnBeanCondition extends SpringBootCondition implements .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(), @@ -232,8 +234,8 @@ public class OnBeanCondition extends SpringBootCondition implements Assert.isTrue(hasAtLeastOne(this.types, this.names, this.annotations), annotationName(annotationType) + " annotations must " + "specify at least one bean (type, name or annotation)"); - this.strategy = (SearchStrategy) metadata.getAnnotationAttributes( - annotationType.getName()).get("search"); + this.strategy = (SearchStrategy) metadata + .getAnnotationAttributes(annotationType.getName()).get("search"); } private boolean hasAtLeastOne(List... lists) { @@ -279,8 +281,8 @@ public class OnBeanCondition extends SpringBootCondition implements 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()); } @@ -290,10 +292,9 @@ public class OnBeanCondition extends SpringBootCondition implements 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/OnClassCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java index 1d6fe7b9fc..e2a1a7fb22 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java @@ -57,15 +57,15 @@ class OnClassCondition extends SpringBootCondition { + StringUtils.collectionToCommaDelimitedString(missing)); } matchMessage.append("@ConditionalOnClass classes found: " - + StringUtils.collectionToCommaDelimitedString(getMatchingClasses( - onClasses, MatchType.PRESENT, context))); + + StringUtils.collectionToCommaDelimitedString( + getMatchingClasses(onClasses, MatchType.PRESENT, context))); } MultiValueMap onMissingClasses = getAttributes(metadata, ConditionalOnMissingClass.class); if (onMissingClasses != null) { - List present = getMatchingClasses(onMissingClasses, - MatchType.PRESENT, context); + List present = getMatchingClasses(onMissingClasses, MatchType.PRESENT, + context); if (!present.isEmpty()) { return ConditionOutcome .noMatch("required @ConditionalOnMissing classes found: " diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java index dd677fd502..09c302bfda 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java @@ -39,8 +39,9 @@ class OnExpressionCondition extends SpringBootCondition { public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - String expression = (String) metadata.getAnnotationAttributes( - ConditionalOnExpression.class.getName()).get("value"); + String expression = (String) metadata + .getAnnotationAttributes(ConditionalOnExpression.class.getName()) + .get("value"); String rawExpression = expression; if (!expression.startsWith("#{")) { // For convenience allow user to provide bare expression with no #{} wrapper @@ -51,8 +52,8 @@ class OnExpressionCondition extends SpringBootCondition { expression = context.getEnvironment().resolvePlaceholders(expression); ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); BeanExpressionResolver resolver = beanFactory.getBeanExpressionResolver(); - BeanExpressionContext expressionContext = (beanFactory != null) ? new BeanExpressionContext( - beanFactory, null) : null; + BeanExpressionContext expressionContext = (beanFactory != null) + ? new BeanExpressionContext(beanFactory, null) : null; if (resolver == null) { resolver = new StandardBeanExpressionResolver(); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java index 5b13aeba34..da799820b1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java @@ -55,9 +55,10 @@ class OnJavaCondition extends SpringBootCondition { return new ConditionOutcome(match, getMessage(range, runningVersion, version)); } - private String getMessage(Range range, JavaVersion runningVersion, JavaVersion version) { - String expected = String.format(range == Range.EQUAL_OR_NEWER ? "%s or newer" - : "older than %s", version); + private String getMessage(Range range, JavaVersion runningVersion, + JavaVersion version) { + String expected = String.format( + range == Range.EQUAL_OR_NEWER ? "%s or newer" : "older than %s", version); return "Required JVM version " + expected + " found " + runningVersion; } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java index 2363c3a84d..954f7fe1da 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJndiCondition.java @@ -41,8 +41,8 @@ class OnJndiCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(ConditionalOnJndi.class.getName())); + AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap( + metadata.getAnnotationAttributes(ConditionalOnJndi.class.getName())); String[] locations = annotationAttributes.getStringArray("value"); try { return getMatchOutcome(locations); @@ -62,9 +62,9 @@ class OnJndiCondition extends SpringBootCondition { JndiLocator locator = getJndiLocator(locations); String location = locator.lookupFirstLocation(); if (location != null) { - return ConditionOutcome.match("JNDI location '" + location - + "' found from candidates " - + StringUtils.arrayToCommaDelimitedString(locations)); + return ConditionOutcome + .match("JNDI location '" + location + "' found from candidates " + + StringUtils.arrayToCommaDelimitedString(locations)); } return ConditionOutcome.noMatch("No JNDI location found from candidates " + StringUtils.arrayToCommaDelimitedString(locations)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java index cd8822d218..606ae5c865 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java @@ -44,8 +44,8 @@ class OnPropertyCondition extends SpringBootCondition { public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(ConditionalOnProperty.class.getName())); + AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap( + metadata.getAnnotationAttributes(ConditionalOnProperty.class.getName())); String prefix = annotationAttributes.getString("prefix").trim(); if (StringUtils.hasText(prefix) && !prefix.endsWith(".")) { 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 fb956f812a..6938e6b59e 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 @@ -40,11 +40,11 @@ class OnResourceCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - MultiValueMap attributes = metadata.getAllAnnotationAttributes( - ConditionalOnResource.class.getName(), true); + MultiValueMap attributes = metadata + .getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true); if (attributes != null) { - ResourceLoader loader = context.getResourceLoader() == null ? this.defaultResourceLoader - : context.getResourceLoader(); + ResourceLoader loader = context.getResourceLoader() == null + ? this.defaultResourceLoader : context.getResourceLoader(); List locations = new ArrayList(); collectValues(locations, attributes.get("resources")); Assert.isTrue(locations.size() > 0, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java index aa1dcb3e87..a1313be874 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java @@ -39,7 +39,8 @@ public abstract class SpringBootCondition implements Condition { private final Log logger = LogFactory.getLog(getClass()); @Override - public final boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { + public final boolean matches(ConditionContext context, + AnnotatedTypeMetadata metadata) { String classOrMethodName = getClassOrMethodName(metadata); try { ConditionOutcome outcome = getMatchOutcome(context, metadata); @@ -55,8 +56,8 @@ public abstract class SpringBootCondition implements Condition { + "in the default package by mistake)", ex); } catch (RuntimeException ex) { - throw new IllegalStateException("Error processing condition on " - + getName(metadata), ex); + throw new IllegalStateException( + "Error processing condition on " + getName(metadata), ex); } } @@ -88,7 +89,8 @@ public abstract class SpringBootCondition implements Condition { } } - private StringBuilder getLogMessage(String classOrMethodName, ConditionOutcome outcome) { + private StringBuilder getLogMessage(String classOrMethodName, + ConditionOutcome outcome) { StringBuilder message = new StringBuilder(); message.append("Condition "); message.append(ClassUtils.getShortName(getClass())); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport.java index fcf70cb606..d011830734 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport.java @@ -42,8 +42,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi * @author Dave Syer * @author Oliver Gierke */ -public abstract class AbstractRepositoryConfigurationSourceSupport implements - BeanFactoryAware, ImportBeanDefinitionRegistrar, ResourceLoaderAware, +public abstract class AbstractRepositoryConfigurationSourceSupport + implements BeanFactoryAware, ImportBeanDefinitionRegistrar, ResourceLoaderAware, EnvironmentAware { private ResourceLoader resourceLoader; @@ -55,9 +55,9 @@ public abstract class AbstractRepositoryConfigurationSourceSupport implements @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { - new RepositoryConfigurationDelegate(getConfigurationSource(), - this.resourceLoader, this.environment).registerRepositoriesIn(registry, - getRepositoryConfigurationExtension()); + new RepositoryConfigurationDelegate(getConfigurationSource(), this.resourceLoader, + this.environment).registerRepositoriesIn(registry, + getRepositoryConfigurationExtension()); } private AnnotationRepositoryConfigurationSource getConfigurationSource() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesRegistrar.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesRegistrar.java index 3102f01988..1cbacce711 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesRegistrar.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesRegistrar.java @@ -32,8 +32,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi * @author Mohsin Husen * @since 1.1.0 */ -class ElasticsearchRepositoriesRegistrar extends - AbstractRepositoryConfigurationSourceSupport { +class ElasticsearchRepositoriesRegistrar + extends AbstractRepositoryConfigurationSourceSupport { @Override protected Class getAnnotation() { 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 53a06475fe..a702fb0c9e 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 @@ -42,8 +42,8 @@ import org.springframework.util.StringUtils; * @since 1.1.0 * @see BeanDefinition#setDependsOn(String[]) */ -public class EntityManagerFactoryDependsOnPostProcessor implements - BeanFactoryPostProcessor { +public class EntityManagerFactoryDependsOnPostProcessor + implements BeanFactoryPostProcessor { private final String dependsOn; @@ -55,8 +55,8 @@ public class EntityManagerFactoryDependsOnPostProcessor implements public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { for (String beanName : getEntityManagerFactoryBeanNames(beanFactory)) { BeanDefinition definition = getBeanDefinition(beanName, beanFactory); - definition.setDependsOn(StringUtils.addStringToArray( - definition.getDependsOn(), this.dependsOn)); + definition.setDependsOn(StringUtils + .addStringToArray(definition.getDependsOn(), this.dependsOn)); } } @@ -80,9 +80,8 @@ public class EntityManagerFactoryDependsOnPostProcessor implements Set names = new HashSet(); names.addAll(Arrays.asList(BeanFactoryUtils.beanNamesForTypeIncludingAncestors( beanFactory, EntityManagerFactory.class, true, false))); - for (String factoryBeanName : BeanFactoryUtils - .beanNamesForTypeIncludingAncestors(beanFactory, - AbstractEntityManagerFactoryBean.class, true, false)) { + for (String factoryBeanName : BeanFactoryUtils.beanNamesForTypeIncludingAncestors( + beanFactory, AbstractEntityManagerFactoryBean.class, true, false)) { names.add(BeanFactoryUtils.transformedBeanName(factoryBeanName)); } return names; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigureRegistrar.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigureRegistrar.java index c853a3b451..c95daf527a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigureRegistrar.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigureRegistrar.java @@ -31,8 +31,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi * @author Phillip Webb * @author Dave Syer */ -class JpaRepositoriesAutoConfigureRegistrar extends - AbstractRepositoryConfigurationSourceSupport { +class JpaRepositoriesAutoConfigureRegistrar + extends AbstractRepositoryConfigurationSourceSupport { @Override protected Class getAnnotation() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigureRegistrar.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigureRegistrar.java index feae1ecb95..16d44ccba2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigureRegistrar.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigureRegistrar.java @@ -30,8 +30,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi * * @author Dave Syer */ -class MongoRepositoriesAutoConfigureRegistrar extends - AbstractRepositoryConfigurationSourceSupport { +class MongoRepositoriesAutoConfigureRegistrar + extends AbstractRepositoryConfigurationSourceSupport { @Override protected Class getAnnotation() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.java index 0be878c7a8..6f858586d5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.java @@ -37,8 +37,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; * @since 1.2.2 */ @Configuration -public class SpringBootRepositoryRestMvcConfiguration extends - RepositoryRestMvcConfiguration { +public class SpringBootRepositoryRestMvcConfiguration + extends RepositoryRestMvcConfiguration { @Autowired(required = false) private Jackson2ObjectMapperBuilder objectMapperBuilder; 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 dc7d5d75cb..7959e5efd9 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 @@ -82,8 +82,9 @@ public class FlywayAutoConfiguration { Assert.state(!this.properties.getLocations().isEmpty(), "Migration script locations not configured"); boolean exists = hasAtLeastOneLocation(); - Assert.state(exists, "Cannot find migrations location in: " - + this.properties.getLocations() + Assert.state(exists, + "Cannot find migrations location in: " + this.properties + .getLocations() + " (please add migrations or check your Flyway configuration)"); } } @@ -103,8 +104,8 @@ public class FlywayAutoConfiguration { Flyway flyway = new Flyway(); if (this.properties.isCreateDataSource()) { flyway.setDataSource(this.properties.getUrl(), this.properties.getUser(), - this.properties.getPassword(), this.properties.getInitSqls() - .toArray(new String[0])); + this.properties.getPassword(), + this.properties.getInitSqls().toArray(new String[0])); } else if (this.flywayDataSource != null) { flyway.setDataSource(this.flywayDataSource); @@ -124,8 +125,8 @@ public class FlywayAutoConfiguration { @Configuration @ConditionalOnClass(LocalContainerEntityManagerFactoryBean.class) @ConditionalOnBean(AbstractEntityManagerFactoryBean.class) - protected static class FlywayJpaDependencyConfiguration extends - EntityManagerFactoryDependsOnPostProcessor { + protected static class FlywayJpaDependencyConfiguration + extends EntityManagerFactoryDependsOnPostProcessor { public FlywayJpaDependencyConfiguration() { super("flyway"); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java index 241765fe5f..6c074a3fa1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java @@ -77,10 +77,11 @@ public class FreeMarkerAutoConfiguration { break; } } - Assert.notNull(templatePathLocation, "Cannot find template location(s): " - + locations + " (please add some templates, " - + "check your FreeMarker configuration, or set " - + "spring.freemarker.checkTemplateLocation=false)"); + Assert.notNull(templatePathLocation, + "Cannot find template location(s): " + locations + + " (please add some templates, " + + "check your FreeMarker configuration, or set " + + "spring.freemarker.checkTemplateLocation=false)"); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java index a5877d3a28..bde5412da0 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java @@ -29,8 +29,8 @@ import org.springframework.util.ClassUtils; * @author Andy Wilkinson * @since 1.1.0 */ -public class FreeMarkerTemplateAvailabilityProvider implements - TemplateAvailabilityProvider { +public class FreeMarkerTemplateAvailabilityProvider + implements TemplateAvailabilityProvider { @Override public boolean isTemplateAvailable(String view, Environment environment, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java index 8b4417df9e..063d5ea625 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java @@ -51,12 +51,13 @@ public class GroovyTemplateResolver implements TemplateResolver { public URL resolveTemplate(final String templatePath) throws IOException { MarkupTemplateEngine.TemplateResource templateResource = MarkupTemplateEngine.TemplateResource .parse(templatePath); - URL resource = this.templateClassLoader.getResource(templateResource.withLocale( - LocaleContextHolder.getLocale().toString().replace("-", "_")).toString()); + URL resource = this.templateClassLoader.getResource(templateResource + .withLocale(LocaleContextHolder.getLocale().toString().replace("-", "_")) + .toString()); if (resource == null) { // no resource found with the default locale, try without any locale - resource = this.templateClassLoader.getResource(templateResource.withLocale( - null).toString()); + resource = this.templateClassLoader + .getResource(templateResource.withLocale(null).toString()); } if (resource == null) { throw new IOException("Unable to load template:" + templatePath); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java index b3c1fff2e4..1d9a640c84 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java @@ -125,8 +125,8 @@ public class HypermediaAutoConfiguration { * {@link BeanPostProcessor} to apply any {@link Jackson2ObjectMapperBuilder} * configuration to the HAL {@link ObjectMapper}. */ - private static class HalObjectMapperConfigurer implements BeanPostProcessor, - BeanFactoryAware { + private static class HalObjectMapperConfigurer + implements BeanPostProcessor, BeanFactoryAware { private BeanFactory beanFactory; 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 eeb8d826a2..9df0cf8ca6 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 @@ -119,21 +119,23 @@ public class JacksonAutoConfiguration { SimpleModule module = new SimpleModule(); JacksonJodaFormat jacksonJodaFormat = getJacksonJodaFormat(); if (jacksonJodaFormat != null) { - module.addSerializer(DateTime.class, new DateTimeSerializer( - jacksonJodaFormat)); + module.addSerializer(DateTime.class, + new DateTimeSerializer(jacksonJodaFormat)); } return module; } private JacksonJodaFormat getJacksonJodaFormat() { if (this.jacksonProperties.getJodaDateTimeFormat() != null) { - return new JacksonJodaFormat(DateTimeFormat.forPattern( - this.jacksonProperties.getJodaDateTimeFormat()).withZoneUTC()); + return new JacksonJodaFormat(DateTimeFormat + .forPattern(this.jacksonProperties.getJodaDateTimeFormat()) + .withZoneUTC()); } if (this.jacksonProperties.getDateFormat() != null) { try { - return new JacksonJodaFormat(DateTimeFormat.forPattern( - this.jacksonProperties.getDateFormat()).withZoneUTC()); + return new JacksonJodaFormat(DateTimeFormat + .forPattern(this.jacksonProperties.getDateFormat()) + .withZoneUTC()); } catch (IllegalArgumentException ex) { if (this.log.isWarnEnabled()) { @@ -151,9 +153,10 @@ public class JacksonAutoConfiguration { @Configuration @ConditionalOnClass({ ObjectMapper.class, Jackson2ObjectMapperBuilder.class }) - @EnableConfigurationProperties({ HttpMapperProperties.class, JacksonProperties.class }) - static class JacksonObjectMapperBuilderConfiguration implements - ApplicationContextAware { + @EnableConfigurationProperties({ HttpMapperProperties.class, + JacksonProperties.class }) + static class JacksonObjectMapperBuilderConfiguration + implements ApplicationContextAware { private ApplicationContext applicationContext; @@ -206,8 +209,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)); @@ -215,7 +218,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 @@ -232,7 +236,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/DataSourceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java index 2a5de7a3cb..678c147da1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -78,8 +78,8 @@ public class DataSourceAutoConfiguration { ConfigurableListableBeanFactory beanFactory) { try { BeanDefinition beanDefinition = beanFactory.getBeanDefinition("dataSource"); - return EmbeddedDataSourceConfiguration.class.getName().equals( - beanDefinition.getFactoryBeanName()); + return EmbeddedDataSourceConfiguration.class.getName() + .equals(beanDefinition.getFactoryBeanName()); } catch (NoSuchBeanDefinitionException ex) { return false; @@ -117,8 +117,7 @@ public class DataSourceAutoConfiguration { DataSourceBuilder factory = DataSourceBuilder .create(this.properties.getClassLoader()) .driverClassName(this.properties.getDriverClassName()) - .url(this.properties.getUrl()) - .username(this.properties.getUsername()) + .url(this.properties.getUrl()).username(this.properties.getUsername()) .password(this.properties.getPassword()); return factory.build(); } @@ -207,8 +206,8 @@ public class DataSourceAutoConfiguration { return ConditionOutcome .noMatch("existing non-embedded database detected"); } - EmbeddedDatabaseType type = EmbeddedDatabaseConnection.get( - context.getClassLoader()).getType(); + EmbeddedDatabaseType type = EmbeddedDatabaseConnection + .get(context.getClassLoader()).getType(); if (type == null) { return ConditionOutcome.noMatch("no embedded database detected"); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java index c0bcf36f7c..905392639a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java @@ -63,7 +63,8 @@ class DataSourceInitializer implements ApplicationListener 0) { + if (this.applicationContext.getBeanNamesForType(DataSource.class, false, + false).length > 0) { this.dataSource = this.applicationContext.getBean(DataSource.class); } if (this.dataSource == null) { @@ -78,8 +79,8 @@ class DataSourceInitializer implements ApplicationListener DRIVERS; + static { Map drivers = new HashMap(); drivers.put("derby", "org.apache.derby.jdbc.EmbeddedDriver"); @@ -56,8 +57,8 @@ class DriverClassNameProvider { */ String getDriverClassName(final String jdbcUrl) { Assert.notNull(jdbcUrl, "JdbcUrl must not be null"); - Assert.isTrue(jdbcUrl.startsWith(JDBC_URL_PREFIX), "JdbcUrl must start with '" - + JDBC_URL_PREFIX + "'"); + Assert.isTrue(jdbcUrl.startsWith(JDBC_URL_PREFIX), + "JdbcUrl must start with '" + JDBC_URL_PREFIX + "'"); String urlWithoutPrefix = jdbcUrl.substring(JDBC_URL_PREFIX.length()); for (Map.Entry driver : DRIVERS.entrySet()) { if (urlWithoutPrefix.startsWith(":" + driver.getKey() + ":")) { 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 2803192b70..ab234bc7a9 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 @@ -108,10 +108,9 @@ public enum EmbeddedDatabaseConnection { * @return true if the driver class is one of the embedded types */ public static boolean isEmbedded(String driverClass) { - return driverClass != null - && (driverClass.equals(HSQL.driverClass) - || driverClass.equals(H2.driverClass) || driverClass - .equals(DERBY.driverClass)); + return driverClass != null && (driverClass.equals(HSQL.driverClass) + || driverClass.equals(H2.driverClass) + || driverClass.equals(DERBY.driverClass)); } /** @@ -142,8 +141,8 @@ public enum EmbeddedDatabaseConnection { return override; } for (EmbeddedDatabaseConnection candidate : EmbeddedDatabaseConnection.values()) { - if (candidate != NONE - && ClassUtils.isPresent(candidate.getDriverClassName(), classLoader)) { + if (candidate != NONE && ClassUtils.isPresent(candidate.getDriverClassName(), + classLoader)) { return candidate; } } @@ -156,8 +155,8 @@ public enum EmbeddedDatabaseConnection { private static class IsEmbedded implements ConnectionCallback { @Override - public Boolean doInConnection(Connection connection) throws SQLException, - DataAccessException { + public Boolean doInConnection(Connection connection) + throws SQLException, DataAccessException { String productName = connection.getMetaData().getDatabaseProductName(); if (productName == null) { return false; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadata.java index a98a8664d8..38c113efc2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadata.java @@ -25,8 +25,8 @@ import javax.sql.DataSource; * @author Stephane Nicoll * @since 1.2.0 */ -public abstract class AbstractDataSourcePoolMetadata implements - DataSourcePoolMetadata { +public abstract class AbstractDataSourcePoolMetadata + implements DataSourcePoolMetadata { private final T dataSource; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java index 963564d5bf..a0403716ee 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java @@ -26,8 +26,8 @@ import org.apache.commons.dbcp.BasicDataSource; * @author Stephane Nicoll * @since 1.2.0 */ -public class CommonsDbcpDataSourcePoolMetadata extends - AbstractDataSourcePoolMetadata { +public class CommonsDbcpDataSourcePoolMetadata + extends AbstractDataSourcePoolMetadata { public CommonsDbcpDataSourcePoolMetadata(BasicDataSource dataSource) { super(dataSource); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadata.java index 30f6d6dbae..6ebe304caa 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadata.java @@ -33,7 +33,8 @@ public interface DataSourcePoolMetadata { *
      *
    • 1 means that the maximum number of connections have been allocated
    • *
    • 0 means that no connection is currently active
    • - *
    • -1 means there is not limit to the number of connections that can be allocated
    • + *
    • -1 means there is not limit to the number of connections that can be allocated + *
    • *
    * This may also return {@code null} if the data source does not provide the necessary * information to compute the poll usage. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadata.java index c656249d4a..46e467f1f9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadata.java @@ -29,8 +29,8 @@ import com.zaxxer.hikari.pool.HikariPool; * @author Stephane Nicoll * @since 1.2.0 */ -public class HikariDataSourcePoolMetadata extends - AbstractDataSourcePoolMetadata { +public class HikariDataSourcePoolMetadata + extends AbstractDataSourcePoolMetadata { public HikariDataSourcePoolMetadata(HikariDataSource dataSource) { super(dataSource); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadata.java index 5dcc6b4ab6..e0e0e031d1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadata.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadata.java @@ -24,8 +24,8 @@ import org.apache.tomcat.jdbc.pool.DataSource; * * @author Stephane Nicoll */ -public class TomcatDataSourcePoolMetadata extends - AbstractDataSourcePoolMetadata { +public class TomcatDataSourcePoolMetadata + extends AbstractDataSourcePoolMetadata { public TomcatDataSourcePoolMetadata(DataSource dataSource) { super(dataSource); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java index 75982d3895..dedf63ac68 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java @@ -59,8 +59,7 @@ import org.springframework.web.filter.RequestContextFilter; * @author Andy Wilkinson */ @Configuration -@ConditionalOnClass(name = { - "org.glassfish.jersey.server.spring.SpringComponentProvider", +@ConditionalOnClass(name = { "org.glassfish.jersey.server.spring.SpringComponentProvider", "javax.servlet.ServletRegistration" }) @ConditionalOnBean(type = "org.glassfish.jersey.server.ResourceConfig") @ConditionalOnWebApplication diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java index 4b91d91ae2..5f098b437b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java @@ -53,7 +53,8 @@ import org.springframework.util.StringUtils; public class JndiConnectionFactoryAutoConfiguration { // Keep these in sync with the condition below - private static String[] JNDI_LOCATIONS = { "java:/JmsXA", "java:/XAConnectionFactory" }; + private static String[] JNDI_LOCATIONS = { "java:/JmsXA", + "java:/XAConnectionFactory" }; @Autowired private JmsProperties properties; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryConfiguration.java index d9afb6f4f5..43758e220e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryConfiguration.java @@ -48,8 +48,8 @@ class ActiveMQConnectionFactoryConfiguration { if (properties.isPooled()) { PooledConnectionFactory pool = new PooledConnectionFactory(); Method setConnectionFactory = findConnectionFactorySetter(); - Assert.state(setConnectionFactory != null, "No supported " - + "setConnectionFactory method was found"); + Assert.state(setConnectionFactory != null, + "No supported " + "setConnectionFactory method was found"); ReflectionUtils.invokeMethod(setConnectionFactory, pool, connectionFactory); return pool; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java index 6d3f82074b..0ba70d19fd 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java @@ -46,8 +46,8 @@ class ActiveMQConnectionFactoryFactory { return doCreateConnectionFactory(factoryClass); } catch (Exception ex) { - throw new IllegalStateException("Unable to create " - + "ActiveMQConnectionFactory", ex); + throw new IllegalStateException( + "Unable to create " + "ActiveMQConnectionFactory", ex); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQConnectionFactoryFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQConnectionFactoryFactory.java index ff6028b85a..d54b314c8a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQConnectionFactoryFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQConnectionFactoryFactory.java @@ -62,8 +62,8 @@ class HornetQConnectionFactoryFactory { return doCreateConnectionFactory(factoryClass); } catch (Exception ex) { - throw new IllegalStateException("Unable to create " - + "HornetQConnectionFactory", ex); + throw new IllegalStateException( + "Unable to create " + "HornetQConnectionFactory", ex); } } @@ -105,12 +105,12 @@ class HornetQConnectionFactoryFactory { 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 = HornetQClient .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/hornetq/HornetQEmbeddedServerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQEmbeddedServerConfiguration.java index 2a82e9b1df..e79c54605a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQEmbeddedServerConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQEmbeddedServerConfiguration.java @@ -106,16 +106,15 @@ class HornetQEmbeddedServerConfiguration { private void addQueues(JMSConfiguration configuration, String[] queues) { boolean persistent = this.properties.getEmbedded().isPersistent(); for (String queue : queues) { - configuration.getQueueConfigurations().add( - new JMSQueueConfigurationImpl(queue, null, persistent, "/queue/" - + queue)); + configuration.getQueueConfigurations().add(new JMSQueueConfigurationImpl( + queue, null, persistent, "/queue/" + queue)); } } private void addTopics(JMSConfiguration configuration, String[] topics) { for (String topic : topics) { - configuration.getTopicConfigurations().add( - new TopicConfigurationImpl(topic, "/topic/" + topic)); + configuration.getTopicConfigurations() + .add(new TopicConfigurationImpl(topic, "/topic/" + topic)); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQXAConnectionFactoryConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQXAConnectionFactoryConfiguration.java index bc06b8d6d2..6866e96978 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQXAConnectionFactoryConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQXAConnectionFactoryConfiguration.java @@ -46,10 +46,10 @@ class HornetQXAConnectionFactoryConfiguration { @Bean(name = { "jmsConnectionFactory", "xaJmsConnectionFactory" }) public ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory, HornetQProperties properties, XAConnectionFactoryWrapper wrapper) - throws Exception { - return wrapper.wrapConnectionFactory(new HornetQConnectionFactoryFactory( - beanFactory, properties) - .createConnectionFactory(HornetQXAConnectionFactory.class)); + throws Exception { + return wrapper.wrapConnectionFactory( + new HornetQConnectionFactoryFactory(beanFactory, properties) + .createConnectionFactory(HornetQXAConnectionFactory.class)); } @Bean diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java index 7977ba0a17..faaabeaeaf 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java @@ -36,8 +36,8 @@ import org.springframework.util.ObjectUtils; * @author Dave Syer * @since 1.1.1 */ -public class ParentAwareNamingStrategy extends MetadataNamingStrategy implements - ApplicationContextAware { +public class ParentAwareNamingStrategy extends MetadataNamingStrategy + implements ApplicationContextAware { private ApplicationContext applicationContext; @@ -50,7 +50,8 @@ public class ParentAwareNamingStrategy extends MetadataNamingStrategy implements /** * @param ensureUniqueRuntimeObjectNames the ensureUniqueRuntimeObjectNames to set */ - public void setEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames) { + public void setEnsureUniqueRuntimeObjectNames( + boolean ensureUniqueRuntimeObjectNames) { this.ensureUniqueRuntimeObjectNames = ensureUniqueRuntimeObjectNames; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/BitronixJtaConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/BitronixJtaConfiguration.java index 4478d4aff3..99d45c1d8f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/BitronixJtaConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/BitronixJtaConfiguration.java @@ -100,7 +100,8 @@ class BitronixJtaConfiguration { } @Bean - public JtaTransactionManager transactionManager(TransactionManager transactionManager) { + public JtaTransactionManager transactionManager( + TransactionManager transactionManager) { return new JtaTransactionManager(transactionManager); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java index e25fd0ff49..a115407891 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java @@ -80,15 +80,16 @@ public class LiquibaseAutoConfiguration { @PostConstruct public void checkChangelogExists() { if (this.properties.isCheckChangeLogLocation()) { - Resource resource = this.resourceLoader.getResource(this.properties - .getChangeLog()); - Assert.state(resource.exists(), "Cannot find changelog location: " - + resource + " (please add changelog or check your Liquibase " - + "configuration)"); + Resource resource = this.resourceLoader + .getResource(this.properties.getChangeLog()); + Assert.state(resource.exists(), + "Cannot find changelog location: " + resource + + " (please add changelog or check your Liquibase " + + "configuration)"); } ServiceLocator serviceLocator = ServiceLocator.getInstance(); - serviceLocator.addPackageToScan(CommonsLoggingLiquibaseLogger.class - .getPackage().getName()); + serviceLocator.addPackageToScan( + CommonsLoggingLiquibaseLogger.class.getPackage().getName()); } @Bean @@ -120,8 +121,8 @@ public class LiquibaseAutoConfiguration { @Configuration @ConditionalOnClass(LocalContainerEntityManagerFactoryBean.class) @ConditionalOnBean(AbstractEntityManagerFactoryBean.class) - protected static class LiquibaseJpaDependencyConfiguration extends - EntityManagerFactoryDependsOnPostProcessor { + protected static class LiquibaseJpaDependencyConfiguration + extends EntityManagerFactoryDependsOnPostProcessor { public LiquibaseJpaDependencyConfiguration() { super("liquibase"); 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 e4b4272cd4..fbe7406ab3 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 @@ -53,8 +53,8 @@ import org.springframework.util.StringUtils; * @author Dave Syer * @author Phillip Webb */ -public class AutoConfigurationReportLoggingInitializer implements - ApplicationContextInitializer { +public class AutoConfigurationReportLoggingInitializer + implements ApplicationContextInitializer { private final Log logger = LogFactory.getLog(getClass()); @@ -68,20 +68,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); } } @@ -98,8 +100,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() @@ -109,8 +111,8 @@ public class AutoConfigurationReportLoggingInitializer implements + "debug logging (start with --debug)\n\n"); } if (this.logger.isDebugEnabled()) { - this.logger.debug(getLogMessage(this.report - .getConditionAndOutcomesBySource())); + this.logger.debug( + getLogMessage(this.report.getConditionAndOutcomesBySource())); } } } @@ -171,8 +173,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/mobile/DeviceDelegatingViewResolverAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java index f1a0719331..f89b847234 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java @@ -115,8 +115,8 @@ public class DeviceDelegatingViewResolverAutoConfiguration { @EnableConfigurationProperties(DeviceDelegatingViewResolverProperties.class) @ConditionalOnMissingBean(name = "thymeleafViewResolver") @ConditionalOnBean(InternalResourceViewResolver.class) - protected static class InternalResourceViewResolverDelegateConfiguration extends - AbstractDelegateConfiguration { + protected static class InternalResourceViewResolverDelegateConfiguration + extends AbstractDelegateConfiguration { @Autowired private InternalResourceViewResolver viewResolver; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java index b51132a9c1..5d41a1a433 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java @@ -48,7 +48,8 @@ public class DeviceResolverAutoConfiguration { @Configuration @ConditionalOnWebApplication - protected static class DeviceResolverMvcConfiguration extends WebMvcConfigurerAdapter { + protected static class DeviceResolverMvcConfiguration + extends WebMvcConfigurerAdapter { @Autowired private DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java index 33f98ad3bf..9d307082b3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java @@ -52,7 +52,8 @@ public class SitePreferenceAutoConfiguration { @Configuration @ConditionalOnWebApplication - protected static class SitePreferenceMvcConfiguration extends WebMvcConfigurerAdapter { + protected static class SitePreferenceMvcConfiguration + extends WebMvcConfigurerAdapter { @Autowired private SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfiguration.java index 1bfa7127ef..bda8a5ef58 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfiguration.java @@ -119,8 +119,8 @@ public class MongoDataAutoConfiguration { MappingMongoConverter mappingConverter = new MappingMongoConverter(dbRefResolver, context); try { - mappingConverter.setCustomConversions(beanFactory - .getBean(CustomConversions.class)); + mappingConverter + .setCustomConversions(beanFactory.getBean(CustomConversions.class)); } catch (NoSuchBeanDefinitionException ex) { // Ignore @@ -172,8 +172,9 @@ public class MongoDataAutoConfiguration { @ConditionalOnMissingBean public GridFsTemplate gridFsTemplate(MongoDbFactory mongoDbFactory, MongoTemplate mongoTemplate) { - return new GridFsTemplate(new GridFsMongoDbFactory(mongoDbFactory, - this.properties), mongoTemplate.getConverter()); + return new GridFsTemplate( + new GridFsMongoDbFactory(mongoDbFactory, this.properties), + mongoTemplate.getConverter()); } /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java index fb63094b0b..a958ec53d5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java @@ -171,8 +171,8 @@ public class MongoProperties { } List credentials = null; if (hasCustomCredentials()) { - String database = this.authenticationDatabase == null ? getMongoClientDatabase() - : this.authenticationDatabase; + String database = this.authenticationDatabase == null + ? getMongoClientDatabase() : this.authenticationDatabase; credentials = Arrays.asList(MongoCredential.createMongoCRCredential( this.username, database, this.password)); } @@ -212,8 +212,8 @@ public class MongoProperties { builder.socketFactory(options.getSocketFactory()); builder.socketKeepAlive(options.isSocketKeepAlive()); builder.socketTimeout(options.getSocketTimeout()); - builder.threadsAllowedToBlockForConnectionMultiplier(options - .getThreadsAllowedToBlockForConnectionMultiplier()); + builder.threadsAllowedToBlockForConnectionMultiplier( + options.getThreadsAllowedToBlockForConnectionMultiplier()); builder.writeConcern(options.getWriteConcern()); } return builder; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java index e2dadb570c..44b0cdcf46 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java @@ -36,8 +36,8 @@ import com.samskivert.mustache.Mustache.VariableFetcher; * @author Dave Syer * @since 1.2.2 */ -public class MustacheEnvironmentCollector extends DefaultCollector implements - EnvironmentAware { +public class MustacheEnvironmentCollector extends DefaultCollector + implements EnvironmentAware { private ConfigurableEnvironment environment; @@ -51,8 +51,8 @@ public class MustacheEnvironmentCollector extends DefaultCollector implements public void setEnvironment(Environment environment) { this.environment = (ConfigurableEnvironment) environment; this.target = new HashMap(); - new RelaxedDataBinder(this.target).bind(new PropertySourcesPropertyValues( - this.environment.getPropertySources())); + new RelaxedDataBinder(this.target).bind( + new PropertySourcesPropertyValues(this.environment.getPropertySources())); this.propertyResolver = new RelaxedPropertyResolver(environment); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java index abab377371..fc55308638 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java @@ -38,8 +38,8 @@ import com.samskivert.mustache.Mustache.TemplateLoader; * @see Mustache * @see Resource */ -public class MustacheResourceTemplateLoader implements TemplateLoader, - ResourceLoaderAware { +public class MustacheResourceTemplateLoader + implements TemplateLoader, ResourceLoaderAware { private String prefix = ""; @@ -75,8 +75,9 @@ public class MustacheResourceTemplateLoader implements TemplateLoader, @Override public Reader getTemplate(String name) throws Exception { - return new InputStreamReader(this.resourceLoader.getResource( - this.prefix + name + this.suffix).getInputStream(), this.charSet); + return new InputStreamReader(this.resourceLoader + .getResource(this.prefix + name + this.suffix).getInputStream(), + this.charSet); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheTemplateAvailabilityProvider.java index fd325e0f7b..6f16594f9d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheTemplateAvailabilityProvider.java @@ -30,7 +30,8 @@ import org.springframework.util.ClassUtils; * @author Dave Syer * @since 1.2.2 */ -public class MustacheTemplateAvailabilityProvider implements TemplateAvailabilityProvider { +public class MustacheTemplateAvailabilityProvider + implements TemplateAvailabilityProvider { @Override public boolean isTemplateAvailable(String view, Environment environment, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewResolver.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewResolver.java index da4a705ee4..5e8605c903 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewResolver.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewResolver.java @@ -84,8 +84,8 @@ public class MustacheViewResolver extends UrlBasedViewResolver { } private Resource resolveFromLocale(String viewName, String locale) { - Resource resource = getApplicationContext().getResource( - getPrefix() + viewName + locale + getSuffix()); + Resource resource = getApplicationContext() + .getResource(getPrefix() + viewName + locale + getSuffix()); if (resource == null || !resource.exists()) { if (locale.isEmpty()) { return null; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java index 3db3f0a1f0..f8768a9262 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java @@ -66,8 +66,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor { } if (bean instanceof EntityManagerFactory && this.dataSource != null && isInitializingDatabase()) { - this.applicationContext.publishEvent(new DataSourceInitializedEvent( - this.dataSource)); + this.applicationContext + .publishEvent(new DataSourceInitializedEvent(this.dataSource)); } return bean; } 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 ddc91673b5..edbaf661dc 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 @@ -163,14 +163,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); @@ -180,8 +180,8 @@ public class EntityManagerFactoryBuilder { } entityManagerFactoryBean.setPackagesToScan(this.packagesToScan); - entityManagerFactoryBean.getJpaPropertyMap().putAll( - EntityManagerFactoryBuilder.this.properties.getProperties()); + entityManagerFactoryBean.getJpaPropertyMap() + .putAll(EntityManagerFactoryBuilder.this.properties.getProperties()); entityManagerFactoryBean.getJpaPropertyMap().putAll(this.properties); if (EntityManagerFactoryBuilder.this.callback != null) { EntityManagerFactoryBuilder.this.callback diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java index ca6b64f8bc..35187b6be5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java @@ -128,8 +128,9 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration { } private boolean runningOnWebSphere() { - return ClassUtils.isPresent("com.ibm.websphere.jtaextensions." - + "ExtendedJTATransaction", getClass().getClassLoader()); + return ClassUtils.isPresent( + "com.ibm.websphere.jtaextensions." + "ExtendedJTATransaction", + getClass().getClassLoader()); } private void configureWebSphereTransactionPlatform( @@ -144,8 +145,8 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration { private void configureSpringJtaPlatform(Map vendorProperties, JtaTransactionManager jtaTransactionManager) { try { - vendorProperties.put(JTA_PLATFORM, new SpringJtaPlatform( - jtaTransactionManager)); + vendorProperties.put(JTA_PLATFORM, + new SpringJtaPlatform(jtaTransactionManager)); } catch (LinkageError ex) { // NoClassDefFoundError can happen if Hibernate 4.2 is used and some diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java index 72d479f497..6b42b561f3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java @@ -171,7 +171,8 @@ public class JpaProperties { Map result = new HashMap(existing); if (!isAlreadyProvided(existing, "ejb.naming_strategy") && this.namingStrategy != null) { - result.put("hibernate.ejb.naming_strategy", this.namingStrategy.getName()); + result.put("hibernate.ejb.naming_strategy", + this.namingStrategy.getName()); } else if (this.namingStrategy == null) { result.put("hibernate.ejb.naming_strategy", DEFAULT_NAMING_STRATEGY); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.java index b0d64fbf35..538507438c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.java @@ -110,8 +110,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; @@ -124,8 +124,8 @@ public class RedisAutoConfiguration { */ @Configuration @ConditionalOnMissingClass(name = "org.apache.commons.pool2.impl.GenericObjectPool") - protected static class RedisConnectionConfiguration extends - AbstractRedisConfiguration { + protected static class RedisConnectionConfiguration + extends AbstractRedisConfiguration { @Bean @ConditionalOnMissingBean @@ -141,8 +141,8 @@ public class RedisAutoConfiguration { */ @Configuration @ConditionalOnClass(GenericObjectPool.class) - protected static class RedisPooledConnectionConfiguration extends - AbstractRedisConfiguration { + protected static class RedisPooledConnectionConfiguration + extends AbstractRedisConfiguration { @Bean @ConditionalOnMissingBean @@ -180,7 +180,7 @@ public class RedisAutoConfiguration { @ConditionalOnMissingBean(name = "redisTemplate") public RedisOperations redisTemplate( RedisConnectionFactory redisConnectionFactory) - throws UnknownHostException { + throws UnknownHostException { RedisTemplate template = new RedisTemplate(); template.setConnectionFactory(redisConnectionFactory); return template; @@ -190,7 +190,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/security/AuthenticationManagerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java index ebaa9d55cf..b7239f84d1 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 @@ -81,7 +81,8 @@ public class AuthenticationManagerConfiguration { @Bean public static SpringBootAuthenticationConfigurerAdapter springBootAuthenticationConfigurerAdapter( - SecurityProperties securityProperties, List dependencies) { + SecurityProperties securityProperties, + List dependencies) { return new SpringBootAuthenticationConfigurerAdapter(securityProperties); } @@ -97,21 +98,21 @@ public class AuthenticationManagerConfiguration { * {@link GlobalAuthenticationConfigurerAdapter#init(AuthenticationManagerBuilder)} * exists that adds a {@link SecurityConfigurer} to the * {@link AuthenticationManagerBuilder}. - *
  • - * {@link AuthenticationManagerConfiguration#init(AuthenticationManagerBuilder)} adds - * {@link SpringBootAuthenticationConfigurerAdapter} so it is after the + *
  • {@link AuthenticationManagerConfiguration#init(AuthenticationManagerBuilder)} + * adds {@link SpringBootAuthenticationConfigurerAdapter} so it is after the * {@link SecurityConfigurer} in the first step.
  • *
  • We then can default an {@link AuthenticationProvider} if necessary. Note we can * only invoke the * {@link AuthenticationManagerBuilder#authenticationProvider(AuthenticationProvider)} * method since all other methods add a {@link SecurityConfigurer} which is not * allowed in the configure stage. It is not allowed because we guarantee all init - * methods are invoked before configure, which cannot be guaranteed at this point.
  • + * methods are invoked before configure, which cannot be guaranteed at this point. + * *
*/ @Order(Ordered.LOWEST_PRECEDENCE - 100) - private static class SpringBootAuthenticationConfigurerAdapter extends - GlobalAuthenticationConfigurerAdapter { + private static class SpringBootAuthenticationConfigurerAdapter + extends GlobalAuthenticationConfigurerAdapter { private final SecurityProperties securityProperties; @@ -150,8 +151,8 @@ public class AuthenticationManagerConfiguration { * {@link DefaultInMemoryUserDetailsManagerConfigurer} will default the value. * */ - private static class DefaultInMemoryUserDetailsManagerConfigurer extends - InMemoryUserDetailsManagerConfigurer { + private static class DefaultInMemoryUserDetailsManagerConfigurer + extends InMemoryUserDetailsManagerConfigurer { private final SecurityProperties securityProperties; @@ -171,8 +172,8 @@ public class AuthenticationManagerConfiguration { + "\n"); } Set roles = new LinkedHashSet(user.getRole()); - withUser(user.getName()).password(user.getPassword()).roles( - roles.toArray(new String[roles.size()])); + withUser(user.getName()).password(user.getPassword()) + .roles(roles.toArray(new String[roles.size()])); setField(auth, "defaultUserDetailsService", getUserDetailsService()); super.configure(auth); } @@ -195,8 +196,8 @@ public class AuthenticationManagerConfiguration { * into the {@link AuthenticationManager}. */ @Component - protected static class AuthenticationManagerConfigurationListener implements - SmartInitializingSingleton { + protected static class AuthenticationManagerConfigurationListener + implements SmartInitializingSingleton { @Autowired private AuthenticationEventPublisher eventPublisher; @@ -207,8 +208,8 @@ public class AuthenticationManagerConfiguration { @Override public void afterSingletonsInstantiated() { try { - configureAuthenticationManager(this.context - .getBean(AuthenticationManager.class)); + configureAuthenticationManager( + this.context.getBean(AuthenticationManager.class)); } catch (NoSuchBeanDefinitionException ex) { // Ignore diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/BootGlobalAuthenticationConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/BootGlobalAuthenticationConfiguration.java index 32706afba2..37d2e6f87b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/BootGlobalAuthenticationConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/BootGlobalAuthenticationConfiguration.java @@ -56,8 +56,8 @@ public class BootGlobalAuthenticationConfiguration { return new BootGlobalAuthenticationConfigurationAdapter(context); } - private static class BootGlobalAuthenticationConfigurationAdapter extends - GlobalAuthenticationConfigurerAdapter { + private static class BootGlobalAuthenticationConfigurationAdapter + extends GlobalAuthenticationConfigurerAdapter { private static Log logger = LogFactory .getLog(BootGlobalAuthenticationConfiguration.class); 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 fcbbf0301c..b5870f622b 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 @@ -39,7 +39,8 @@ public class SecurityProperties implements SecurityPrerequisite { * useful place to put user-defined access rules if you want to override the default * access rules. */ - public static final int ACCESS_OVERRIDE_ORDER = SecurityProperties.BASIC_AUTH_ORDER - 2; + public static final int ACCESS_OVERRIDE_ORDER = SecurityProperties.BASIC_AUTH_ORDER + - 2; /** * Order applied to the WebSecurityConfigurerAdapter that is used to configure basic diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java index 8081866b90..74cbc11d80 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java @@ -148,8 +148,8 @@ public class SpringBootWebSecurityConfiguration { // Get the ignored paths in early @Order(SecurityProperties.IGNORED_ORDER) - private static class IgnoredPathsWebSecurityConfigurerAdapter implements - WebSecurityConfigurer { + private static class IgnoredPathsWebSecurityConfigurerAdapter + implements WebSecurityConfigurer { @Autowired(required = false) private ErrorController errorController; @@ -212,8 +212,8 @@ public class SpringBootWebSecurityConfiguration { @Configuration @ConditionalOnProperty(prefix = "security.basic", name = "enabled", havingValue = "false") @Order(SecurityProperties.BASIC_AUTH_ORDER) - protected static class ApplicationNoWebSecurityConfigurerAdapter extends - WebSecurityConfigurerAdapter { + protected static class ApplicationNoWebSecurityConfigurerAdapter + extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.requestMatcher(new RequestMatcher() { @@ -228,8 +228,8 @@ public class SpringBootWebSecurityConfiguration { @Configuration @ConditionalOnProperty(prefix = "security.basic", name = "enabled", matchIfMissing = true) @Order(SecurityProperties.BASIC_AUTH_ORDER) - protected static class ApplicationWebSecurityConfigurerAdapter extends - WebSecurityConfigurerAdapter { + protected static class ApplicationWebSecurityConfigurerAdapter + extends WebSecurityConfigurerAdapter { @Autowired private SecurityProperties security; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java index a46a2a80ec..0d2d5d9240 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java @@ -71,7 +71,8 @@ public class SocialWebAutoConfiguration { @Configuration @EnableSocial @ConditionalOnWebApplication - protected static class SocialAutoConfigurationAdapter extends SocialConfigurerAdapter { + protected static class SocialAutoConfigurationAdapter + extends SocialConfigurerAdapter { @Autowired(required = false) private List> connectInterceptors; @@ -85,7 +86,8 @@ public class SocialWebAutoConfiguration { @Bean @ConditionalOnMissingBean(ConnectController.class) public ConnectController connectController( - ConnectionFactoryLocator factoryLocator, ConnectionRepository repository) { + ConnectionFactoryLocator factoryLocator, + ConnectionRepository repository) { ConnectController controller = new ConnectController(factoryLocator, repository); if (!CollectionUtils.isEmpty(this.connectInterceptors)) { @@ -143,8 +145,8 @@ public class SocialWebAutoConfiguration { @EnableSocial @ConditionalOnWebApplication @ConditionalOnClass(SecurityContextHolder.class) - protected static class AuthenticationUserIdSourceConfig extends - SocialConfigurerAdapter { + protected static class AuthenticationUserIdSourceConfig + extends SocialConfigurerAdapter { @Override public UserIdSource getUserIdSource() { @@ -171,8 +173,8 @@ public class SocialWebAutoConfiguration { public String getUserId() { SecurityContext context = SecurityContextHolder.getContext(); Authentication authentication = context.getAuthentication(); - Assert.state(authentication != null, "Unable to get a " - + "ConnectionRepository: no user signed in"); + Assert.state(authentication != null, + "Unable to get a " + "ConnectionRepository: no user signed in"); return authentication.getName(); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java index 0cca01c440..6539fc5c36 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java @@ -28,8 +28,8 @@ import org.springframework.web.servlet.view.AbstractTemplateViewResolver; * @author Andy Wilkinson * @since 1.1.0 */ -public abstract class AbstractTemplateViewResolverProperties extends - AbstractViewResolverProperties { +public abstract class AbstractTemplateViewResolverProperties + extends AbstractViewResolverProperties { /** * Prefix that gets prepended to view names when building a URL. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java index defb3cb4af..f042e99e2c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java @@ -92,9 +92,8 @@ public abstract class AbstractViewResolverProperties { } public String getContentType() { - return this.contentType - + (this.contentType.contains(";charset=") ? "" : ";charset=" - + this.charset); + return this.contentType + (this.contentType.contains(";charset=") ? "" + : ";charset=" + this.charset); } public void setContentType(String contentType) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProvider.java index 54c7a0d4fc..63417b71da 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProvider.java @@ -30,8 +30,8 @@ import org.springframework.util.ClassUtils; * @author Andy Wilkinson * @since 1.1.0 */ -public class ThymeleafTemplateAvailabilityProvider implements - TemplateAvailabilityProvider { +public class ThymeleafTemplateAvailabilityProvider + implements TemplateAvailabilityProvider { @Override public boolean isTemplateAvailable(String view, Environment environment, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java index 2e0d4a32ef..dba38f3588 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java @@ -86,7 +86,8 @@ public class VelocityAutoConfiguration { factory.setResourceLoaderPath(this.properties.getResourceLoaderPath()); factory.setPreferFileSystemAccess(this.properties.isPreferFileSystemAccess()); Properties velocityProperties = new Properties(); - velocityProperties.setProperty("input.encoding", this.properties.getCharset()); + velocityProperties.setProperty("input.encoding", + this.properties.getCharset()); velocityProperties.putAll(this.properties.getProperties()); factory.setVelocityProperties(velocityProperties); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java index 904783c7c9..526949e68d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java @@ -30,7 +30,8 @@ import org.springframework.util.ClassUtils; * @author Andy Wilkinson * @since 1.1.0 */ -public class VelocityTemplateAvailabilityProvider implements TemplateAvailabilityProvider { +public class VelocityTemplateAvailabilityProvider + implements TemplateAvailabilityProvider { @Override public boolean isTemplateAvailable(String view, Environment environment, 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 ab7a812106..e6fb091398 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 @@ -68,7 +68,8 @@ public class BasicErrorController implements ErrorController { @RequestMapping(value = "${error.path:/error}") @ResponseBody public ResponseEntity> error(HttpServletRequest request) { - Map body = getErrorAttributes(request, getTraceParameter(request)); + Map body = getErrorAttributes(request, + getTraceParameter(request)); HttpStatus status = getStatus(request); return new ResponseEntity>(body, status); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java index c6d3a35ef9..a291bff380 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java @@ -56,8 +56,8 @@ import org.springframework.web.servlet.ModelAndView; * @see ErrorAttributes */ @Order(Ordered.HIGHEST_PRECEDENCE) -public class DefaultErrorAttributes implements ErrorAttributes, HandlerExceptionResolver, - Ordered { +public class DefaultErrorAttributes + implements ErrorAttributes, HandlerExceptionResolver, Ordered { private static final String ERROR_ATTRIBUTE = DefaultErrorAttributes.class.getName() + ".ERROR"; 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 376c729c94..a337d77446 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 @@ -125,8 +125,8 @@ public class DispatcherServletAutoConfiguration { private static ConditionOutcome checkServlets( ConfigurableListableBeanFactory beanFactory) { - List servlets = Arrays.asList(beanFactory.getBeanNamesForType( - DispatcherServlet.class, false, false)); + List servlets = Arrays.asList( + beanFactory.getBeanNamesForType(DispatcherServlet.class, false, false)); boolean containsDispatcherBean = beanFactory .containsBean(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME); if (servlets.isEmpty()) { @@ -154,8 +154,8 @@ public class DispatcherServletAutoConfiguration { private static 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); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java index 17b3b2d99a..24753f7056 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java @@ -83,7 +83,8 @@ public class EmbeddedServletContainerAutoConfiguration { * Nested configuration if Jetty is being used. */ @Configuration - @ConditionalOnClass({ Servlet.class, Server.class, Loader.class, WebAppContext.class }) + @ConditionalOnClass({ Servlet.class, Server.class, Loader.class, + WebAppContext.class }) @ConditionalOnMissingBean(value = EmbeddedServletContainerFactory.class, search = SearchStrategy.CURRENT) public static class EmbeddedJetty { 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 6c1456689c..e917276499 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 @@ -70,8 +70,8 @@ import org.springframework.web.util.HtmlUtils; // available @AutoConfigureBefore(WebMvcAutoConfiguration.class) @Configuration -public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustomizer, - Ordered { +public class ErrorMvcAutoConfiguration + implements EmbeddedServletContainerCustomizer, Ordered { @Value("${error.path:/error}") private String errorPath = "/error"; @@ -98,8 +98,8 @@ public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustom @Override public void customize(ConfigurableEmbeddedServletContainer container) { - container.addErrorPages(new ErrorPage(this.properties.getServletPrefix() - + this.errorPath)); + container.addErrorPages( + new ErrorPage(this.properties.getServletPrefix() + this.errorPath)); } @Configuration diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GzipFilterAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GzipFilterAutoConfiguration.java index 9fe3eb0a4f..663f0dce41 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GzipFilterAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GzipFilterAutoConfiguration.java @@ -44,7 +44,8 @@ public class GzipFilterAutoConfiguration { @Bean @ConditionalOnProperty(prefix = "spring.http.gzip", name = "enabled", matchIfMissing = true) public FilterRegistrationBean gzipFilter() { - FilterRegistrationBean registration = new FilterRegistrationBean(new GzipFilter()); + FilterRegistrationBean registration = new FilterRegistrationBean( + new GzipFilter()); registration.addUrlPatterns("/*"); registration.setInitParameters(this.properties.getAsInitParameters()); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMapperProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMapperProperties.java index a428202383..c929de20a9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMapperProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMapperProperties.java @@ -70,8 +70,9 @@ public class HttpMapperProperties { private String getDeprecationMessage(String property, SerializationFeature alternativeFeature) { - return String.format("%s is deprecated. If you are using Jackson," - + " spring.jackson.serialization.%s=true should be used instead.", + return String.format( + "%s is deprecated. If you are using Jackson," + + " spring.jackson.serialization.%s=true should be used instead.", property, alternativeFeature.name()); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java index 240e398f3d..a2b62c5602 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java @@ -52,6 +52,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp public class HttpMessageConverters implements Iterable> { private static final List> NON_REPLACING_CONVERTERS; + static { List> nonReplacingConverters = new ArrayList>(); addClassIfExists(nonReplacingConverters, "org.springframework.hateoas.mvc." @@ -81,7 +82,8 @@ public class HttpMessageConverters implements Iterable> * default converter is found) The {@link #postProcessConverters(List)} method can be * used for further converter manipulation. */ - public HttpMessageConverters(Collection> additionalConverters) { + public HttpMessageConverters( + Collection> additionalConverters) { this(true, additionalConverters); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java index eba3f97821..4471423779 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java @@ -30,13 +30,11 @@ import org.springframework.util.StringUtils; * be obtained. *
  • {@literal multipart.maxFileSize} specifies the maximum size permitted for uploaded * files. The default is 1Mb.
  • - *
  • - * {@literal multipart.maxRequestSize} specifies the maximum size allowed for + *
  • {@literal multipart.maxRequestSize} specifies the maximum size allowed for * {@literal multipart/form-data} requests. The default is 10Mb
  • - *
  • - * {@literal multipart.fileSizeThreshold} specifies the size threshold after which files - * will be written to disk. Default is 0, which means that the file will be written to - * disk immediately.
  • + *
  • {@literal multipart.fileSizeThreshold} specifies the size threshold after which + * files will be written to disk. Default is 0, which means that the file will be written + * to disk immediately.
  • * *

    * These properties are ultimately passed through 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 4c827d890a..3fbf9fd021 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 @@ -445,7 +445,8 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord factory.addContextCustomizers(new TomcatContextCustomizer() { @Override public void customize(Context context) { - context.setBackgroundProcessorDelay(Tomcat.this.backgroundProcessorDelay); + context.setBackgroundProcessorDelay( + Tomcat.this.backgroundProcessorDelay); } }); @@ -498,8 +499,10 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord if (handler instanceof AbstractHttp11Protocol) { @SuppressWarnings("rawtypes") AbstractHttp11Protocol protocol = (AbstractHttp11Protocol) handler; - protocol.setCompression(coerceCompression(Tomcat.this.compression)); - protocol.setCompressableMimeTypes(Tomcat.this.compressableMimeTypes); + protocol.setCompression( + coerceCompression(Tomcat.this.compression)); + protocol.setCompressableMimeTypes( + Tomcat.this.compressableMimeTypes); } } 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 51a98ab004..5bc441fc15 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 @@ -41,8 +41,8 @@ import org.springframework.util.StringUtils; @Configuration @EnableConfigurationProperties @ConditionalOnWebApplication -public class ServerPropertiesAutoConfiguration implements ApplicationContextAware, - EmbeddedServletContainerCustomizer, Ordered { +public class ServerPropertiesAutoConfiguration + implements ApplicationContextAware, EmbeddedServletContainerCustomizer, Ordered { private ApplicationContext applicationContext; @@ -69,8 +69,7 @@ public class ServerPropertiesAutoConfiguration implements ApplicationContextAwar // a single bean String[] serverPropertiesBeans = this.applicationContext .getBeanNamesForType(ServerProperties.class); - Assert.state( - serverPropertiesBeans.length == 1, + 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 d606495823..f512d869f6 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 @@ -104,6 +104,7 @@ public class WebMvcAutoConfiguration { "classpath:/static/", "classpath:/public/" }; private static final String[] RESOURCE_LOCATIONS; + static { RESOURCE_LOCATIONS = new String[CLASSPATH_RESOURCE_LOCATIONS.length + SERVLET_RESOURCE_LOCATIONS.length]; @@ -114,6 +115,7 @@ public class WebMvcAutoConfiguration { } private static final String[] STATIC_INDEX_HTML_RESOURCES; + static { STATIC_INDEX_HTML_RESOURCES = new String[RESOURCE_LOCATIONS.length]; for (int i = 0; i < STATIC_INDEX_HTML_RESOURCES.length; i++) { @@ -194,8 +196,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); @@ -220,8 +222,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; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/JettyWebSocketContainerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/JettyWebSocketContainerCustomizer.java index 64c0224115..e8c648458d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/JettyWebSocketContainerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/JettyWebSocketContainerCustomizer.java @@ -29,8 +29,8 @@ import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletConta * @author Andy Wilkinson * @since 1.2.0 */ -public class JettyWebSocketContainerCustomizer extends - WebSocketContainerCustomizer { +public class JettyWebSocketContainerCustomizer + extends WebSocketContainerCustomizer { @Override protected void doCustomize(JettyEmbeddedServletContainerFactory container) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/TomcatWebSocketContainerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/TomcatWebSocketContainerCustomizer.java index c29762c3f8..1829acbf7e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/TomcatWebSocketContainerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/TomcatWebSocketContainerCustomizer.java @@ -33,8 +33,8 @@ import org.springframework.util.ReflectionUtils; * @author Andy Wilkinson * @since 1.2.0 */ -public class TomcatWebSocketContainerCustomizer extends - WebSocketContainerCustomizer { +public class TomcatWebSocketContainerCustomizer + extends WebSocketContainerCustomizer { private static final String TOMCAT_7_LISTENER_TYPE = "org.apache.catalina.deploy.ApplicationListener"; @@ -79,8 +79,8 @@ public class TomcatWebSocketContainerCustomizer extends } else { - Constructor constructor = ClassUtils.getConstructorIfAvailable( - listenerType, String.class, boolean.class); + Constructor constructor = ClassUtils + .getConstructorIfAvailable(listenerType, String.class, boolean.class); Object instance = BeanUtils.instantiateClass(constructor, WS_LISTENER, false); ReflectionUtils.invokeMethod(ClassUtils.getMethod(contextClass, "addApplicationListener", listenerType), context, instance); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java index 35eba0351e..04a4ca86b1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java @@ -29,8 +29,8 @@ import io.undertow.websockets.jsr.WebSocketDeploymentInfo; * @author Phillip Webb * @since 1.2.0 */ -public class UndertowWebSocketContainerCustomizer extends - WebSocketContainerCustomizer { +public class UndertowWebSocketContainerCustomizer + extends WebSocketContainerCustomizer { @Override protected void doCustomize(UndertowEmbeddedServletContainerFactory container) { @@ -38,8 +38,8 @@ public class UndertowWebSocketContainerCustomizer extends container.addDeploymentInfoCustomizers(customizer); } - private static class WebsocketDeploymentInfoCustomizer implements - UndertowDeploymentInfoCustomizer { + private static class WebsocketDeploymentInfoCustomizer + implements UndertowDeploymentInfoCustomizer { @Override public void customize(DeploymentInfo deploymentInfo) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java index 1d58c448a3..ab1001184c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java @@ -59,8 +59,8 @@ public class AutoConfigurationPackagesTests { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( EmptyConfig.class); this.thrown.expect(IllegalStateException.class); - this.thrown - .expectMessage("Unable to retrieve @EnableAutoConfiguration base packages"); + this.thrown.expectMessage( + "Unable to retrieve @EnableAutoConfiguration base packages"); AutoConfigurationPackages.get(context.getBeanFactory()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java index 10595f4733..6e5cbbd311 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java @@ -66,8 +66,8 @@ public class AutoConfigurationSorterTests { @Test public void byOrderAnnotation() throws Exception { - List actual = this.sorter.getInPriorityOrder(Arrays.asList(LOWEST, - HIGHEST)); + List actual = this.sorter + .getInPriorityOrder(Arrays.asList(LOWEST, HIGHEST)); assertThat(actual, nameMatcher(HIGHEST, LOWEST)); } @@ -98,8 +98,8 @@ public class AutoConfigurationSorterTests { @Test public void byAutoConfigureMixedBeforeAndAfterWithClassNames() throws Exception { - List actual = this.sorter.getInPriorityOrder(Arrays.asList(A2, B, C, W2, - X)); + List actual = this.sorter + .getInPriorityOrder(Arrays.asList(A2, B, C, W2, X)); assertThat(actual, nameMatcher(C, W2, B, A2, X)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigureConfigurationClassTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigureConfigurationClassTests.java index ffb50bdb08..41c34297fe 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigureConfigurationClassTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigureConfigurationClassTests.java @@ -22,6 +22,7 @@ import org.springframework.boot.test.AbstractConfigurationClassTests; * Tests for the autoconfigure module's @Configuration classes * @author Andy Wilkinson */ -public class AutoConfigureConfigurationClassTests extends AbstractConfigurationClassTests { +public class AutoConfigureConfigurationClassTests + extends AbstractConfigurationClassTests { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationIntegrationTests.java index 2a1829e0af..2c4f1bffec 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationIntegrationTests.java @@ -36,7 +36,8 @@ import static org.junit.Assert.assertEquals; * @author Dave Syer */ @SpringApplicationConfiguration(classes = { Config.class, - MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + MessageSourceAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) @RunWith(SpringJUnit4ClassRunner.class) @IntegrationTest("spring.messages.basename:test/messages") public class MessageSourceAutoConfigurationIntegrationTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationProfileTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationProfileTests.java index 7201ed5f21..37ae15dee0 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationProfileTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationProfileTests.java @@ -36,7 +36,8 @@ import static org.junit.Assert.assertEquals; * @author Dave Syer */ @SpringApplicationConfiguration(classes = { Config.class, - MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + MessageSourceAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) @RunWith(SpringJUnit4ClassRunner.class) @ActiveProfiles("switch-messages") public class MessageSourceAutoConfigurationProfileTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfigurationTests.java index c823a805e8..61f522438f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfigurationTests.java @@ -80,8 +80,8 @@ public class PropertyPlaceholderAutoConfigurationTests { @Bean public static PropertySourcesPlaceholderConfigurer morePlaceholders() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); - configurer.setProperties(StringUtils.splitArrayElementsIntoProperties( - new String[] { "foo=spam" }, "=")); + configurer.setProperties(StringUtils + .splitArrayElementsIntoProperties(new String[] { "foo=spam" }, "=")); configurer.setLocalOverride(true); configurer.setOrder(0); return configurer; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/TestAutoConfigurationPackageRegistrar.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/TestAutoConfigurationPackageRegistrar.java index 3e5dcbe3d2..4c34a3a7d6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/TestAutoConfigurationPackageRegistrar.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/TestAutoConfigurationPackageRegistrar.java @@ -30,15 +30,15 @@ import org.springframework.util.ClassUtils; * @author Phillip Webb */ @Order(Ordered.HIGHEST_PRECEDENCE) -public class TestAutoConfigurationPackageRegistrar implements - ImportBeanDefinitionRegistrar { +public class TestAutoConfigurationPackageRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) { - AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(TestAutoConfigurationPackage.class.getName(), - true)); + AnnotationAttributes attributes = AnnotationAttributes + .fromMap(metadata.getAnnotationAttributes( + TestAutoConfigurationPackage.class.getName(), true)); AutoConfigurationPackages.register(registry, ClassUtils.getPackageName(attributes.getString("value"))); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index bd1cf77667..c6742e2d3d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -184,8 +184,10 @@ public class RabbitAutoConfigurationTests { public void enableRabbitAutomatically() throws Exception { load(NoEnableRabbitConfiguration.class); AnnotationConfigApplicationContext ctx = this.context; - ctx.getBean(RabbitListenerConfigUtils.RABBIT_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME); - ctx.getBean(RabbitListenerConfigUtils.RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME); + ctx.getBean( + RabbitListenerConfigUtils.RABBIT_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME); + ctx.getBean( + RabbitListenerConfigUtils.RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME); } private void load(Class config, String... environment) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java index 02c8e92eb2..86b12c3d7f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java @@ -99,8 +99,8 @@ public class BatchAutoConfigurationTests { @Test public void testNoDatabase() throws Exception { this.context = new AnnotationConfigApplicationContext(); - this.context.register(TestCustomConfiguration.class, - BatchAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + this.context.register(TestCustomConfiguration.class, BatchAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertNotNull(this.context.getBean(JobLauncher.class)); JobExplorer explorer = this.context.getBean(JobExplorer.class); @@ -128,8 +128,8 @@ public class BatchAutoConfigurationTests { this.context.refresh(); assertNotNull(this.context.getBean(JobLauncher.class)); this.context.getBean(JobLauncherCommandLineRunner.class).run(); - assertNotNull(this.context.getBean(JobRepository.class).getLastJobExecution( - "job", new JobParameters())); + assertNotNull(this.context.getBean(JobRepository.class).getLastJobExecution("job", + new JobParameters())); } @Test @@ -159,8 +159,8 @@ public class BatchAutoConfigurationTests { this.context.refresh(); assertNotNull(this.context.getBean(JobLauncher.class)); this.context.getBean(JobLauncherCommandLineRunner.class).run(); - assertNotNull(this.context.getBean(JobRepository.class).getLastJobExecution( - "discreteLocalJob", new JobParameters())); + assertNotNull(this.context.getBean(JobRepository.class) + .getLastJobExecution("discreteLocalJob", new JobParameters())); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java index 9442d06da4..1d3b91e85e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java @@ -87,7 +87,8 @@ public class JobLauncherCommandLineRunnerTests { }).build(); this.job = this.jobs.get("job").start(this.step).build(); this.jobExplorer = this.context.getBean(JobExplorer.class); - this.runner = new JobLauncherCommandLineRunner(this.jobLauncher, this.jobExplorer); + this.runner = new JobLauncherCommandLineRunner(this.jobLauncher, + this.jobExplorer); this.context.getBean(BatchConfiguration.class).clear(); } @@ -95,8 +96,8 @@ public class JobLauncherCommandLineRunnerTests { public void basicExecution() throws Exception { this.runner.execute(this.job, new JobParameters()); assertEquals(1, this.jobExplorer.getJobInstances("job", 0, 100).size()); - this.runner.execute(this.job, new JobParametersBuilder().addLong("id", 1L) - .toJobParameters()); + this.runner.execute(this.job, + new JobParametersBuilder().addLong("id", 1L).toJobParameters()); assertEquals(2, this.jobExplorer.getJobInstances("job", 0, 100).size()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java index 8a7ec303bd..b1f72afdf0 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java @@ -180,9 +180,8 @@ public class ConditionEvaluationReportTests { @Test @SuppressWarnings("resource") public void springBootConditionPopulatesReport() throws Exception { - ConditionEvaluationReport report = ConditionEvaluationReport - .get(new AnnotationConfigApplicationContext(Config.class) - .getBeanFactory()); + ConditionEvaluationReport report = ConditionEvaluationReport.get( + new AnnotationConfigApplicationContext(Config.class).getBeanFactory()); assertThat(report.getConditionAndOutcomesBySource().size(), not(equalTo(0))); } @@ -211,12 +210,12 @@ public class ConditionEvaluationReportTests { public void duplicateOutcomes() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( DuplicateConfig.class); - ConditionEvaluationReport report = ConditionEvaluationReport.get(context - .getBeanFactory()); + ConditionEvaluationReport report = ConditionEvaluationReport + .get(context.getBeanFactory()); String autoconfigKey = MultipartAutoConfiguration.class.getName(); - ConditionAndOutcomes outcomes = report.getConditionAndOutcomesBySource().get( - autoconfigKey); + ConditionAndOutcomes outcomes = report.getConditionAndOutcomesBySource() + .get(autoconfigKey); assertThat(outcomes, not(nullValue())); assertThat(getNumberOfOutcomes(outcomes), equalTo(2)); @@ -238,11 +237,12 @@ public class ConditionEvaluationReportTests { EnvironmentTestUtils.addEnvironment(context, "test.present=true"); context.register(NegativeOuterConfig.class); context.refresh(); - ConditionEvaluationReport report = ConditionEvaluationReport.get(context - .getBeanFactory()); + ConditionEvaluationReport report = ConditionEvaluationReport + .get(context.getBeanFactory()); Map sourceOutcomes = report .getConditionAndOutcomesBySource(); - assertThat(context.containsBean("negativeOuterPositiveInnerBean"), equalTo(false)); + assertThat(context.containsBean("negativeOuterPositiveInnerBean"), + equalTo(false)); String negativeConfig = NegativeOuterConfig.class.getName(); assertThat(sourceOutcomes.get(negativeConfig).isFullMatch(), equalTo(false)); String positiveConfig = NegativeOuterConfig.PositiveInnerConfig.class.getName(); @@ -288,8 +288,8 @@ public class ConditionEvaluationReportTests { } } - static class TestMatchCondition extends SpringBootCondition implements - ConfigurationCondition { + static class TestMatchCondition extends SpringBootCondition + implements ConfigurationCondition { private final ConfigurationPhase phase; private final boolean match; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java index 6ab321b2ff..d043954723 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java @@ -210,8 +210,8 @@ public class ConditionalOnBeanTests { } - protected static class WithPropertyPlaceholderClassNameRegistrar implements - ImportBeanDefinitionRegistrar { + protected static class WithPropertyPlaceholderClassNameRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java index e5c26b5b27..b8ddcb44a8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java @@ -73,16 +73,16 @@ public class ConditionalOnJavaTests { public void equalOrNewerMessage() throws Exception { ConditionOutcome outcome = this.condition.getMatchOutcome(Range.EQUAL_OR_NEWER, JavaVersion.SEVEN, JavaVersion.SIX); - assertThat(outcome.getMessage(), equalTo("Required JVM version " - + "1.6 or newer found 1.7")); + assertThat(outcome.getMessage(), + equalTo("Required JVM version " + "1.6 or newer found 1.7")); } @Test public void olderThanMessage() throws Exception { ConditionOutcome outcome = this.condition.getMatchOutcome(Range.OLDER_THAN, JavaVersion.SEVEN, JavaVersion.SIX); - assertThat(outcome.getMessage(), equalTo("Required JVM version " - + "older than 1.6 found 1.7")); + assertThat(outcome.getMessage(), + equalTo("Required JVM version " + "older than 1.6 found 1.7")); } private void testBounds(Range range, JavaVersion runningVersion, JavaVersion version, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java index c9d22f208d..df37c1fefd 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java @@ -271,8 +271,8 @@ public class ConditionalOnMissingBeanTests { protected static class NonspecificFactoryBeanClassAttributeConfiguration { } - protected static class NonspecificFactoryBeanClassAttributeRegistrar implements - ImportBeanDefinitionRegistrar { + protected static class NonspecificFactoryBeanClassAttributeRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata meta, @@ -293,8 +293,8 @@ public class ConditionalOnMissingBeanTests { protected static class NonspecificFactoryBeanStringAttributeConfiguration { } - protected static class NonspecificFactoryBeanStringAttributeRegistrar implements - ImportBeanDefinitionRegistrar { + protected static class NonspecificFactoryBeanStringAttributeRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata meta, @@ -302,9 +302,9 @@ public class ConditionalOnMissingBeanTests { BeanDefinitionBuilder builder = BeanDefinitionBuilder .genericBeanDefinition(NonspecificFactoryBean.class); builder.addConstructorArgValue("foo"); - builder.getBeanDefinition() - .setAttribute(OnBeanCondition.FACTORY_BEAN_OBJECT_TYPE, - ExampleBean.class.getName()); + builder.getBeanDefinition().setAttribute( + OnBeanCondition.FACTORY_BEAN_OBJECT_TYPE, + ExampleBean.class.getName()); registry.registerBeanDefinition("exampleBeanFactoryBean", builder.getBeanDefinition()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java index 89da1b27d7..c34e0dc198 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java @@ -94,7 +94,8 @@ public class ConditionalOnPropertyTests { @Test public void nonRelaxedName() throws Exception { - load(NonRelaxedPropertiesRequiredConfiguration.class, "theRelaxedProperty=value1"); + load(NonRelaxedPropertiesRequiredConfiguration.class, + "theRelaxedProperty=value1"); assertFalse(this.context.containsBean("foo")); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java index abf370c10b..e3b8ca3657 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java @@ -40,8 +40,8 @@ public class SpringBootConditionTests { @Test public void sensibleClassException() { this.thrown.expect(IllegalStateException.class); - this.thrown.expectMessage("Error processing condition on " - + ErrorOnClass.class.getName()); + this.thrown.expectMessage( + "Error processing condition on " + ErrorOnClass.class.getName()); new AnnotationConfigApplicationContext(ErrorOnClass.class); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java index c1fbdbd92d..a6446769a8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java @@ -66,8 +66,8 @@ public class JpaRepositoriesAutoConfigurationTests { public void testOverrideRepositoryConfiguration() throws Exception { prepareApplicationContext(CustomConfiguration.class); - assertNotNull(this.context - .getBean(org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository.class)); + assertNotNull(this.context.getBean( + org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository.class)); assertNotNull(this.context.getBean(PlatformTransactionManager.class)); assertNotNull(this.context.getBean(EntityManagerFactory.class)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java index 05211a891c..6ae3d2880d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java @@ -63,8 +63,8 @@ public class JpaWebAutoConfigurationTests { this.context.refresh(); assertNotNull(this.context.getBean(CityRepository.class)); assertNotNull(this.context.getBean(PageableHandlerMethodArgumentResolver.class)); - assertTrue(this.context.getBean(FormattingConversionService.class).canConvert( - Long.class, City.class)); + assertTrue(this.context.getBean(FormattingConversionService.class) + .canConvert(Long.class, City.class)); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java index e03c087027..6000a21b7d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java @@ -101,7 +101,8 @@ public class MixedMongoRepositoriesAutoConfigurationTests { } @Test - public void testJpaRepositoryConfigurationWithMongoOverlapDisabled() throws Exception { + public void testJpaRepositoryConfigurationWithMongoOverlapDisabled() + throws Exception { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.initialize:false", diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java index 64c5650a1e..4e56ac78c1 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java @@ -93,7 +93,8 @@ public class RepositoryRestMvcAutoConfigurationTests { @Test public void propertiesStillAppliedWithCustomBootConfig() { - load(TestConfigurationWithRestMvcBootConfig.class, "spring.data.rest.baseUri:foo"); + load(TestConfigurationWithRestMvcBootConfig.class, + "spring.data.rest.baseUri:foo"); assertNotNull(this.context.getBean(RepositoryRestMvcConfiguration.class)); RepositoryRestConfiguration bean = this.context .getBean(RepositoryRestConfiguration.class); 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 75cdec1ddd..6a21fb3953 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 @@ -76,7 +76,8 @@ public class FlywayAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "flyway.url:jdbc:hsqldb:mem:flywaytest", "flyway.user:sa"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); Flyway flyway = this.context.getBean(Flyway.class); assertNotNull(flyway.getDataSource()); } @@ -93,10 +94,11 @@ public class FlywayAutoConfigurationTests { @Test public void defaultFlyway() throws Exception { registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); Flyway flyway = this.context.getBean(Flyway.class); - assertEquals("[classpath:db/migration]", Arrays.asList(flyway.getLocations()) - .toString()); + assertEquals("[classpath:db/migration]", + Arrays.asList(flyway.getLocations()).toString()); } @Test @@ -104,7 +106,8 @@ public class FlywayAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "flyway.locations:classpath:db/changelog,classpath:db/migration"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); Flyway flyway = this.context.getBean(Flyway.class); assertEquals("[classpath:db/changelog, classpath:db/migration]", Arrays.asList(flyway.getLocations()).toString()); @@ -114,7 +117,8 @@ public class FlywayAutoConfigurationTests { public void overrideSchemas() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "flyway.schemas:public"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); Flyway flyway = this.context.getBean(Flyway.class); assertEquals("[public]", Arrays.asList(flyway.getSchemas()).toString()); } @@ -125,7 +129,8 @@ public class FlywayAutoConfigurationTests { "flyway.locations:file:no-such-dir"); this.thrown.expect(BeanCreationException.class); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); } @Test @@ -136,7 +141,8 @@ public class FlywayAutoConfigurationTests { this.thrown.expect(BeanCreationException.class); this.thrown.expectMessage("Cannot find migrations location in"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); } @Test @@ -145,7 +151,8 @@ public class FlywayAutoConfigurationTests { "flyway.locations:classpath:db/changelog,classpath:db/migration", "flyway.check-location:true"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, - FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); } private void registerAndRefresh(Class... annotatedClasses) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java index 366c6fb15f..ad992ec8f6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java @@ -129,7 +129,8 @@ public class FreeMarkerAutoConfigurationTests { @Test public void customTemplateLoaderPath() throws Exception { - registerAndRefreshContext("spring.freemarker.templateLoaderPath:classpath:/custom-templates/"); + registerAndRefreshContext( + "spring.freemarker.templateLoaderPath:classpath:/custom-templates/"); MockHttpServletResponse response = render("custom"); String result = response.getContentAsString(); assertThat(result, containsString("custom")); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java index 2a7401426d..5beda804b0 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java @@ -40,8 +40,8 @@ public class FreeMarkerTemplateAvailabilityProviderTests { @Test public void availabilityOfTemplateInDefaultLocation() { - assertTrue(this.provider.isTemplateAvailable("home", this.environment, getClass() - .getClassLoader(), this.resourceLoader)); + assertTrue(this.provider.isTemplateAvailable("home", this.environment, + getClass().getClassLoader(), this.resourceLoader)); } @Test 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 617cf70bc3..3f7b765b8e 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 @@ -132,7 +132,8 @@ public class GroovyTemplateAutoConfigurationTests { @Test public void customPrefix() throws Exception { - registerAndRefreshContext("spring.groovy.template.prefix:classpath:/templates/prefix/"); + registerAndRefreshContext( + "spring.groovy.template.prefix:classpath:/templates/prefix/"); MockHttpServletResponse response = render("prefixed"); String result = response.getContentAsString(); assertThat(result, containsString("prefixed")); @@ -148,7 +149,8 @@ public class GroovyTemplateAutoConfigurationTests { @Test public void customTemplateLoaderPath() throws Exception { - registerAndRefreshContext("spring.groovy.template.prefix:classpath:/custom-templates/"); + registerAndRefreshContext( + "spring.groovy.template.prefix:classpath:/custom-templates/"); MockHttpServletResponse response = render("custom"); String result = response.getContentAsString(); assertThat(result, containsString("custom")); @@ -168,14 +170,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/hateoas/HypermediaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java index 8c5655c9ef..939aba339d 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 @@ -91,8 +91,8 @@ public class HypermediaAutoConfigurationTests { this.context.refresh(); ObjectMapper objectMapper = this.context.getBean("_halObjectMapper", ObjectMapper.class); - assertTrue(objectMapper.getSerializationConfig().isEnabled( - SerializationFeature.INDENT_OUTPUT)); + assertTrue(objectMapper.getSerializationConfig() + .isEnabled(SerializationFeature.INDENT_OUTPUT)); } @Configuration 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 65da35b082..6142b6179b 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 @@ -99,9 +99,8 @@ public class JacksonAutoConfigurationTests { this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); @SuppressWarnings({ "unchecked", "unused" }) - ObjectMapper result = verify(mapper).registerModules( - (Iterable) argThat(hasItem(this.context.getBean("jacksonModule", - Module.class)))); + ObjectMapper result = verify(mapper).registerModules((Iterable) argThat( + hasItem(this.context.getBean("jacksonModule", Module.class)))); } @Test @@ -159,10 +158,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); DateTime dateTime = new DateTime(1988, 6, 25, 20, 30, DateTimeZone.UTC); @@ -196,9 +193,8 @@ public class JacksonAutoConfigurationTests { public void customPropertyNamingStrategyCamelCaseToLowerCaseWithUnderscores() 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); assertEquals("{\"property_name\":null}", mapper.writeValueAsString(new Bar())); @@ -227,10 +223,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); assertEquals("{\"property_name\":null}", mapper.writeValueAsString(new Bar())); @@ -244,8 +238,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 @@ -292,10 +286,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 @@ -306,10 +300,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 @@ -342,8 +336,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 @@ -354,8 +348,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 @@ -366,16 +360,16 @@ 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 @@ -385,8 +379,8 @@ public class JacksonAutoConfigurationTests { "http.mappers.json-pretty-print:true"); this.context.refresh(); ObjectMapper objectMapper = this.context.getBean(ObjectMapper.class); - assertTrue(objectMapper.getSerializationConfig().isEnabled( - SerializationFeature.INDENT_OUTPUT)); + assertTrue(objectMapper.getSerializationConfig() + .isEnabled(SerializationFeature.INDENT_OUTPUT)); } @Test @@ -396,16 +390,16 @@ public class JacksonAutoConfigurationTests { "http.mappers.json-sort-keys:true"); this.context.refresh(); ObjectMapper objectMapper = this.context.getBean(ObjectMapper.class); - assertTrue(objectMapper.getSerializationConfig().isEnabled( - SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS)); + assertTrue(objectMapper.getSerializationConfig() + .isEnabled(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS)); } @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)); @@ -441,8 +435,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/CommonsDataSourceConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDataSourceConfigurationTests.java index af1847fa48..1ef93937cd 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDataSourceConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDataSourceConfigurationTests.java @@ -54,15 +54,15 @@ public class CommonsDataSourceConfigurationTests { @Test public void testDataSourcePropertiesOverridden() throws Exception { this.context.register(CommonsDataSourceConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "url:jdbc:foo//bar/spam"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "url:jdbc:foo//bar/spam"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testWhileIdle:true"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnBorrow:true"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnReturn:true"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "timeBetweenEvictionRunsMillis:10000"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "minEvictableIdleTimeMillis:12345"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "timeBetweenEvictionRunsMillis:10000"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "minEvictableIdleTimeMillis:12345"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "maxWait:1234"); this.context.refresh(); BasicDataSource ds = this.context.getBean(BasicDataSource.class); 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 5d5660666e..f8c61290db 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 @@ -158,11 +158,9 @@ public class DataSourceAutoConfigurationTests { @Test public void testExplicitDriverClassClearsUserName() throws Exception { - EnvironmentTestUtils - .addEnvironment( - this.context, - "spring.datasource.driverClassName:org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfigurationTests$DatabaseDriver", - "spring.datasource.url:jdbc:foo://localhost"); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.datasource.driverClassName:org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfigurationTests$DatabaseDriver", + "spring.datasource.url:jdbc:foo://localhost"); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); @@ -221,19 +219,19 @@ public class DataSourceAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.driverClassName:org.hsqldb.jdbcDriver", "spring.datasource.url:jdbc:hsqldb:mem:testdb"); - this.context.setClassLoader(new URLClassLoader(new URL[0], getClass() - .getClassLoader()) { - @Override - protected Class loadClass(String name, boolean resolve) - throws ClassNotFoundException { - for (String hiddenPackage : hiddenPackages) { - if (name.startsWith(hiddenPackage)) { - throw new ClassNotFoundException(); + this.context.setClassLoader( + new URLClassLoader(new URL[0], getClass().getClassLoader()) { + @Override + protected Class loadClass(String name, boolean resolve) + throws ClassNotFoundException { + for (String hiddenPackage : hiddenPackages) { + if (name.startsWith(hiddenPackage)) { + throw new ClassNotFoundException(); + } + } + return super.loadClass(name, resolve); } - } - return super.loadClass(name, resolve); - } - }); + }); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java index 46261a89e3..0dd55cb994 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java @@ -107,16 +107,12 @@ public class DataSourceInitializerTests { public void testDataSourceInitializedWithExplicitScript() throws Exception { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - EnvironmentTestUtils - .addEnvironment( - this.context, - "spring.datasource.initialize:true", - "spring.datasource.schema:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "schema.sql"), - "spring.datasource.data:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "data.sql")); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.datasource.initialize:true", + "spring.datasource.schema:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "schema.sql"), + "spring.datasource.data:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "data.sql")); this.context.refresh(); DataSource dataSource = this.context.getBean(DataSource.class); assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource); @@ -128,19 +124,16 @@ public class DataSourceInitializerTests { @Test public void testDataSourceInitializedWithMultipleScripts() throws Exception { - EnvironmentTestUtils - .addEnvironment( - this.context, - "spring.datasource.initialize:true", - "spring.datasource.schema:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "schema.sql") - + "," - + ClassUtils.addResourcePathToPackagePath(getClass(), - "another.sql"), - "spring.datasource.data:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "data.sql")); + EnvironmentTestUtils.addEnvironment(this.context, + "spring.datasource.initialize:true", + "spring.datasource.schema:" + + ClassUtils.addResourcePathToPackagePath(getClass(), + "schema.sql") + + "," + + ClassUtils.addResourcePathToPackagePath(getClass(), + "another.sql"), + "spring.datasource.data:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "data.sql")); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); @@ -155,19 +148,17 @@ public class DataSourceInitializerTests { } @Test - public void testDataSourceInitializedWithExplicitSqlScriptEncoding() throws Exception { + public void testDataSourceInitializedWithExplicitSqlScriptEncoding() + throws Exception { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - EnvironmentTestUtils.addEnvironment( - this.context, + EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.initialize:true", "spring.datasource.sqlScriptEncoding:UTF-8", - "spring.datasource.schema:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "encoding-schema.sql"), - "spring.datasource.data:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "encoding-data.sql")); + "spring.datasource.schema:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "encoding-schema.sql"), + "spring.datasource.data:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "encoding-data.sql")); this.context.refresh(); DataSource dataSource = this.context.getBean(DataSource.class); assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java index 1793755fc2..8e7e5ccab6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java @@ -90,8 +90,7 @@ public class DataSourceJsonSerializationTests { for (PropertyDescriptor property : BeanUtils .getPropertyDescriptors(DataSource.class)) { Method reader = property.getReadMethod(); - if (reader != null - && property.getWriteMethod() != null + if (reader != null && property.getWriteMethod() != null && this.conversionService.canConvert(String.class, property.getPropertyType())) { jgen.writeObjectField(property.getName(), @@ -115,9 +114,8 @@ public class DataSourceJsonSerializationTests { AnnotatedMethod setter = beanDesc.findMethod( "set" + StringUtils.capitalize(writer.getName()), new Class[] { writer.getPropertyType() }); - if (setter != null - && this.conversionService.canConvert(String.class, - writer.getPropertyType())) { + if (setter != null && this.conversionService.canConvert(String.class, + writer.getPropertyType())) { result.add(writer); } } 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 5cc53bc881..b49eecaf16 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 @@ -43,8 +43,8 @@ public class DataSourceTransactionManagerAutoConfigurationTests { this.context.refresh(); assertNotNull(this.context.getBean(DataSource.class)); assertNotNull(this.context.getBean(DataSourceTransactionManager.class)); - assertNotNull(this.context - .getBean(AbstractTransactionManagementConfiguration.class)); + assertNotNull( + this.context.getBean(AbstractTransactionManagementConfiguration.class)); } @Test @@ -52,9 +52,8 @@ public class DataSourceTransactionManagerAutoConfigurationTests { this.context.register(DataSourceTransactionManagerAutoConfiguration.class); this.context.refresh(); assertEquals(0, this.context.getBeanNamesForType(DataSource.class).length); - assertEquals( - 0, - this.context.getBeanNamesForType(DataSourceTransactionManager.class).length); + assertEquals(0, this.context + .getBeanNamesForType(DataSourceTransactionManager.class).length); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriverTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriverTests.java index 53987b2b8c..748167b843 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriverTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriverTests.java @@ -38,15 +38,15 @@ public class DatabaseDriverTests { @Test public void classNameForKnownDatabase() { - String driverClassName = DatabaseDriver.fromJdbcUrl( - "jdbc:postgresql://hostname/dbname").getDriverClassName(); + String driverClassName = DatabaseDriver + .fromJdbcUrl("jdbc:postgresql://hostname/dbname").getDriverClassName(); assertEquals("org.postgresql.Driver", driverClassName); } @Test public void nullClassNameForUnknownDatabase() { - String driverClassName = DatabaseDriver.fromJdbcUrl( - "jdbc:unknowndb://hostname/dbname").getDriverClassName(); + String driverClassName = DatabaseDriver + .fromJdbcUrl("jdbc:unknowndb://hostname/dbname").getDriverClassName(); assertNull(driverClassName); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java index a9da2b94f7..737d90e38d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java @@ -62,8 +62,8 @@ public class HikariDataSourceConfigurationTests { @Test public void testDataSourcePropertiesOverridden() throws Exception { this.context.register(HikariDataSourceConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "jdbcUrl:jdbc:foo//bar/spam"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "jdbcUrl:jdbc:foo//bar/spam"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "maxLifetime:1234"); this.context.refresh(); HikariDataSource ds = this.context.getBean(HikariDataSource.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java index ae0ae15629..dd994f22aa 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java @@ -83,8 +83,8 @@ public class JndiDataSourceAutoConfigurationTests { } @Test - public void dataSourceIsAvailableFromJndi() throws IllegalStateException, - NamingException { + public void dataSourceIsAvailableFromJndi() + throws IllegalStateException, NamingException { DataSource dataSource = new BasicDataSource(); configureJndi("foo", dataSource); @@ -99,8 +99,8 @@ public class JndiDataSourceAutoConfigurationTests { @SuppressWarnings("unchecked") @Test - public void mbeanDataSourceIsExcludedFromExport() throws IllegalStateException, - NamingException { + public void mbeanDataSourceIsExcludedFromExport() + throws IllegalStateException, NamingException { DataSource dataSource = new BasicDataSource(); configureJndi("foo", dataSource); @@ -120,8 +120,8 @@ public class JndiDataSourceAutoConfigurationTests { @SuppressWarnings("unchecked") @Test - public void standardDataSourceIsNotExcludedFromExport() throws IllegalStateException, - NamingException { + public void standardDataSourceIsNotExcludedFromExport() + throws IllegalStateException, NamingException { DataSource dataSource = new org.apache.commons.dbcp.BasicDataSource(); configureJndi("foo", dataSource); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java index 6a69224f3a..da9f23ad9b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java @@ -73,20 +73,20 @@ public class TomcatDataSourceConfigurationTests { @Test public void testDataSourcePropertiesOverridden() throws Exception { this.context.register(TomcatDataSourceConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "url:jdbc:foo//bar/spam"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "url:jdbc:foo//bar/spam"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testWhileIdle:true"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnBorrow:true"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnReturn:true"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "timeBetweenEvictionRunsMillis:10000"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "minEvictableIdleTimeMillis:12345"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "timeBetweenEvictionRunsMillis:10000"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "minEvictableIdleTimeMillis:12345"); EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "maxWait:1234"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "jdbcInterceptors:SlowQueryReport"); - EnvironmentTestUtils.addEnvironment(this.context, PREFIX - + "validationInterval:9999"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "jdbcInterceptors:SlowQueryReport"); + EnvironmentTestUtils.addEnvironment(this.context, + PREFIX + "validationInterval:9999"); this.context.refresh(); org.apache.tomcat.jdbc.pool.DataSource ds = this.context .getBean(org.apache.tomcat.jdbc.pool.DataSource.class); @@ -146,8 +146,7 @@ public class TomcatDataSourceConfigurationTests { DataSourceBuilder factory = DataSourceBuilder .create(this.properties.getClassLoader()) .driverClassName(this.properties.getDriverClassName()) - .url(this.properties.getUrl()) - .username(this.properties.getUsername()) + .url(this.properties.getUrl()).username(this.properties.getUsername()) .password(this.properties.getPassword()) .type(org.apache.tomcat.jdbc.pool.DataSource.class); return factory.build(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java index 5bf990861a..1ebaa7e1d7 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java @@ -64,8 +64,7 @@ public class XADataSourceAutoConfigurationTests { @Test public void createFromClass() throws Exception { - ApplicationContext context = createContext( - FromProperties.class, + ApplicationContext context = createContext(FromProperties.class, "spring.datasource.xa.data-source-class-name:org.hsqldb.jdbc.pool.JDBCXADataSource", "spring.datasource.xa.properties.database-name:test"); context.getBean(DataSource.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadataTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadataTests.java index 38cf0e5997..001c8891ac 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadataTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/AbstractDataSourcePoolMetadataTests.java @@ -54,12 +54,12 @@ public abstract class AbstractDataSourcePoolMetadataTests() { @Override - public Void doInConnection(Connection connection) throws SQLException, - DataAccessException { + public Void doInConnection(Connection connection) + throws SQLException, DataAccessException { return null; } }); @@ -69,12 +69,12 @@ public abstract class AbstractDataSourcePoolMetadataTests() { @Override - public Void doInConnection(Connection connection) throws SQLException, - DataAccessException { + public Void doInConnection(Connection connection) + throws SQLException, DataAccessException { assertEquals(Integer.valueOf(1), getDataSourceMetadata().getActive()); assertEquals(Float.valueOf(0.5F), getDataSourceMetadata().getUsage()); return null; @@ -84,20 +84,20 @@ public abstract class AbstractDataSourcePoolMetadataTests() { @Override - public Void doInConnection(Connection connection) throws SQLException, - DataAccessException { + public Void doInConnection(Connection connection) + throws SQLException, DataAccessException { jdbcTemplate.execute(new ConnectionCallback() { @Override public Void doInConnection(Connection connection) throws SQLException, DataAccessException { - assertEquals(Integer.valueOf(2), getDataSourceMetadata() - .getActive()); - assertEquals(Float.valueOf(1F), getDataSourceMetadata() - .getUsage()); + assertEquals(Integer.valueOf(2), + getDataSourceMetadata().getActive()); + assertEquals(Float.valueOf(1F), + getDataSourceMetadata().getUsage()); return null; } }); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java index ddc8363777..8a62ecccf5 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java @@ -28,8 +28,8 @@ import static org.junit.Assert.assertNull; * * @author Stephane Nicoll */ -public class CommonsDbcpDataSourcePoolMetadataTests extends - AbstractDataSourcePoolMetadataTests { +public class CommonsDbcpDataSourcePoolMetadataTests + extends AbstractDataSourcePoolMetadataTests { private CommonsDbcpDataSourcePoolMetadata dataSourceMetadata; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersTests.java index 6fd985cbf9..b9dbd9c4dc 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersTests.java @@ -71,7 +71,8 @@ public class DataSourcePoolMetadataProvidersTests { DataSourcePoolMetadataProviders provider = new DataSourcePoolMetadataProviders( Arrays.asList(this.firstProvider, this.secondProvider)); assertSame(this.first, provider.getDataSourcePoolMetadata(this.firstDataSource)); - assertSame(this.second, provider.getDataSourcePoolMetadata(this.secondDataSource)); + assertSame(this.second, + provider.getDataSourcePoolMetadata(this.secondDataSource)); assertNull(provider.getDataSourcePoolMetadata(this.unknownDataSource)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadataTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadataTests.java index a0b4377ccb..39dfd2017d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadataTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/HikariDataSourcePoolMetadataTests.java @@ -27,14 +27,15 @@ import static org.junit.Assert.assertEquals; * * @author Stephane Nicoll */ -public class HikariDataSourcePoolMetadataTests extends - AbstractDataSourcePoolMetadataTests { +public class HikariDataSourcePoolMetadataTests + extends AbstractDataSourcePoolMetadataTests { private HikariDataSourcePoolMetadata dataSourceMetadata; @Before public void setup() { - this.dataSourceMetadata = new HikariDataSourcePoolMetadata(createDataSource(0, 2)); + this.dataSourceMetadata = new HikariDataSourcePoolMetadata( + createDataSource(0, 2)); } @Override @@ -51,8 +52,8 @@ public class HikariDataSourcePoolMetadataTests extends } private HikariDataSource createDataSource(int minSize, int maxSize) { - HikariDataSource dataSource = (HikariDataSource) initializeBuilder().type( - HikariDataSource.class).build(); + HikariDataSource dataSource = (HikariDataSource) initializeBuilder() + .type(HikariDataSource.class).build(); dataSource.setMinimumIdle(minSize); dataSource.setMaximumPoolSize(maxSize); return dataSource; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadataTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadataTests.java index d98ad1a846..367d1e9ac4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadataTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/TomcatDataSourcePoolMetadataTests.java @@ -26,14 +26,15 @@ import static org.junit.Assert.assertEquals; * * @author Stephane Nicoll */ -public class TomcatDataSourcePoolMetadataTests extends - AbstractDataSourcePoolMetadataTests { +public class TomcatDataSourcePoolMetadataTests + extends AbstractDataSourcePoolMetadataTests { private TomcatDataSourcePoolMetadata dataSourceMetadata; @Before public void setup() { - this.dataSourceMetadata = new TomcatDataSourcePoolMetadata(createDataSource(0, 2)); + this.dataSourceMetadata = new TomcatDataSourcePoolMetadata( + createDataSource(0, 2)); } @Override diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java index bbe052c63c..58d29e0e06 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java @@ -64,8 +64,8 @@ public class JerseyAutoConfigurationDefaultFilterPathTests { @Test public void contextLoads() { - ResponseEntity entity = this.restTemplate.getForEntity( - "http://localhost:" + this.port + "/hello", String.class); + ResponseEntity entity = this.restTemplate + .getForEntity("http://localhost:" + this.port + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java index 1a78baac97..c1ca4c4e16 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java @@ -64,8 +64,8 @@ public class JerseyAutoConfigurationDefaultServletPathTests { @Test public void contextLoads() { - ResponseEntity entity = this.restTemplate.getForEntity( - "http://localhost:" + this.port + "/hello", String.class); + ResponseEntity entity = this.restTemplate + .getForEntity("http://localhost:" + this.port + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); } 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 c4fd6ce665..239976d642 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 @@ -91,8 +91,8 @@ public class JmsAutoConfigurationTests { @Test public void testConnectionFactoryBackOff() { load(TestConfiguration2.class); - assertEquals("foobar", this.context.getBean(ActiveMQConnectionFactory.class) - .getBrokerURL()); + assertEquals("foobar", + this.context.getBean(ActiveMQConnectionFactory.class).getBrokerURL()); } @Test @@ -116,8 +116,8 @@ public class JmsAutoConfigurationTests { TestConfiguration5.class); JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); assertEquals(999, jmsTemplate.getPriority()); - assertEquals("foobar", this.context.getBean(ActiveMQConnectionFactory.class) - .getBrokerURL()); + assertEquals("foobar", + this.context.getBean(ActiveMQConnectionFactory.class).getBrokerURL()); JmsMessagingTemplate messagingTemplate = this.context .getBean(JmsMessagingTemplate.class); assertEquals("fooBar", messagingTemplate.getDefaultDestinationName()); @@ -127,8 +127,8 @@ public class JmsAutoConfigurationTests { @Test public void testEnableJmsCreateDefaultContainerFactory() { load(EnableJmsConfiguration.class); - JmsListenerContainerFactory jmsListenerContainerFactory = this.context - .getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class); + JmsListenerContainerFactory jmsListenerContainerFactory = this.context.getBean( + "jmsListenerContainerFactory", JmsListenerContainerFactory.class); assertEquals(DefaultJmsListenerContainerFactory.class, jmsListenerContainerFactory.getClass()); } @@ -137,8 +137,8 @@ public class JmsAutoConfigurationTests { public void testJmsListenerContainerFactoryBackOff() { this.context = createContext(TestConfiguration6.class, EnableJmsConfiguration.class); - JmsListenerContainerFactory jmsListenerContainerFactory = this.context - .getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class); + JmsListenerContainerFactory jmsListenerContainerFactory = this.context.getBean( + "jmsListenerContainerFactory", JmsListenerContainerFactory.class); assertEquals(SimpleJmsListenerContainerFactory.class, jmsListenerContainerFactory.getClass()); } @@ -147,8 +147,8 @@ public class JmsAutoConfigurationTests { public void testDefaultContainerFactoryWithJtaTransactionManager() { this.context = createContext(TestConfiguration7.class, EnableJmsConfiguration.class); - 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) @@ -164,8 +164,8 @@ public class JmsAutoConfigurationTests { public void testDefaultContainerFactoryNonJtaTransactionManager() { this.context = createContext(TestConfiguration8.class, EnableJmsConfiguration.class); - 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) @@ -179,8 +179,8 @@ public class JmsAutoConfigurationTests { @Test public void testDefaultContainerFactoryNoTransactionManager() { this.context = createContext(EnableJmsConfiguration.class); - 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) @@ -244,7 +244,8 @@ public class JmsAutoConfigurationTests { @Test public void testActiveMQOverriddenRemoteHost() { - load(TestConfiguration.class, "spring.activemq.brokerUrl:tcp://remote-host:10000"); + load(TestConfiguration.class, + "spring.activemq.brokerUrl:tcp://remote-host:10000"); JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); ActiveMQConnectionFactory connectionFactory = this.context .getBean(ActiveMQConnectionFactory.class); @@ -384,7 +385,8 @@ public class JmsAutoConfigurationTests { @Bean JmsMessagingTemplate jmsMessagingTemplate(JmsTemplate jmsTemplate) { - JmsMessagingTemplate messagingTemplate = new JmsMessagingTemplate(jmsTemplate); + JmsMessagingTemplate messagingTemplate = new JmsMessagingTemplate( + jmsTemplate); messagingTemplate.setDefaultDestinationName("fooBar"); return messagingTemplate; } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java index 5572bac2c7..b573516401 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java @@ -56,7 +56,8 @@ public class ActiveMQAutoConfigurationTests { @Test public void configurationBacksOffWhenCustomConnectionFactoryExists() { load(CustomConnectionFactoryConfiguration.class); - assertTrue(mockingDetails(this.context.getBean(ConnectionFactory.class)).isMock()); + assertTrue( + mockingDetails(this.context.getBean(ConnectionFactory.class)).isMock()); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java index 68ae0ed1ae..c2d7bf5e3a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java @@ -35,32 +35,32 @@ public class ActiveMQPropertiesTests { @Test public void getBrokerUrlIsInMemoryByDefault() { - assertEquals(DEFAULT_EMBEDDED_BROKER_URL, new ActiveMQConnectionFactoryFactory( - this.properties).determineBrokerUrl()); + assertEquals(DEFAULT_EMBEDDED_BROKER_URL, + new ActiveMQConnectionFactoryFactory(this.properties) + .determineBrokerUrl()); } @Test public void getBrokerUrlUseExplicitBrokerUrl() { this.properties.setBrokerUrl("vm://foo-bar"); - assertEquals("vm://foo-bar", - new ActiveMQConnectionFactoryFactory(this.properties) - .determineBrokerUrl()); + assertEquals("vm://foo-bar", new ActiveMQConnectionFactoryFactory(this.properties) + .determineBrokerUrl()); } @Test public void getBrokerUrlWithInMemorySetToFalse() { this.properties.setInMemory(false); - assertEquals(DEFAULT_NETWORK_BROKER_URL, new ActiveMQConnectionFactoryFactory( - this.properties).determineBrokerUrl()); + assertEquals(DEFAULT_NETWORK_BROKER_URL, + new ActiveMQConnectionFactoryFactory(this.properties) + .determineBrokerUrl()); } @Test public void getExplicitBrokerUrlAlwaysWins() { this.properties.setBrokerUrl("vm://foo-bar"); this.properties.setInMemory(false); - assertEquals("vm://foo-bar", - new ActiveMQConnectionFactoryFactory(this.properties) - .determineBrokerUrl()); + assertEquals("vm://foo-bar", new ActiveMQConnectionFactoryFactory(this.properties) + .determineBrokerUrl()); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfigurationTests.java index d96d2a3cd6..d601b288eb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfigurationTests.java @@ -186,7 +186,8 @@ public class HornetQAutoConfigurationTests { @Test public void embeddedServiceWithCustomJmsConfiguration() { // Ignored with custom config - load(CustomJmsConfiguration.class, "spring.hornetq.embedded.queues=Queue1,Queue2"); + load(CustomJmsConfiguration.class, + "spring.hornetq.embedded.queues=Queue1,Queue2"); DestinationChecker checker = new DestinationChecker(this.context); checker.checkQueue("custom", true); // See CustomJmsConfiguration @@ -285,7 +286,8 @@ public class HornetQAutoConfigurationTests { private TransportConfiguration assertInVmConnectionFactory( HornetQConnectionFactory connectionFactory) { - TransportConfiguration transportConfig = getSingleTransportConfiguration(connectionFactory); + TransportConfiguration transportConfig = getSingleTransportConfiguration( + connectionFactory); assertEquals(InVMConnectorFactory.class.getName(), transportConfig.getFactoryClassName()); return transportConfig; @@ -293,7 +295,8 @@ public class HornetQAutoConfigurationTests { private TransportConfiguration assertNettyConnectionFactory( HornetQConnectionFactory 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")); @@ -393,8 +396,8 @@ public class HornetQAutoConfigurationTests { @Bean public JMSConfiguration myJmsConfiguration() { JMSConfiguration config = new JMSConfigurationImpl(); - config.getQueueConfigurations().add( - new JMSQueueConfigurationImpl("custom", null, false)); + config.getQueueConfigurations() + .add(new JMSQueueConfigurationImpl("custom", null, false)); return config; } } @@ -409,7 +412,8 @@ public class HornetQAutoConfigurationTests { public HornetQConfigurationCustomizer myHornetQCustomize() { return new HornetQConfigurationCustomizer() { @Override - public void customize(org.hornetq.core.config.Configuration configuration) { + public void customize( + org.hornetq.core.config.Configuration configuration) { configuration.setClusterPassword("Foobar"); configuration.setName("customFooBar"); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jta/JtaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jta/JtaAutoConfigurationTests.java index ed6e250890..5ba1c1b101 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jta/JtaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jta/JtaAutoConfigurationTests.java @@ -109,8 +109,8 @@ public class JtaAutoConfigurationTests { this.context.refresh(); assertEquals(0, this.context.getBeansOfType(JtaTransactionManager.class).size()); assertEquals(0, this.context.getBeansOfType(XADataSourceWrapper.class).size()); - assertEquals(0, this.context.getBeansOfType(XAConnectionFactoryWrapper.class) - .size()); + assertEquals(0, + this.context.getBeansOfType(XAConnectionFactoryWrapper.class).size()); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java index 638f1e4553..2a80603fcc 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java @@ -142,8 +142,8 @@ public class LiquibaseAutoConfigurationTests { PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class); - assertEquals("jdbc:hsqldb:mem:liquibase", liquibase.getDataSource() - .getConnection().getMetaData().getURL()); + assertEquals("jdbc:hsqldb:mem:liquibase", + liquibase.getDataSource().getConnection().getMetaData().getURL()); } @Test(expected = BeanCreationException.class) 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 4c3b24bf84..6a2e69ec9b 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 @@ -168,7 +168,8 @@ public class AutoConfigurationReportLoggingInitializerTests { } // Just basic sanity check, test is for visual inspection String l = this.debugLog.get(0); - assertThat(l, containsString("not a web application (OnWebApplicationCondition)")); + assertThat(l, + containsString("not a web application (OnWebApplicationCondition)")); } @Test @@ -192,9 +193,9 @@ public class AutoConfigurationReportLoggingInitializerTests { @Test public void noErrorIfNotInitialized() throws Exception { - this.initializer.onApplicationEvent(new ApplicationFailedEvent( - new SpringApplication(), new String[0], null, new RuntimeException( - "Planned"))); + this.initializer + .onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), + new String[0], null, new RuntimeException("Planned"))); assertThat(this.infoLog.get(0), containsString("Unable to provide auto-configuration report")); } @@ -210,8 +211,7 @@ public class AutoConfigurationReportLoggingInitializerTests { } @Configuration - @Import({ WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, + @Import({ WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) static class Config { 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 c5aba75e23..22bbe6261b 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 e) { // 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) @@ -176,43 +178,43 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests { .getBean("deviceDelegatingViewResolver", LiteDeviceDelegatingViewResolver.class); - Field normalPrefixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "normalPrefix"); + Field normalPrefixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "normalPrefix"); normalPrefixField.setAccessible(true); String normalPrefix = (String) ReflectionUtils.getField(normalPrefixField, liteDeviceDelegatingViewResolver); assertEquals("", normalPrefix); - Field mobilePrefixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "mobilePrefix"); + Field mobilePrefixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "mobilePrefix"); mobilePrefixField.setAccessible(true); String mobilePrefix = (String) ReflectionUtils.getField(mobilePrefixField, liteDeviceDelegatingViewResolver); assertEquals("mobile/", mobilePrefix); - Field tabletPrefixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "tabletPrefix"); + Field tabletPrefixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "tabletPrefix"); tabletPrefixField.setAccessible(true); String tabletPrefix = (String) ReflectionUtils.getField(tabletPrefixField, liteDeviceDelegatingViewResolver); assertEquals("tablet/", tabletPrefix); - Field normalSuffixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "normalSuffix"); + Field normalSuffixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "normalSuffix"); normalSuffixField.setAccessible(true); String normalSuffix = (String) ReflectionUtils.getField(normalSuffixField, liteDeviceDelegatingViewResolver); assertEquals("", normalSuffix); - Field mobileSuffixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "mobileSuffix"); + Field mobileSuffixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "mobileSuffix"); mobileSuffixField.setAccessible(true); String mobileSuffix = (String) ReflectionUtils.getField(mobileSuffixField, liteDeviceDelegatingViewResolver); assertEquals("", mobileSuffix); - Field tabletSuffixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "tabletSuffix"); + Field tabletSuffixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "tabletSuffix"); tabletSuffixField.setAccessible(true); String tabletSuffix = (String) ReflectionUtils.getField(tabletSuffixField, liteDeviceDelegatingViewResolver); @@ -233,8 +235,8 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests { LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context .getBean("deviceDelegatingViewResolver", LiteDeviceDelegatingViewResolver.class); - Field normalPrefixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "normalPrefix"); + Field normalPrefixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "normalPrefix"); normalPrefixField.setAccessible(true); String normalPrefix = (String) ReflectionUtils.getField(normalPrefixField, liteDeviceDelegatingViewResolver); @@ -255,8 +257,8 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests { LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context .getBean("deviceDelegatingViewResolver", LiteDeviceDelegatingViewResolver.class); - Field mobilePrefixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "mobilePrefix"); + Field mobilePrefixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "mobilePrefix"); mobilePrefixField.setAccessible(true); String mobilePrefix = (String) ReflectionUtils.getField(mobilePrefixField, liteDeviceDelegatingViewResolver); @@ -277,8 +279,8 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests { LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context .getBean("deviceDelegatingViewResolver", LiteDeviceDelegatingViewResolver.class); - Field tabletPrefixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "tabletPrefix"); + Field tabletPrefixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "tabletPrefix"); tabletPrefixField.setAccessible(true); String tabletPrefix = (String) ReflectionUtils.getField(tabletPrefixField, liteDeviceDelegatingViewResolver); @@ -299,8 +301,8 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests { LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context .getBean("deviceDelegatingViewResolver", LiteDeviceDelegatingViewResolver.class); - Field normalSuffixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "normalSuffix"); + Field normalSuffixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "normalSuffix"); normalSuffixField.setAccessible(true); String normalSuffix = (String) ReflectionUtils.getField(normalSuffixField, liteDeviceDelegatingViewResolver); @@ -321,8 +323,8 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests { LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context .getBean("deviceDelegatingViewResolver", LiteDeviceDelegatingViewResolver.class); - Field mobileSuffixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "mobileSuffix"); + Field mobileSuffixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "mobileSuffix"); mobileSuffixField.setAccessible(true); String mobileSuffix = (String) ReflectionUtils.getField(mobileSuffixField, liteDeviceDelegatingViewResolver); @@ -343,8 +345,8 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests { LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context .getBean("deviceDelegatingViewResolver", LiteDeviceDelegatingViewResolver.class); - Field tabletSuffixField = ReflectionUtils.findField( - LiteDeviceDelegatingViewResolver.class, "tabletSuffix"); + Field tabletSuffixField = ReflectionUtils + .findField(LiteDeviceDelegatingViewResolver.class, "tabletSuffix"); tabletSuffixField.setAccessible(true); String tabletSuffix = (String) ReflectionUtils.getField(tabletSuffixField, liteDeviceDelegatingViewResolver); 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 a5bc0c46a3..abcc0d3cb1 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 @@ -84,11 +84,11 @@ public class DeviceResolverAutoConfigurationTests { context.refresh(); RequestMappingHandlerMapping mapping = (RequestMappingHandlerMapping) context .getBean("requestMappingHandlerMapping"); - Field interceptorsField = ReflectionUtils.findField( - RequestMappingHandlerMapping.class, "interceptors"); + Field interceptorsField = ReflectionUtils + .findField(RequestMappingHandlerMapping.class, "interceptors"); interceptorsField.setAccessible(true); - List interceptors = (List) ReflectionUtils.getField( - interceptorsField, mapping); + List interceptors = (List) ReflectionUtils + .getField(interceptorsField, mapping); context.close(); for (Object o : interceptors) { if (o instanceof DeviceResolverHandlerInterceptor) { 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 075690a994..b96170c6b2 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 @@ -92,8 +92,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 @@ -103,8 +103,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) @@ -128,11 +128,11 @@ public class SitePreferenceAutoConfigurationTests { context.refresh(); RequestMappingHandlerMapping mapping = (RequestMappingHandlerMapping) context .getBean("requestMappingHandlerMapping"); - Field interceptorsField = ReflectionUtils.findField( - RequestMappingHandlerMapping.class, "interceptors"); + Field interceptorsField = ReflectionUtils + .findField(RequestMappingHandlerMapping.class, "interceptors"); interceptorsField.setAccessible(true); - List interceptors = (List) ReflectionUtils.getField( - interceptorsField, mapping); + List interceptors = (List) ReflectionUtils + .getField(interceptorsField, mapping); context.close(); for (Object o : interceptors) { if (o instanceof SitePreferenceHandlerInterceptor) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java index ccc68f3ff0..467e3c33e2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java @@ -61,8 +61,8 @@ public class MongoAutoConfigurationTests { this.context.register(OptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class); this.context.refresh(); - assertEquals(300, this.context.getBean(Mongo.class).getMongoOptions() - .getSocketTimeout()); + assertEquals(300, + this.context.getBean(Mongo.class).getMongoOptions().getSocketTimeout()); } @SuppressWarnings("deprecation") @@ -74,8 +74,8 @@ public class MongoAutoConfigurationTests { this.context.register(OptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class); this.context.refresh(); - assertEquals(300, this.context.getBean(Mongo.class).getMongoOptions() - .getSocketTimeout()); + assertEquals(300, + this.context.getBean(Mongo.class).getMongoOptions().getSocketTimeout()); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfigurationTests.java index 5e57e5470d..c3334ef484 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfigurationTests.java @@ -87,8 +87,8 @@ public class MongoDataAutoConfigurationTests { MongoAutoConfiguration.class, MongoDataAutoConfiguration.class); this.context.refresh(); MongoTemplate template = this.context.getBean(MongoTemplate.class); - assertTrue(template.getConverter().getConversionService() - .canConvert(Mongo.class, Boolean.class)); + assertTrue(template.getConverter().getConversionService().canConvert(Mongo.class, + Boolean.class)); } @Test @@ -106,8 +106,8 @@ public class MongoDataAutoConfigurationTests { @SuppressWarnings({ "unchecked", "rawtypes" }) private static void assertDomainTypesDiscovered(MongoMappingContext mappingContext, Class... types) { - Set initialEntitySet = (Set) ReflectionTestUtils.getField( - mappingContext, "initialEntitySet"); + Set initialEntitySet = (Set) ReflectionTestUtils + .getField(mappingContext, "initialEntitySet"); assertThat(initialEntitySet, hasSize(types.length)); assertThat(initialEntitySet, Matchers.hasItems(types)); } 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 8e0cd1f595..e9acac6113 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); - 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); - 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/mustache/MustacheAutoConfigurationIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java index e524960209..476500f88f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java @@ -70,15 +70,15 @@ public class MustacheAutoConfigurationIntegrationTests { @Test public void testHomePage() throws Exception { - String body = new TestRestTemplate().getForObject( - "http://localhost:" + this.port, String.class); + String body = new TestRestTemplate().getForObject("http://localhost:" + this.port, + String.class); assertTrue(body.contains("Hello World")); } @Test public void testPartialPage() throws Exception { - String body = new TestRestTemplate().getForObject("http://localhost:" + this.port - + "/partial", String.class); + String body = new TestRestTemplate() + .getForObject("http://localhost:" + this.port + "/partial", String.class); assertTrue(body.contains("Hello World")); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java index 56695874bf..fd33eebef2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java @@ -48,24 +48,20 @@ public class MustacheStandaloneIntegrationTests { @Test public void directCompilation() throws Exception { - assertEquals( - "Hello: World", - this.compiler.compile("Hello: {{world}}").execute( - Collections.singletonMap("world", "World"))); + assertEquals("Hello: World", this.compiler.compile("Hello: {{world}}") + .execute(Collections.singletonMap("world", "World"))); } @Test public void environmentCollectorCompoundKey() throws Exception { - assertEquals("Hello: Heaven", this.compiler.compile("Hello: {{env.foo}}") - .execute(new Object())); + assertEquals("Hello: Heaven", + this.compiler.compile("Hello: {{env.foo}}").execute(new Object())); } @Test public void environmentCollectorCompoundKeyStandard() throws Exception { - assertEquals( - "Hello: Heaven", - this.compiler.standardsMode(true).compile("Hello: {{env.foo}}") - .execute(new Object())); + assertEquals("Hello: Heaven", this.compiler.standardsMode(true) + .compile("Hello: {{env.foo}}").execute(new Object())); } @Test @@ -75,7 +71,8 @@ public class MustacheStandaloneIntegrationTests { } @Configuration - @Import({ MustacheAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + @Import({ MustacheAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) protected static class Application { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java index 9688357212..843ac778e6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java @@ -55,9 +55,11 @@ public class MustacheViewTests { @Test public void viewResolvesHandlebars() throws Exception { - MustacheView view = new MustacheView(Mustache.compiler().compile("Hello {{msg}}")); + MustacheView view = new MustacheView( + Mustache.compiler().compile("Hello {{msg}}")); view.setApplicationContext(this.context); - view.render(Collections.singletonMap("msg", "World"), this.request, this.response); + view.render(Collections.singletonMap("msg", "World"), this.request, + this.response); assertEquals("Hello World", this.response.getContentAsString()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java index 6be90b147e..7a5ca5a49e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java @@ -87,15 +87,15 @@ public class MustacheWebIntegrationTests { @Test public void testHomePage() throws Exception { - String body = new TestRestTemplate().getForObject( - "http://localhost:" + this.port, String.class); + String body = new TestRestTemplate().getForObject("http://localhost:" + this.port, + String.class); assertTrue(body.contains("Hello World")); } @Test public void testPartialPage() throws Exception { - String body = new TestRestTemplate().getForObject("http://localhost:" + this.port - + "/partial", String.class); + String body = new TestRestTemplate() + .getForObject("http://localhost:" + this.port + "/partial", String.class); assertTrue(body.contains("Hello World")); } @@ -135,9 +135,9 @@ public class MustacheWebIntegrationTests { MustacheViewResolver resolver = new MustacheViewResolver(); resolver.setPrefix("classpath:/mustache-templates/"); resolver.setSuffix(".html"); - resolver.setCompiler(Mustache.compiler().withLoader( - new MustacheResourceTemplateLoader("classpath:/mustache-templates/", - ".html"))); + resolver.setCompiler( + Mustache.compiler().withLoader(new MustacheResourceTemplateLoader( + "classpath:/mustache-templates/", ".html"))); return resolver; } 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 d68309630f..6d4ca21410 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 @@ -101,7 +101,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 @@ -218,8 +219,8 @@ public abstract class AbstractJpaAutoConfigurationTests { } @Configuration - protected static class TestConfigurationWithEntityManagerFactory extends - TestConfiguration { + protected static class TestConfigurationWithEntityManagerFactory + extends TestConfiguration { @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory( diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java index 40c0bae3a4..94e9f2b7c3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java @@ -62,8 +62,8 @@ public class CustomHibernateJpaAutoConfigurationTests { this.context.refresh(); JpaProperties bean = this.context.getBean(JpaProperties.class); DataSource dataSource = this.context.getBean(DataSource.class); - String actual = bean.getHibernateProperties(dataSource).get( - "hibernate.hbm2ddl.auto"); + String actual = bean.getHibernateProperties(dataSource) + .get("hibernate.hbm2ddl.auto"); // Default is generic and safe assertThat(actual, nullValue()); } @@ -79,8 +79,8 @@ public class CustomHibernateJpaAutoConfigurationTests { this.context.refresh(); JpaProperties bean = this.context.getBean(JpaProperties.class); DataSource dataSource = this.context.getBean(DataSource.class); - String actual = bean.getHibernateProperties(dataSource).get( - "hibernate.hbm2ddl.auto"); + String actual = bean.getHibernateProperties(dataSource) + .get("hibernate.hbm2ddl.auto"); assertThat(actual, equalTo("create-drop")); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilderTests.java index 0013d0c568..a85665476d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilderTests.java @@ -60,8 +60,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-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 c0a1cb1511..06cf5e7be2 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")); } @@ -107,8 +108,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")); } @@ -121,8 +122,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"))); @@ -155,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(jpaPropertyMap.get("hibernate.transaction.jta.platform"), instanceOf(SpringJtaPlatform.class)); } @@ -169,8 +171,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/redis/RedisAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfigurationTests.java index 80f942c48d..6d54651e08 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfigurationTests.java @@ -63,8 +63,8 @@ public class RedisAutoConfigurationTests { this.context.register(RedisAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - assertEquals("foo", this.context.getBean(JedisConnectionFactory.class) - .getHostName()); + assertEquals("foo", + this.context.getBean(JedisConnectionFactory.class).getHostName()); assertEquals(1, this.context.getBean(JedisConnectionFactory.class).getDatabase()); } @@ -76,10 +76,10 @@ public class RedisAutoConfigurationTests { this.context.register(RedisAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - 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 @@ -90,8 +90,7 @@ public class RedisAutoConfigurationTests { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "spring.redis.sentinel.master:mymaster"); - EnvironmentTestUtils.addEnvironment( - this.context, + EnvironmentTestUtils.addEnvironment(this.context, "spring.redis.sentinel.nodes:" + StringUtils.collectionToCommaDelimitedString(sentinels)); this.context.register(RedisAutoConfiguration.class, 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 77375b2d96..de9dfe138d 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 @@ -85,8 +85,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()); } @@ -98,10 +98,9 @@ public class SecurityAutoConfigurationTests { ServerPropertiesAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - assertEquals( - 0, - this.context.getBean("securityFilterChainRegistration", - FilterRegistrationBean.class).getOrder()); + assertEquals(0, this.context + .getBean("securityFilterChainRegistration", FilterRegistrationBean.class) + .getOrder()); } @Test @@ -113,10 +112,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 @@ -129,8 +127,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 @@ -187,7 +185,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)); } @@ -215,7 +214,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)); } @@ -232,8 +232,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(); } @@ -250,8 +250,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 @@ -313,8 +313,8 @@ public class SecurityAutoConfigurationTests { assertNotNull(manager.authenticate(token)); } - private static final class AuthenticationListener implements - ApplicationListener { + private static final class AuthenticationListener + implements ApplicationListener { private ApplicationEvent event; @@ -359,8 +359,8 @@ public class SecurityAutoConfigurationTests { } @Configuration - protected static class WorkaroundSecurityCustomizer extends - WebSecurityConfigurerAdapter { + protected static class WorkaroundSecurityCustomizer + extends WebSecurityConfigurerAdapter { @Autowired private AuthenticationManagerBuilder builder; @@ -384,8 +384,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 { @@ -395,8 +395,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/SecurityPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java index a8c40452cc..dd4a50824d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java @@ -49,32 +49,32 @@ public class SecurityPropertiesTests { @Test public void testBindingIgnoredSingleValued() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", "/css/**"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.ignored", "/css/**"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals(1, this.security.getIgnored().size()); } @Test public void testBindingIgnoredEmpty() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", ""))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.ignored", ""))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals(0, this.security.getIgnored().size()); } @Test public void testBindingIgnoredDisable() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", "none"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.ignored", "none"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals(1, this.security.getIgnored().size()); } @Test public void testBindingIgnoredMultiValued() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", "/css/**,/images/**"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.ignored", "/css/**,/images/**"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals(2, this.security.getIgnored().size()); } @@ -92,32 +92,32 @@ public class SecurityPropertiesTests { @Test public void testDefaultPasswordAutogeneratedIfUnresolovedPlaceholder() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.user.password", "${ADMIN_PASSWORD}"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.user.password", "${ADMIN_PASSWORD}"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertTrue(this.security.getUser().isDefaultPassword()); } @Test public void testDefaultPasswordAutogeneratedIfEmpty() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.user.password", ""))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.user.password", ""))); assertFalse(this.binder.getBindingResult().hasErrors()); assertTrue(this.security.getUser().isDefaultPassword()); } @Test public void testRoles() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.user.role", "USER,ADMIN"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.user.role", "USER,ADMIN"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals("[USER, ADMIN]", this.security.getUser().getRole().toString()); } @Test public void testRole() { - this.binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.user.role", "ADMIN"))); + this.binder.bind(new MutablePropertyValues( + Collections.singletonMap("security.user.role", "ADMIN"))); assertFalse(this.binder.getBindingResult().hasErrors()); assertEquals("[ADMIN]", this.security.getUser().getRole().toString()); } 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 9dda84a0f6..63d5f9d9fa 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 @@ -74,8 +74,8 @@ public class SpringBootWebSecurityConfigurationTests { @Test public void testDefaultIgnores() { - assertTrue(SpringBootWebSecurityConfiguration - .getIgnored(new SecurityProperties()).contains("/css/**")); + assertTrue(SpringBootWebSecurityConfiguration.getIgnored(new SecurityProperties()) + .contains("/css/**")); } @Test @@ -83,8 +83,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 @@ -98,9 +98,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 @@ -113,8 +112,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 @@ -129,9 +128,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 @@ -146,9 +144,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 @@ -156,15 +153,15 @@ 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"))); } @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, @@ -213,8 +210,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 static @interface MinimalWebConfiguration { } 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 b28ff65c1a..3dd2b2cdbe 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 @@ -170,8 +170,8 @@ public class ThymeleafAutoConfigurationTests { assertEquals(0, context.getBeanNamesForType(ViewResolver.class).length); try { TemplateEngine engine = context.getBean(TemplateEngine.class); - Context attrs = new Context(Locale.UK, Collections.singletonMap("greeting", - "Hello World")); + Context attrs = new Context(Locale.UK, + Collections.singletonMap("greeting", "Hello World")); String result = engine.process("message", attrs); assertThat(result, containsString("Hello World")); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProviderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProviderTests.java index 5668b1e8ba..4e3c5e6fab 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProviderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafTemplateAvailabilityProviderTests.java @@ -40,8 +40,8 @@ public class ThymeleafTemplateAvailabilityProviderTests { @Test public void availabilityOfTemplateInDefaultLocation() { - assertTrue(this.provider.isTemplateAvailable("home", this.environment, getClass() - .getClassLoader(), this.resourceLoader)); + assertTrue(this.provider.isTemplateAvailable("home", this.environment, + getClass().getClassLoader(), this.resourceLoader)); } @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 916cfbe76c..8bfc9e4739 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 @@ -80,8 +80,8 @@ public class VelocityAutoConfigurationTests { @Test(expected = BeanCreationException.class) public void nonExistentTemplateLocation() { - registerAndRefreshContext("spring.velocity.resourceLoaderPath:" - + "classpath:/does-not-exist/"); + registerAndRefreshContext( + "spring.velocity.resourceLoaderPath:" + "classpath:/does-not-exist/"); } @Test @@ -134,7 +134,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")); @@ -149,9 +150,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 diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProviderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProviderTests.java index 70696072c8..ab3b344460 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProviderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProviderTests.java @@ -40,8 +40,8 @@ public class VelocityTemplateAvailabilityProviderTests { @Test public void availabilityOfTemplateInDefaultLocation() { - assertTrue(this.provider.isTemplateAvailable("home", this.environment, getClass() - .getClassLoader(), this.resourceLoader)); + assertTrue(this.provider.isTemplateAvailable("home", this.environment, + getClass().getClassLoader(), this.resourceLoader)); } @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 f0a0d33aba..53c84de5f6 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", - "--error.whitelabel.enabled=false")); + "--error.whitelabel.enabled=false")); 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 static @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 36fd63a2bb..f519e09b17 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 @@ -71,23 +71,22 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") public void testErrorForMachineClient() throws Exception { - ResponseEntity entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); String body = entity.getBody().toString(); - assertThat(body, endsWith("status=500, " + "error=Internal Server Error, " - + "exception=java.lang.IllegalStateException, " + "message=Expected!, " - + "path=/}")); + assertThat(body, + endsWith("status=500, " + "error=Internal Server Error, " + + "exception=java.lang.IllegalStateException, " + + "message=Expected!, " + "path=/}")); } @Test @SuppressWarnings("rawtypes") public void testErrorForAnnotatedException() throws Exception { - ResponseEntity entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/annotated", Map.class); - assertThat( - entity.getBody().toString(), - endsWith("status=400, " - + "error=Bad Request, " + ResponseEntity entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/annotated", Map.class); + assertThat(entity.getBody().toString(), + endsWith("status=400, " + "error=Bad Request, " + "exception=org.springframework.boot.autoconfigure.web.BasicErrorControllerIntegrationTests$TestConfiguration$Errors$ExpectedException, " + "message=Expected!, " + "path=/annotated}")); } @@ -121,7 +120,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 8041898bc6..2af566e96f 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 static @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/DefaultErrorAttributesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java index e6c0c64257..407596fac8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java @@ -56,16 +56,16 @@ public class DefaultErrorAttributesTests { @Test public void includeTimeStamp() throws Exception { - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("timestamp"), instanceOf(Date.class)); } @Test public void specificStatusCode() throws Exception { this.request.setAttribute("javax.servlet.error.status_code", 404); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("error"), equalTo((Object) HttpStatus.NOT_FOUND.getReasonPhrase())); assertThat(attributes.get("status"), equalTo((Object) 404)); @@ -73,8 +73,8 @@ public class DefaultErrorAttributesTests { @Test public void missingStatusCode() throws Exception { - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("error"), equalTo((Object) "None")); assertThat(attributes.get("status"), equalTo((Object) 999)); } @@ -84,10 +84,10 @@ public class DefaultErrorAttributesTests { RuntimeException ex = new RuntimeException("Test"); ModelAndView modelAndView = this.errorAttributes.resolveException(this.request, null, null, ex); - this.request.setAttribute("javax.servlet.error.exception", new RuntimeException( - "Ignored")); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + this.request.setAttribute("javax.servlet.error.exception", + new RuntimeException("Ignored")); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(this.errorAttributes.getError(this.requestAttributes), sameInstance((Object) ex)); assertThat(modelAndView, nullValue()); @@ -100,8 +100,8 @@ public class DefaultErrorAttributesTests { public void servletError() throws Exception { RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(this.errorAttributes.getError(this.requestAttributes), sameInstance((Object) ex)); assertThat(attributes.get("exception"), @@ -112,19 +112,19 @@ public class DefaultErrorAttributesTests { @Test public void servletMessage() throws Exception { this.request.setAttribute("javax.servlet.error.message", "Test"); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("exception"), nullValue()); assertThat(attributes.get("message"), equalTo((Object) "Test")); } @Test public void nullMessage() throws Exception { - this.request - .setAttribute("javax.servlet.error.exception", new RuntimeException()); + this.request.setAttribute("javax.servlet.error.exception", + new RuntimeException()); this.request.setAttribute("javax.servlet.error.message", "Test"); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("exception"), equalTo((Object) RuntimeException.class.getName())); assertThat(attributes.get("message"), equalTo((Object) "Test")); @@ -135,8 +135,8 @@ public class DefaultErrorAttributesTests { RuntimeException ex = new RuntimeException("Test"); ServletException wrapped = new ServletException(new ServletException(ex)); this.request.setAttribute("javax.servlet.error.exception", wrapped); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(this.errorAttributes.getError(this.requestAttributes), sameInstance((Object) wrapped)); assertThat(attributes.get("exception"), @@ -148,8 +148,8 @@ public class DefaultErrorAttributesTests { public void getError() throws Exception { Error error = new OutOfMemoryError("Test error"); this.request.setAttribute("javax.servlet.error.exception", error); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(this.errorAttributes.getError(this.requestAttributes), sameInstance((Object) error)); assertThat(attributes.get("exception"), @@ -159,13 +159,13 @@ public class DefaultErrorAttributesTests { @Test public void extractBindingResultErrors() throws Exception { - BindingResult bindingResult = new MapBindingResult(Collections.singletonMap("a", - "b"), "objectName"); + BindingResult bindingResult = new MapBindingResult( + Collections.singletonMap("a", "b"), "objectName"); bindingResult.addError(new ObjectError("c", "d")); BindException ex = new BindException(bindingResult); this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("message"), equalTo((Object) ("Validation failed for " + "object='objectName'. Error count: 1"))); assertThat(attributes.get("errors"), @@ -176,8 +176,8 @@ public class DefaultErrorAttributesTests { public void trace() throws Exception { RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, true); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, true); assertThat(attributes.get("trace").toString(), startsWith("java.lang")); } @@ -185,16 +185,16 @@ public class DefaultErrorAttributesTests { public void noTrace() throws Exception { RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("trace"), nullValue()); } @Test public void path() throws Exception { this.request.setAttribute("javax.servlet.error.request_uri", "path"); - Map attributes = this.errorAttributes.getErrorAttributes( - this.requestAttributes, false); + Map attributes = this.errorAttributes + .getErrorAttributes(this.requestAttributes, false); assertThat(attributes.get("path"), equalTo((Object) "path")); } 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 94af87dc49..663b762f46 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 static @interface MinimalWebConfiguration { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java index 57a328dea2..24b8004fb2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java @@ -241,8 +241,8 @@ public class EmbeddedServletContainerAutoConfigurationTests { } @Component - public static class CallbackEmbeddedContainerCustomizer implements - EmbeddedServletContainerCustomizer { + public static class CallbackEmbeddedContainerCustomizer + implements EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { container.setPort(9000); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java index 7ed483cd8b..fd4f97cd17 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java @@ -75,8 +75,8 @@ public class EmbeddedServletContainerServletContextListenerTests { private void servletContextListenerBeanIsCalled(Class configuration) { AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext( ServletContextListenerBeanConfiguration.class, configuration); - ServletContextListener servletContextListener = context.getBean( - "servletContextListener", ServletContextListener.class); + ServletContextListener servletContextListener = context + .getBean("servletContextListener", ServletContextListener.class); verify(servletContextListener).contextInitialized(any(ServletContextEvent.class)); context.close(); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java index 08521c8db8..e7fae9bf38 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java @@ -94,8 +94,8 @@ public class HttpEncodingAutoConfigurationTests { @Test public void filterIsOrderedHighest() throws Exception { load(OrderedConfiguration.class); - List beans = new ArrayList(this.context.getBeansOfType( - Filter.class).values()); + List beans = new ArrayList( + this.context.getBeansOfType(Filter.class).values()); AnnotationAwareOrderComparator.sort(beans); assertThat(beans.get(0), instanceOf(CharacterEncodingFilter.class)); assertThat(beans.get(1), instanceOf(HiddenHttpMethodFilter.class)); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java index 3caf102054..132aa2c4a4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java @@ -76,8 +76,8 @@ public class HttpMessageConvertersAutoConfigurationTests { assertTrue(this.context.getBeansOfType(ObjectMapper.class).isEmpty()); assertTrue(this.context.getBeansOfType(MappingJackson2HttpMessageConverter.class) .isEmpty()); - assertTrue(this.context.getBeansOfType( - MappingJackson2XmlHttpMessageConverter.class).isEmpty()); + assertTrue(this.context + .getBeansOfType(MappingJackson2XmlHttpMessageConverter.class).isEmpty()); } @Test @@ -89,7 +89,8 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(MappingJackson2HttpMessageConverter.class, "mappingJackson2HttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(MappingJackson2HttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + MappingJackson2HttpMessageConverter.class); } @Test @@ -103,8 +104,10 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(MappingJackson2XmlHttpMessageConverter.class, "mappingJackson2XmlHttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(MappingJackson2HttpMessageConverter.class); - assertConverterBeanRegisteredWithHttpMessageConverters(MappingJackson2XmlHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + MappingJackson2HttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + MappingJackson2XmlHttpMessageConverter.class); } @Test @@ -134,36 +137,36 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(GsonHttpMessageConverter.class, "gsonHttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(GsonHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + GsonHttpMessageConverter.class); } @Test public void jacksonIsPreferredByDefaultWhenBothGsonAndJacksonAreAvailable() { - this.context.register(GsonAutoConfiguration.class, - JacksonAutoConfiguration.class, + this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class); this.context.refresh(); assertConverterBeanExists(MappingJackson2HttpMessageConverter.class, "mappingJackson2HttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(MappingJackson2HttpMessageConverter.class); - assertEquals(0, this.context.getBeansOfType(GsonHttpMessageConverter.class) - .size()); + assertConverterBeanRegisteredWithHttpMessageConverters( + MappingJackson2HttpMessageConverter.class); + assertEquals(0, + this.context.getBeansOfType(GsonHttpMessageConverter.class).size()); } @Test public void gsonCanBePreferredWhenBothGsonAndJacksonAreAvailable() { - this.context.register(GsonAutoConfiguration.class, - JacksonAutoConfiguration.class, + this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "spring.http.converters.preferred-json-mapper:gson"); this.context.refresh(); assertConverterBeanExists(GsonHttpMessageConverter.class, "gsonHttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(GsonHttpMessageConverter.class); - assertEquals(0, - this.context.getBeansOfType(MappingJackson2HttpMessageConverter.class) - .size()); + assertConverterBeanRegisteredWithHttpMessageConverters( + GsonHttpMessageConverter.class); + assertEquals(0, this.context + .getBeansOfType(MappingJackson2HttpMessageConverter.class).size()); } @Test @@ -174,7 +177,8 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(GsonHttpMessageConverter.class, "customGsonMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(GsonHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + GsonHttpMessageConverter.class); } @Test @@ -183,7 +187,8 @@ public class HttpMessageConvertersAutoConfigurationTests { this.context.refresh(); assertConverterBeanExists(StringHttpMessageConverter.class, "stringHttpMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(StringHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + StringHttpMessageConverter.class); } @Test @@ -194,7 +199,8 @@ public class HttpMessageConvertersAutoConfigurationTests { assertConverterBeanExists(StringHttpMessageConverter.class, "customStringMessageConverter"); - assertConverterBeanRegisteredWithHttpMessageConverters(StringHttpMessageConverter.class); + assertConverterBeanRegisteredWithHttpMessageConverters( + StringHttpMessageConverter.class); } @Test @@ -230,9 +236,8 @@ public class HttpMessageConvertersAutoConfigurationTests { BeanDefinition beanDefinition = this.context .getBeanDefinition("mappingJackson2HttpMessageConverter"); - assertThat(beanDefinition.getFactoryBeanName(), - is(equalTo(MappingJackson2HttpMessageConverterConfiguration.class - .getName()))); + assertThat(beanDefinition.getFactoryBeanName(), is(equalTo( + MappingJackson2HttpMessageConverterConfiguration.class.getName()))); } @Test @@ -245,9 +250,8 @@ public class HttpMessageConvertersAutoConfigurationTests { BeanDefinition beanDefinition = this.context .getBeanDefinition("mappingJackson2HttpMessageConverter"); - assertThat(beanDefinition.getFactoryBeanName(), - is(equalTo(MappingJackson2HttpMessageConverterConfiguration.class - .getName()))); + assertThat(beanDefinition.getFactoryBeanName(), is(equalTo( + MappingJackson2HttpMessageConverterConfiguration.class.getName()))); } private void assertConverterBeanExists(Class type, String beanName) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java index 0f3a5937bd..57c29fbb6a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java @@ -58,12 +58,14 @@ public class HttpMessageConvertersTests { for (HttpMessageConverter converter : converters) { converterClasses.add(converter.getClass()); } - assertThat(converterClasses, equalTo(Arrays.>asList( - ByteArrayHttpMessageConverter.class, StringHttpMessageConverter.class, - ResourceHttpMessageConverter.class, SourceHttpMessageConverter.class, - AllEncompassingFormHttpMessageConverter.class, - MappingJackson2HttpMessageConverter.class, - MappingJackson2XmlHttpMessageConverter.class))); + assertThat(converterClasses, + equalTo(Arrays.>asList(ByteArrayHttpMessageConverter.class, + StringHttpMessageConverter.class, + ResourceHttpMessageConverter.class, + SourceHttpMessageConverter.class, + AllEncompassingFormHttpMessageConverter.class, + MappingJackson2HttpMessageConverter.class, + MappingJackson2XmlHttpMessageConverter.class))); } @Test @@ -104,9 +106,10 @@ public class HttpMessageConvertersTests { @Override protected List> postProcessConverters( List> converters) { - for (Iterator> iterator = converters.iterator(); iterator - .hasNext();) { - if (iterator.next() instanceof MappingJackson2XmlHttpMessageConverter) { + for (Iterator> iterator = converters + .iterator(); iterator.hasNext();) { + if (iterator + .next() instanceof MappingJackson2XmlHttpMessageConverter) { iterator.remove(); } } @@ -117,11 +120,13 @@ public class HttpMessageConvertersTests { for (HttpMessageConverter converter : converters) { converterClasses.add(converter.getClass()); } - assertThat(converterClasses, equalTo(Arrays.>asList( - ByteArrayHttpMessageConverter.class, StringHttpMessageConverter.class, - ResourceHttpMessageConverter.class, SourceHttpMessageConverter.class, - AllEncompassingFormHttpMessageConverter.class, - MappingJackson2HttpMessageConverter.class))); + assertThat(converterClasses, + equalTo(Arrays.>asList(ByteArrayHttpMessageConverter.class, + StringHttpMessageConverter.class, + ResourceHttpMessageConverter.class, + SourceHttpMessageConverter.class, + AllEncompassingFormHttpMessageConverter.class, + MappingJackson2HttpMessageConverter.class))); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java index 1546917932..eac7c60ccb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java @@ -219,8 +219,8 @@ public class MultipartAutoConfigurationTests { BaseConfiguration.class); this.context.refresh(); this.context.getBean(MultipartProperties.class); - assertEquals(expectedNumberOfMultipartConfigElementBeans, this.context - .getBeansOfType(MultipartConfigElement.class).size()); + assertEquals(expectedNumberOfMultipartConfigElementBeans, + this.context.getBeansOfType(MultipartConfigElement.class).size()); } @Test @@ -235,8 +235,8 @@ public class MultipartAutoConfigurationTests { private void verify404() throws Exception { HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); - ClientHttpRequest request = requestFactory.createRequest(new URI( - "http://localhost:" + ClientHttpRequest request = requestFactory.createRequest( + new URI("http://localhost:" + this.context.getEmbeddedServletContainer().getPort() + "/"), HttpMethod.GET); ClientHttpResponse response = request.execute(); @@ -245,9 +245,12 @@ public class MultipartAutoConfigurationTests { private void verifyServletWorks() { RestTemplate restTemplate = new RestTemplate(); - assertEquals("Hello", restTemplate.getForObject("http://localhost:" - + this.context.getEmbeddedServletContainer().getPort() + "/", - String.class)); + assertEquals("Hello", + restTemplate + .getForObject( + "http://localhost:" + this.context + .getEmbeddedServletContainer().getPort() + "/", + String.class)); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java index 3223b45e11..98f6ead7ff 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java @@ -56,16 +56,16 @@ public class RemappedErrorViewIntegrationTests { @Test public void directAccessToErrorPage() throws Exception { - String content = this.template.getForObject("http://localhost:" + this.port - + "/spring/error", String.class); + String content = this.template.getForObject( + "http://localhost:" + this.port + "/spring/error", String.class); assertTrue("Wrong content: " + content, content.contains("error")); assertTrue("Wrong content: " + content, content.contains("999")); } @Test public void forwardToErrorPage() throws Exception { - String content = this.template.getForObject("http://localhost:" + this.port - + "/spring/", String.class); + String content = this.template + .getForObject("http://localhost:" + this.port + "/spring/", String.class); assertTrue("Wrong content: " + content, content.contains("error")); assertTrue("Wrong content: " + content, content.contains("500")); } @@ -91,8 +91,8 @@ public class RemappedErrorViewIntegrationTests { // For manual testing public static void main(String[] args) { - new SpringApplicationBuilder(TestConfiguration.class).properties( - "server.servletPath:spring/*").run(args); + new SpringApplicationBuilder(TestConfiguration.class) + .properties("server.servletPath:spring/*").run(args); } } 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 2e172e8220..eee7e9d6b4 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 @@ -55,8 +55,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()); } @@ -71,8 +71,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()); @@ -81,8 +81,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()); @@ -96,25 +96,27 @@ public class ServerPropertiesTests { map.put("server.tomcat.remote_ip_header", "Remote-Ip"); map.put("server.tomcat.internal_proxies", "10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); bindProperties(map); - assertEquals("%h %t '%r' %s %b", this.properties.getTomcat() - .getAccessLogPattern()); + assertEquals("%h %t '%r' %s %b", + this.properties.getTomcat().getAccessLogPattern()); assertEquals("Remote-Ip", this.properties.getTomcat().getRemoteIpHeader()); - assertEquals("X-Forwarded-Protocol", this.properties.getTomcat() - .getProtocolHeader()); - assertEquals("10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}", this.properties.getTomcat() - .getInternalProxies()); + assertEquals("X-Forwarded-Protocol", + this.properties.getTomcat().getProtocolHeader()); + assertEquals("10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}", + this.properties.getTomcat().getInternalProxies()); } @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 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); @@ -241,8 +243,8 @@ public class ServerPropertiesTests { } private void bindProperties(Map map) { - new RelaxedDataBinder(this.properties, "server").bind(new MutablePropertyValues( - map)); + new RelaxedDataBinder(this.properties, "server") + .bind(new MutablePropertyValues(map)); } private String configureCompression(String compression) { 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 601fbfdc38..8c0e03b565 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 @@ -131,8 +131,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/"))); } @Test @@ -284,8 +284,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()) { @@ -334,7 +334,8 @@ public class WebMvcAutoConfigurationTests { HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - assertThat(this.context.getBean("viewResolver"), instanceOf(MyViewResolver.class)); + assertThat(this.context.getBean("viewResolver"), + instanceOf(MyViewResolver.class)); } @Test @@ -358,12 +359,10 @@ public class WebMvcAutoConfigurationTests { HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - 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)); } @@ -377,12 +376,10 @@ public class WebMvcAutoConfigurationTests { EnvironmentTestUtils.addEnvironment(this.context, "spring.mvc.favicon.enabled:false"); this.context.refresh(); - 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())); } @Configuration @@ -395,7 +392,7 @@ public class WebMvcAutoConfigurationTests { @Override protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws Exception { response.getOutputStream().write("Hello World".getBytes()); } }; @@ -408,8 +405,8 @@ public class WebMvcAutoConfigurationTests { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/webjars/**").addResourceLocations( - "classpath:/foo/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/foo/"); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java index 2148f29f09..b884ff205b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java @@ -70,8 +70,8 @@ public class WebSocketAutoConfigurationTests { Class... configuration) { this.context.register(configuration); this.context.refresh(); - Object serverContainer = this.context.getServletContext().getAttribute( - "javax.websocket.server.ServerContainer"); + Object serverContainer = this.context.getServletContext() + .getAttribute("javax.websocket.server.ServerContainer"); assertThat(serverContainer, is(instanceOf(ServerContainer.class))); } 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 8f0b4fd0c3..041d157c6b 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 @@ -38,8 +38,8 @@ public class CommandLineIT { private final CommandLineInvoker cli = new CommandLineInvoker(); @Test - public void hintProducesListOfValidCommands() throws IOException, - InterruptedException { + public void hintProducesListOfValidCommands() + throws IOException, InterruptedException { Invocation cli = this.cli.invoke("hint"); assertThat(cli.await(), equalTo(0)); assertThat(cli.getErrorOutput().length(), equalTo(0)); @@ -47,8 +47,8 @@ public class CommandLineIT { } @Test - public void invokingWithNoArgumentsDisplaysHelp() throws IOException, - InterruptedException { + public void invokingWithNoArgumentsDisplaysHelp() + throws IOException, InterruptedException { Invocation cli = this.cli.invoke(); assertThat(cli.await(), equalTo(1)); assertThat(cli.getErrorOutput().length(), equalTo(0)); @@ -56,8 +56,8 @@ public class CommandLineIT { } @Test - public void unrecognizedCommandsAreHandledGracefully() throws IOException, - InterruptedException { + public void unrecognizedCommandsAreHandledGracefully() + throws IOException, InterruptedException { Invocation cli = this.cli.invoke("not-a-real-command"); assertThat(cli.await(), equalTo(1)); assertThat(cli.getErrorOutput(), diff --git a/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java b/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java index cf1b508a79..62494e157e 100644 --- a/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java +++ b/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java @@ -38,8 +38,8 @@ import static org.junit.Assert.assertTrue; */ public class JarCommandIT { - private final CommandLineInvoker cli = new CommandLineInvoker(new File( - "src/it/resources/jar-command")); + private final CommandLineInvoker cli = new CommandLineInvoker( + new File("src/it/resources/jar-command")); @Test public void noArguments() throws Exception { @@ -68,11 +68,12 @@ public class JarCommandIT { assertThat(invocation.getErrorOutput(), equalTo("")); invocation = this.cli.invoke("jar", jar.getAbsolutePath(), "bad.groovy"); invocation.await(); - assertEquals(invocation.getErrorOutput(), 0, invocation.getErrorOutput().length()); + assertEquals(invocation.getErrorOutput(), 0, + invocation.getErrorOutput().length()); assertTrue(jar.exists()); - Process process = new JavaExecutable().processBuilder("-jar", - jar.getAbsolutePath()).start(); + Process process = new JavaExecutable() + .processBuilder("-jar", jar.getAbsolutePath()).start(); invocation = new Invocation(process); invocation.await(); @@ -85,11 +86,12 @@ public class JarCommandIT { Invocation invocation = this.cli.invoke("jar", jar.getAbsolutePath(), "jar.groovy"); invocation.await(); - assertEquals(invocation.getErrorOutput(), 0, invocation.getErrorOutput().length()); + assertEquals(invocation.getErrorOutput(), 0, + invocation.getErrorOutput().length()); assertTrue(jar.exists()); - Process process = new JavaExecutable().processBuilder("-jar", - jar.getAbsolutePath()).start(); + Process process = new JavaExecutable() + .processBuilder("-jar", jar.getAbsolutePath()).start(); invocation = new Invocation(process); invocation.await(); @@ -107,14 +109,15 @@ public class JarCommandIT { @Test public void jarCreationWithIncludes() throws Exception { File jar = new File("target/test-app.jar"); - Invocation invocation = this.cli.invoke("jar", jar.getAbsolutePath(), - "--include", "-public/**,-resources/**", "jar.groovy"); + Invocation invocation = this.cli.invoke("jar", jar.getAbsolutePath(), "--include", + "-public/**,-resources/**", "jar.groovy"); invocation.await(); - assertEquals(invocation.getErrorOutput(), 0, invocation.getErrorOutput().length()); + assertEquals(invocation.getErrorOutput(), 0, + invocation.getErrorOutput().length()); assertTrue(jar.exists()); - Process process = new JavaExecutable().processBuilder("-jar", - jar.getAbsolutePath()).start(); + Process process = new JavaExecutable() + .processBuilder("-jar", jar.getAbsolutePath()).start(); invocation = new Invocation(process); invocation.await(); diff --git a/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java b/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java index 9f4f28e62c..a946e12d79 100644 --- a/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java +++ b/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java @@ -71,8 +71,8 @@ public final class CommandLineInvoker { return pathname.isDirectory() && pathname.getName().contains("-bin"); } })[0]; - dir = new File(dir, dir.getName().replace("-bin", "") - .replace("spring-boot-cli", "spring")); + dir = new File(dir, + dir.getName().replace("-bin", "").replace("spring-boot-cli", "spring")); dir = new File(dir, "bin"); File launchScript = new File(dir, isWindows() ? "spring.bat" : "spring"); Assert.state(launchScript.exists() && launchScript.isFile(), @@ -99,10 +99,10 @@ public final class CommandLineInvoker { public Invocation(Process process) { this.process = process; - this.streamReaders.add(new Thread(new StreamReadingRunnable(this.process - .getErrorStream(), this.err))); - this.streamReaders.add(new Thread(new StreamReadingRunnable(this.process - .getInputStream(), this.out))); + this.streamReaders.add(new Thread( + new StreamReadingRunnable(this.process.getErrorStream(), this.err))); + this.streamReaders.add(new Thread( + new StreamReadingRunnable(this.process.getInputStream(), this.out))); for (Thread streamReader : this.streamReaders) { streamReader.start(); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java index d7563985b3..c4e526503b 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java @@ -56,8 +56,8 @@ public class SpringCli { } private static void addServiceLoaderCommands(CommandRunner runner) { - ServiceLoader factories = ServiceLoader.load( - CommandFactory.class, runner.getClass().getClassLoader()); + ServiceLoader factories = ServiceLoader.load(CommandFactory.class, + runner.getClass().getClassLoader()); for (CommandFactory factory : factories) { runner.addCommands(factory.getCommands()); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java index e646c55737..e557e123a3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java @@ -149,8 +149,8 @@ public class CommandRunner implements Iterable { public Command findCommand(String name) { for (Command candidate : this.commands) { String candidateName = candidate.getName(); - if (candidateName.equals(name) - || (isOptionCommand(candidate) && ("--" + candidateName).equals(name))) { + if (candidateName.equals(name) || (isOptionCommand(candidate) + && ("--" + candidateName).equals(name))) { return candidate; } } @@ -284,8 +284,8 @@ public class CommandRunner implements Iterable { String usageHelp = command.getUsageHelp(); String description = command.getDescription(); Log.info(String.format("\n %1$s %2$-15s\n %3$s", command.getName(), - (usageHelp == null ? "" : usageHelp), (description == null ? "" - : description))); + (usageHelp == null ? "" : usageHelp), + (description == null ? "" : description))); } } Log.info(""); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/OptionParsingCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/OptionParsingCommand.java index b48884d0eb..5e1a8abc92 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/OptionParsingCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/OptionParsingCommand.java @@ -33,7 +33,8 @@ public abstract class OptionParsingCommand extends AbstractCommand { private final OptionHandler handler; - protected OptionParsingCommand(String name, String description, OptionHandler handler) { + protected OptionParsingCommand(String name, String description, + OptionHandler handler) { super(name, description); this.handler = handler; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java index 3b763931aa..8126edc005 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java @@ -83,8 +83,8 @@ public class HintCommand extends AbstractCommand { return false; } return command.getName().startsWith(starting) - || (this.commandRunner.isOptionCommand(command) && ("--" + command - .getName()).startsWith(starting)); + || (this.commandRunner.isOptionCommand(command) + && ("--" + command.getName()).startsWith(starting)); } private void showCommandOptionHints(String commandName, 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 67d43b2871..8bd3146179 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 @@ -46,8 +46,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 @@ -106,8 +107,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"); @@ -118,9 +119,8 @@ public class InitCommand extends OptionParsingCommand { private void projectGenerationOptions() { this.bootVersion = option(Arrays.asList("boot-version", "b"), "Spring Boot version to use (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 dependencies to include in the " + "generated project").withRequiredArg(); this.javaVersion = option(Arrays.asList("java-version", "j"), @@ -129,14 +129,12 @@ public class InitCommand extends OptionParsingCommand { "Packaging type to use (for example 'jar')").withRequiredArg(); this.build = option("build", "The build system to use (for example 'maven' or 'gradle')") - .withRequiredArg().defaultsTo("maven"); - this.format = option( - "format", + .withRequiredArg().defaultsTo("maven"); + this.format = option("format", "The format of the generated content (for example 'build' for a build file, " + "'project' for a project archive)").withRequiredArg() - .defaultsTo("project"); - this.type = option( - Arrays.asList("type", "t"), + .defaultsTo("project"); + this.type = option(Arrays.asList("type", "t"), "The project type to use. Not normally needed if you use --build " + "and/or --format. Check the capabilities of the service " + "(--list) for more details").withRequiredArg(); @@ -171,7 +169,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/init/InitializrService.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java index 27ebbe2a0c..02db5618b1 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java @@ -104,7 +104,8 @@ class InitializrService { * @throws IOException if the service's metadata cannot be loaded */ public InitializrServiceMetadata loadMetadata(String serviceUrl) throws IOException { - CloseableHttpResponse httpResponse = executeInitializrMetadataRetrieval(serviceUrl); + CloseableHttpResponse httpResponse = executeInitializrMetadataRetrieval( + serviceUrl); validateResponse(httpResponse, serviceUrl); return parseJsonMetadata(httpResponse.getEntity()); } @@ -120,8 +121,10 @@ class InitializrService { */ public Object loadServiceCapabilities(String serviceUrl) throws IOException { HttpGet request = new HttpGet(serviceUrl); - request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_SERVICE_CAPABILITIES)); - CloseableHttpResponse httpResponse = execute(request, serviceUrl, "retrieve help"); + request.setHeader( + new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_SERVICE_CAPABILITIES)); + CloseableHttpResponse httpResponse = execute(request, serviceUrl, + "retrieve help"); validateResponse(httpResponse, serviceUrl); HttpEntity httpEntity = httpResponse.getEntity(); ContentType contentType = ContentType.getOrDefault(httpEntity); @@ -137,15 +140,15 @@ class InitializrService { return new InitializrServiceMetadata(getContentAsJson(httpEntity)); } catch (JSONException ex) { - throw new ReportableException("Invalid content received from server (" - + ex.getMessage() + ")", ex); + throw new ReportableException( + "Invalid content received from server (" + ex.getMessage() + ")", ex); } } private void validateResponse(CloseableHttpResponse httpResponse, String serviceUrl) { if (httpResponse.getEntity() == null) { - throw new ReportableException("No content received from server '" - + serviceUrl + "'"); + throw new ReportableException( + "No content received from server '" + serviceUrl + "'"); } if (httpResponse.getStatusLine().getStatusCode() != 200) { throw createException(serviceUrl, httpResponse); @@ -157,8 +160,8 @@ class InitializrService { ProjectGenerationResponse response = new ProjectGenerationResponse( ContentType.getOrDefault(httpEntity)); response.setContent(FileCopyUtils.copyToByteArray(httpEntity.getContent())); - String fileName = extractFileName(httpResponse - .getFirstHeader("Content-Disposition")); + String fileName = extractFileName( + httpResponse.getFirstHeader("Content-Disposition")); if (fileName != null) { response.setFileName(fileName); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java index 5d375c7166..242c465792 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java @@ -68,8 +68,8 @@ class InitializrServiceMetadata { public InitializrServiceMetadata(ProjectType defaultProjectType) { this.dependencies = new HashMap(); this.projectTypes = new MetadataHolder(); - this.projectTypes.getContent() - .put(defaultProjectType.getId(), defaultProjectType); + this.projectTypes.getContent().put(defaultProjectType.getId(), + defaultProjectType); this.projectTypes.setDefaultItem(defaultProjectType); this.defaults = new HashMap(); } @@ -145,8 +145,8 @@ class InitializrServiceMetadata { } JSONObject type = root.getJSONObject(TYPE_EL); JSONArray array = type.getJSONArray(VALUES_EL); - String defaultType = type.has(DEFAULT_ATTRIBUTE) ? type - .getString(DEFAULT_ATTRIBUTE) : null; + String defaultType = type.has(DEFAULT_ATTRIBUTE) + ? type.getString(DEFAULT_ATTRIBUTE) : null; for (int i = 0; i < array.length(); i++) { JSONObject typeJson = array.getJSONObject(i); ProjectType projectType = parseType(typeJson, defaultType); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java index 2e33abb551..c76b7474e5 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java @@ -246,8 +246,8 @@ class ProjectGenerationRequest { if (this.type != null) { ProjectType result = metadata.getProjectTypes().get(this.type); if (result == null) { - throw new ReportableException( - ("No project type with id '" + this.type + "' - check the service capabilities (--list)")); + throw new ReportableException(("No project type with id '" + this.type + + "' - check the service capabilities (--list)")); } return result; } @@ -287,8 +287,8 @@ class ProjectGenerationRequest { private static void filter(Map projects, String tag, String tagValue) { - for (Iterator> it = projects.entrySet().iterator(); it - .hasNext();) { + for (Iterator> it = projects.entrySet() + .iterator(); it.hasNext();) { Map.Entry entry = it.next(); String value = entry.getValue().getTags().get(tag); if (!tagValue.equals(value)) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java index 08c54887c9..3355eb4dcd 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java @@ -46,8 +46,8 @@ class ProjectGenerator { public void generateProject(ProjectGenerationRequest request, boolean force) throws IOException { ProjectGenerationResponse response = this.initializrService.generate(request); - String fileName = (request.getOutput() != null ? request.getOutput() : response - .getFileName()); + String fileName = (request.getOutput() != null ? request.getOutput() + : response.getFileName()); if (shouldExtract(request, response)) { if (isZipArchive(response)) { extractProject(response, request.getOutput(), force); @@ -97,13 +97,13 @@ class ProjectGenerator { private void extractProject(ProjectGenerationResponse entity, String output, boolean overwrite) throws IOException { - File outputFolder = (output != null ? new File(output) : new File( - System.getProperty("user.dir"))); + File outputFolder = (output != null ? new File(output) + : new File(System.getProperty("user.dir"))); if (!outputFolder.exists()) { outputFolder.mkdirs(); } - ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream( - entity.getContent())); + ZipInputStream zipStream = new ZipInputStream( + new ByteArrayInputStream(entity.getContent())); try { extractFromStream(zipStream, overwrite, outputFolder); Log.info("Project extracted to '" + outputFolder.getAbsolutePath() + "'"); @@ -146,8 +146,8 @@ class ProjectGenerator { + "overwrite or specify an alternate location."); } if (!outputFile.delete()) { - throw new ReportableException("Failed to delete existing file " - + outputFile.getPath()); + throw new ReportableException( + "Failed to delete existing file " + outputFile.getPath()); } } FileCopyUtils.copy(entity.getContent(), outputFile); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java index b3c2ce4899..85acae36e1 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java @@ -133,10 +133,12 @@ class ServiceCapabilitiesReportGenerator { report.append("]"); } - private void reportDefaults(StringBuilder report, InitializrServiceMetadata metadata) { + private void reportDefaults(StringBuilder report, + InitializrServiceMetadata metadata) { report.append("Defaults:" + NEW_LINE); report.append("---------" + NEW_LINE); - List defaultsKeys = new ArrayList(metadata.getDefaults().keySet()); + List defaultsKeys = new ArrayList( + metadata.getDefaults().keySet()); Collections.sort(defaultsKeys); for (String defaultsKey : defaultsKeys) { String defaultsValue = metadata.getDefaults().get(defaultsKey); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java index 6df544f34d..3c1a50d5aa 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java @@ -48,8 +48,8 @@ class Installer { public Installer(OptionSet options, CompilerOptionHandler compilerOptionHandler) throws IOException { - this(new GroovyGrabDependencyResolver(createCompilerConfiguration(options, - compilerOptionHandler))); + this(new GroovyGrabDependencyResolver( + createCompilerConfiguration(options, compilerOptionHandler))); } public Installer(DependencyResolver resolver) 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 d5dca0952a..2e0d5eef0f 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 @@ -76,8 +76,9 @@ public class JarCommand extends OptionParsingCommand { private static final byte[] ZIP_FILE_HEADER = new byte[] { 'P', 'K', 3, 4 }; 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()); } @@ -94,14 +95,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 @@ -112,8 +111,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); @@ -134,8 +133,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()); } } @@ -167,7 +166,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 { JarWriter writer = new JarWriter(file); try { addManifest(writer, compiledClasses); @@ -254,8 +253,8 @@ public class JarCommand extends OptionParsingCommand { private void addDependency(JarWriter writer, File dependency) throws FileNotFoundException, IOException { if (dependency.isFile() && isZip(dependency)) { - writer.writeNestedLibrary("lib/", new Library(dependency, - LibraryScope.COMPILE)); + writer.writeNestedLibrary("lib/", + new Library(dependency, LibraryScope.COMPILE)); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/ResourceMatcher.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/ResourceMatcher.java index cca57ced40..2d2f4f1439 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/ResourceMatcher.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/ResourceMatcher.java @@ -187,8 +187,8 @@ class ResourceMatcher { } private MatchedResource(File rootFolder, File file) { - this.name = StringUtils.cleanPath(file.getAbsolutePath().substring( - rootFolder.getAbsolutePath().length() + 1)); + this.name = StringUtils.cleanPath(file.getAbsolutePath() + .substring(rootFolder.getAbsolutePath().length() + 1)); this.file = file; this.root = false; } 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 926d9d27b3..f6ebb8cd41 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(asList("classpath", "cp"), "Additional classpath entries").withRequiredArg(); doOptions(); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java index 7c07d7e74e..9a20b653db 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java @@ -42,8 +42,8 @@ public class OptionSetGroovyCompilerConfiguration implements GroovyCompilerConfi protected OptionSetGroovyCompilerConfiguration(OptionSet optionSet, CompilerOptionHandler compilerOptionHandler) { - this(optionSet, compilerOptionHandler, RepositoryConfigurationFactory - .createDefaultRepositoryConfiguration()); + this(optionSet, compilerOptionHandler, + RepositoryConfigurationFactory.createDefaultRepositoryConfiguration()); } public OptionSetGroovyCompilerConfiguration(OptionSet optionSet, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java index 0c1a03a484..6c5d089752 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java @@ -94,8 +94,8 @@ public class SourceOptions { } } } - this.args = Collections.unmodifiableList(nonOptionArguments.subList( - sourceArgCount, nonOptionArguments.size())); + this.args = Collections.unmodifiableList( + nonOptionArguments.subList(sourceArgCount, nonOptionArguments.size())); Assert.isTrue(sources.size() > 0, "Please specify at least one file"); this.sources = Collections.unmodifiableList(sources); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java index efb387f295..2f362d84c1 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java @@ -97,8 +97,8 @@ public class RunCommand extends OptionParsingCommand { List repositoryConfiguration = RepositoryConfigurationFactory .createDefaultRepositoryConfiguration(); - repositoryConfiguration.add(0, new RepositoryConfiguration("local", new File( - "repository").toURI(), true)); + repositoryConfiguration.add(0, new RepositoryConfiguration("local", + new File("repository").toURI(), true)); SpringApplicationRunnerConfiguration configuration = new SpringApplicationRunnerConfigurationAdapter( options, this, repositoryConfiguration); @@ -114,9 +114,9 @@ public class RunCommand extends OptionParsingCommand { * Simple adapter class to present the {@link OptionSet} as a * {@link SpringApplicationRunnerConfiguration}. */ - private class SpringApplicationRunnerConfigurationAdapter extends - OptionSetGroovyCompilerConfiguration implements - SpringApplicationRunnerConfiguration { + private class SpringApplicationRunnerConfigurationAdapter + extends OptionSetGroovyCompilerConfiguration + implements SpringApplicationRunnerConfiguration { public SpringApplicationRunnerConfigurationAdapter(OptionSet options, CompilerOptionHandler optionHandler, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java index 9d9f6be2bd..dda6b010a1 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java @@ -147,7 +147,7 @@ public class SpringApplicationRunner { try { this.applicationContext = new SpringApplicationLauncher( getContextClassLoader()).launch(this.compiledSources, - SpringApplicationRunner.this.args); + SpringApplicationRunner.this.args); } catch (Exception ex) { ex.printStackTrace(); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerConfiguration.java index 80e608502a..354f38d28d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunnerConfiguration.java @@ -25,7 +25,8 @@ import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration; * * @author Phillip Webb */ -public interface SpringApplicationRunnerConfiguration extends GroovyCompilerConfiguration { +public interface SpringApplicationRunnerConfiguration + extends GroovyCompilerConfiguration { /** * Returns {@code true} if the source file should be monitored for changes and diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java index 68d690eaea..dd0179b4e5 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java @@ -61,8 +61,8 @@ public class CommandCompleter extends StringsCompleter { } AggregateCompleter arguementCompleters = new AggregateCompleter( new StringsCompleter(options), new FileNameCompleter()); - ArgumentCompleter argumentCompleter = new ArgumentCompleter( - argumentDelimiter, arguementCompleters); + ArgumentCompleter argumentCompleter = new ArgumentCompleter(argumentDelimiter, + arguementCompleters); argumentCompleter.setStrict(false); this.commandCompleters.put(command.getName(), argumentCompleter); } @@ -99,8 +99,8 @@ public class CommandCompleter extends StringsCompleter { for (OptionHelp optionHelp : command.getOptionsHelp()) { OptionHelpLine optionHelpLine = new OptionHelpLine(optionHelp); optionHelpLines.add(optionHelpLine); - maxOptionsLength = Math.max(maxOptionsLength, optionHelpLine.getOptions() - .length()); + maxOptionsLength = Math.max(maxOptionsLength, + optionHelpLine.getOptions().length()); } this.console.println(); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java index 8e84600122..e71908ff86 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java @@ -49,6 +49,7 @@ import jline.console.completer.CandidateListCompletionHandler; public class Shell { private static final Set> NON_FORKED_COMMANDS; + static { Set> nonForked = new HashSet>(); nonForked.add(VersionCommand.class); @@ -86,8 +87,8 @@ public class Shell { private Iterable getCommands() { List commands = new ArrayList(); - ServiceLoader factories = ServiceLoader.load( - CommandFactory.class, getClass().getClassLoader()); + ServiceLoader factories = ServiceLoader.load(CommandFactory.class, + getClass().getClassLoader()); for (CommandFactory factory : factories) { for (Command command : factory.getCommands()) { commands.add(convertToForkCommand(command)); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java index 5146af1777..21d81d830d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java @@ -96,7 +96,8 @@ public class TestRunner { if (sources.length != 0 && sources[0] instanceof Class) { setContextClassLoader(((Class) sources[0]).getClassLoader()); } - this.spockSpecificationClass = loadSpockSpecificationClass(getContextClassLoader()); + this.spockSpecificationClass = loadSpockSpecificationClass( + getContextClassLoader()); this.testClasses = getTestClasses(sources); } @@ -136,8 +137,8 @@ public class TestRunner { } private boolean isSpockTest(Class sourceClass) { - return (this.spockSpecificationClass != null && this.spockSpecificationClass - .isAssignableFrom(sourceClass)); + return (this.spockSpecificationClass != null + && this.spockSpecificationClass.isAssignableFrom(sourceClass)); } @Override @@ -157,8 +158,8 @@ public class TestRunner { resultClass); Object result = resultClass.newInstance(); runMethod.invoke(null, this.testClasses, result); - boolean wasSuccessful = (Boolean) resultClass.getMethod( - "wasSuccessful").invoke(result); + boolean wasSuccessful = (Boolean) resultClass + .getMethod("wasSuccessful").invoke(result); if (!wasSuccessful) { throw new RuntimeException("Tests Failed."); } 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 37a8a2e35e..888cc20fde 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 @@ -95,8 +95,8 @@ public abstract class AnnotatedNodeASTTransformation implements ASTTransformatio private void visitAnnotatedNode(AnnotatedNode annotatedNode) { if (annotatedNode != null) { for (AnnotationNode annotationNode : annotatedNode.getAnnotations()) { - if (this.interestingAnnotationNames.contains(annotationNode - .getClassNode().getName())) { + if (this.interestingAnnotationNames + .contains(annotationNode.getClassNode().getName())) { this.annotationNodes.add(annotationNode); } } 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 dd7eb0fad0..8f7131db6a 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 @@ -78,8 +78,8 @@ public abstract class AstUtils { String... annotations) { for (AnnotationNode annotationNode : node.getAnnotations()) { for (String annotation : annotations) { - if (PatternMatchUtils.simpleMatch(annotation, annotationNode - .getClassNode().getName())) { + if (PatternMatchUtils.simpleMatch(annotation, + annotationNode.getClassNode().getName())) { return true; } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java index 6b04557f98..e29c89e8bd 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java @@ -89,8 +89,8 @@ public abstract class CompilerAutoConfiguration { * @param classNode the class * @throws CompilationFailedException if the configuration cannot be applied */ - public void apply(GroovyClassLoader loader, - GroovyCompilerConfiguration configuration, GeneratorContext generatorContext, - SourceUnit source, ClassNode classNode) throws CompilationFailedException { + public void apply(GroovyClassLoader loader, GroovyCompilerConfiguration configuration, + GeneratorContext generatorContext, SourceUnit source, ClassNode classNode) + throws CompilationFailedException { } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java index 2166c82843..30e7d5a85d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java @@ -74,8 +74,8 @@ public class DependencyCustomizer { } public String getVersion(String artifactId, String defaultVersion) { - String version = this.dependencyResolutionContext - .getArtifactCoordinatesResolver().getVersion(artifactId); + String version = this.dependencyResolutionContext.getArtifactCoordinatesResolver() + .getVersion(artifactId); if (version == null) { version = defaultVersion; } @@ -224,11 +224,11 @@ public class DependencyCustomizer { if (canAdd()) { ArtifactCoordinatesResolver artifactCoordinatesResolver = this.dependencyResolutionContext .getArtifactCoordinatesResolver(); - this.classNode.addAnnotation(createGrabAnnotation( - artifactCoordinatesResolver.getGroupId(module), - artifactCoordinatesResolver.getArtifactId(module), - artifactCoordinatesResolver.getVersion(module), classifier, type, - transitive)); + this.classNode.addAnnotation( + createGrabAnnotation(artifactCoordinatesResolver.getGroupId(module), + artifactCoordinatesResolver.getArtifactId(module), + artifactCoordinatesResolver.getVersion(module), classifier, + type, transitive)); } return this; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java index 3c08f060e0..10a6f060c9 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java @@ -160,8 +160,8 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader { @Override protected Class createClass(byte[] code, ClassNode classNode) { Class createdClass = super.createClass(code, classNode); - ExtendedGroovyClassLoader.this.classResources.put(classNode.getName() - .replace(".", "/") + ".class", code); + ExtendedGroovyClassLoader.this.classResources + .put(classNode.getName().replace(".", "/") + ".class", code); return createdClass; } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GrabMetadataTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GrabMetadataTransformation.java index f769a513a0..f54daac201 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GrabMetadataTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GrabMetadataTransformation.java @@ -84,14 +84,16 @@ public class GrabMetadataTransformation extends AnnotatedNodeASTTransformation { private void processGrabMetadataAnnotation(AnnotationNode annotationNode) { Expression valueExpression = annotationNode.getMember("value"); - List> metadataDependencies = createDependencyMaps(valueExpression); + List> metadataDependencies = createDependencyMaps( + valueExpression); updateArtifactCoordinatesResolver(metadataDependencies); } private List> createDependencyMaps(Expression valueExpression) { Map dependency = null; - List constantExpressions = getConstantExpressions(valueExpression); + List constantExpressions = getConstantExpressions( + valueExpression); List> dependencies = new ArrayList>( constantExpressions.size()); @@ -131,7 +133,8 @@ public class GrabMetadataTransformation extends AnnotatedNodeASTTransformation { 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 @@ -139,8 +142,9 @@ public class GrabMetadataTransformation extends AnnotatedNodeASTTransformation { 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; @@ -159,8 +163,8 @@ public class GrabMetadataTransformation extends AnnotatedNodeASTTransformation { List managedDependencies = new ArrayList(uris.length); for (URI uri : uris) { try { - managedDependencies.add(new PropertiesFileDependencies(uri.toURL() - .openStream())); + managedDependencies + .add(new PropertiesFileDependencies(uri.toURL().openStream())); } catch (IOException ex) { throw new IllegalStateException("Failed to parse '" + uris[0] @@ -168,8 +172,8 @@ public class GrabMetadataTransformation extends AnnotatedNodeASTTransformation { } } - this.resolutionContext.setManagedDependencies(ManagedDependencies - .get(managedDependencies)); + this.resolutionContext + .setManagedDependencies(ManagedDependencies.get(managedDependencies)); } private void handleDuplicateGrabMetadataAnnotation(AnnotationNode annotationNode) { @@ -180,13 +184,14 @@ public class GrabMetadataTransformation extends AnnotatedNodeASTTransformation { } 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()); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java index abe81475db..a7d9a5826d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java @@ -49,7 +49,8 @@ public class GroovyBeansTransformation implements ASTTransformation { for (ASTNode node : nodes) { if (node instanceof ModuleNode) { ModuleNode module = (ModuleNode) node; - for (ClassNode classNode : new ArrayList(module.getClasses())) { + for (ClassNode classNode : new ArrayList( + module.getClasses())) { if (classNode.isScript()) { classNode.visitContents(new ClassVisitor(source, classNode)); } @@ -88,9 +89,10 @@ public class GroovyBeansTransformation implements ASTTransformation { // Implement the interface by adding a public read-only property with the // same name as the method in the interface (getBeans). Make it return the // closure. - this.classNode.addProperty(new PropertyNode(BEANS, Modifier.PUBLIC - | Modifier.FINAL, ClassHelper.CLOSURE_TYPE - .getPlainNodeReference(), this.classNode, closure, null, null)); + this.classNode.addProperty( + new PropertyNode(BEANS, Modifier.PUBLIC | Modifier.FINAL, + ClassHelper.CLOSURE_TYPE.getPlainNodeReference(), + this.classNode, closure, null, null)); // Only do this once per class this.xformed = true; } 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 58669f639d..d559ab574f 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 * 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); @@ -110,8 +112,8 @@ public class GroovyCompiler { 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)) { @@ -173,8 +175,8 @@ public class GroovyCompiler { * @throws CompilationFailedException * @throws IOException */ - public Class[] compile(String... sources) throws CompilationFailedException, - IOException { + public Class[] compile(String... sources) + throws CompilationFailedException, IOException { this.loader.clearCache(); List> classes = new ArrayList>(); @@ -272,8 +274,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 = getMainClass(source.getAST().getClasses()); // Additional auto configuration @@ -288,10 +290,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); 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 9f3892a21c..7e140d4078 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 @@ -95,8 +95,8 @@ public final class RepositoryConfigurationFactory { .getEffectiveSettings(); } catch (SettingsBuildingException ex) { - throw new IllegalStateException("Failed to build settings from " - + settingsFile, ex); + throw new IllegalStateException( + "Failed to build settings from " + settingsFile, ex); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java index b5acb22dbd..c32c11fd19 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java @@ -38,14 +38,14 @@ import groovy.lang.Grab; * @author Phillip Webb */ @Order(ResolveDependencyCoordinatesTransformation.ORDER) -public class ResolveDependencyCoordinatesTransformation extends - AnnotatedNodeASTTransformation { +public class ResolveDependencyCoordinatesTransformation + extends AnnotatedNodeASTTransformation { public static final int ORDER = GrabMetadataTransformation.ORDER + 300; private static final Set GRAB_ANNOTATION_NAMES = Collections - .unmodifiableSet(new HashSet(Arrays.asList(Grab.class.getName(), - Grab.class.getSimpleName()))); + .unmodifiableSet(new HashSet( + Arrays.asList(Grab.class.getName(), Grab.class.getSimpleName()))); private final DependencyResolutionContext resolutionContext; 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 0f607ea56f..414084f3de 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 @@ -40,8 +40,8 @@ class SmartImportCustomizer extends ImportCustomizer { @Override public ImportCustomizer addImport(String alias, String className) { - if (this.source.getAST().getImport( - ClassHelper.make(className).getNameWithoutPackage()) == null) { + if (this.source.getAST() + .getImport(ClassHelper.make(className).getNameWithoutPackage()) == null) { super.addImport(alias, className); } return this; @@ -50,8 +50,8 @@ class SmartImportCustomizer extends ImportCustomizer { @Override public ImportCustomizer addImports(String... imports) { for (String alias : imports) { - if (this.source.getAST().getImport( - ClassHelper.make(alias).getNameWithoutPackage()) == null) { + if (this.source.getAST() + .getImport(ClassHelper.make(alias).getNameWithoutPackage()) == null) { super.addImports(alias); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/GroovyTemplatesCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/GroovyTemplatesCompilerAutoConfiguration.java index 2193221665..0a3aaeeb99 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/GroovyTemplatesCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/GroovyTemplatesCompilerAutoConfiguration.java @@ -39,8 +39,8 @@ public class GroovyTemplatesCompilerAutoConfiguration extends CompilerAutoConfig @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses("groovy.text.TemplateEngine").add( - "groovy-templates"); + dependencies.ifAnyMissingClasses("groovy.text.TemplateEngine") + .add("groovy-templates"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JmsCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JmsCompilerAutoConfiguration.java index 8fdb271470..7225854853 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JmsCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JmsCompilerAutoConfiguration.java @@ -49,8 +49,8 @@ public class JmsCompilerAutoConfiguration extends CompilerAutoConfiguration { imports.addStarImports("javax.jms", "org.springframework.jms.annotation", "org.springframework.jms.config", "org.springframework.jms.core", "org.springframework.jms.listener", - "org.springframework.jms.listener.adapter").addImports( - org.springframework.boot.groovy.EnableJmsMessaging.class + "org.springframework.jms.listener.adapter") + .addImports(org.springframework.boot.groovy.EnableJmsMessaging.class .getCanonicalName()); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/RabbitCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/RabbitCompilerAutoConfiguration.java index 686fc76b24..21d48439d0 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/RabbitCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/RabbitCompilerAutoConfiguration.java @@ -53,8 +53,9 @@ public class RabbitCompilerAutoConfiguration extends CompilerAutoConfiguration { "org.springframework.amqp.rabbit.connection", "org.springframework.amqp.rabbit.listener", "org.springframework.amqp.rabbit.listener.adapter", - "org.springframework.amqp.core").addImports( - org.springframework.boot.groovy.EnableRabbitMessaging.class.getName()); + "org.springframework.amqp.core") + .addImports(org.springframework.boot.groovy.EnableRabbitMessaging.class + .getName()); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java index 77d6c9f7a7..b373c82047 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java @@ -37,16 +37,15 @@ public class SpringBatchCompilerAutoConfiguration extends CompilerAutoConfigurat @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses("org.springframework.batch.core.Job").add( - "spring-boot-starter-batch"); + dependencies.ifAnyMissingClasses("org.springframework.batch.core.Job") + .add("spring-boot-starter-batch"); dependencies.ifAnyMissingClasses("org.springframework.jdbc.core.JdbcTemplate") .add("spring-jdbc"); } @Override public void applyImports(ImportCustomizer imports) { - imports.addImports( - "org.springframework.batch.repeat.RepeatStatus", + imports.addImports("org.springframework.batch.repeat.RepeatStatus", "org.springframework.batch.core.scope.context.ChunkContext", "org.springframework.batch.core.step.tasklet.Tasklet", "org.springframework.batch.core.configuration.annotation.StepScope", diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java index 43d92fe6f3..d72aea3cb0 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java @@ -45,10 +45,8 @@ public class SpringBootCompilerAutoConfiguration extends CompilerAutoConfigurati @Override public void applyImports(ImportCustomizer imports) { - imports.addImports( - "javax.annotation.PostConstruct", - "javax.annotation.PreDestroy", - "groovy.util.logging.Log", + imports.addImports("javax.annotation.PostConstruct", + "javax.annotation.PreDestroy", "groovy.util.logging.Log", "org.springframework.stereotype.Controller", "org.springframework.stereotype.Service", "org.springframework.stereotype.Component", diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java index 256f407041..c7452d23b0 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java @@ -28,7 +28,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Dave Syer * @author Artem Bilan */ -public class SpringIntegrationCompilerAutoConfiguration extends CompilerAutoConfiguration { +public class SpringIntegrationCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -38,9 +39,10 @@ public class SpringIntegrationCompilerAutoConfiguration extends CompilerAutoConf @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses( - "org.springframework.integration.config.EnableIntegration").add( - "spring-boot-starter-integration"); + dependencies + .ifAnyMissingClasses( + "org.springframework.integration.config.EnableIntegration") + .add("spring-boot-starter-integration"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java index 2aeb42cb34..a564067b3b 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java @@ -33,17 +33,16 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio @Override public boolean matches(ClassNode classNode) { - return AstUtils.hasAtLeastOneAnnotation(classNode, "Controller", - "RestController", "EnableWebMvc"); + return AstUtils.hasAtLeastOneAnnotation(classNode, "Controller", "RestController", + "EnableWebMvc"); } @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies - .ifAnyMissingClasses("org.springframework.web.servlet.mvc.Controller") + dependencies.ifAnyMissingClasses("org.springframework.web.servlet.mvc.Controller") .add("spring-boot-starter-web"); - dependencies.ifAnyMissingClasses("groovy.text.TemplateEngine").add( - "groovy-templates"); + dependencies.ifAnyMissingClasses("groovy.text.TemplateEngine") + .add("groovy-templates"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialFacebookCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialFacebookCompilerAutoConfiguration.java index 37fe98393c..74e5599eea 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialFacebookCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialFacebookCompilerAutoConfiguration.java @@ -29,8 +29,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Craig Walls * @since 1.1.0 */ -public class SpringSocialFacebookCompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class SpringSocialFacebookCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -40,9 +40,9 @@ public class SpringSocialFacebookCompilerAutoConfiguration extends @Override public void applyDependencies(DependencyCustomizer dependencies) throws CompilationFailedException { - dependencies.ifAnyMissingClasses( - "org.springframework.social.facebook.api.Facebook").add( - "spring-boot-starter-social-facebook"); + dependencies + .ifAnyMissingClasses("org.springframework.social.facebook.api.Facebook") + .add("spring-boot-starter-social-facebook"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialLinkedInCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialLinkedInCompilerAutoConfiguration.java index 1f2763bd6b..48b816858b 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialLinkedInCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialLinkedInCompilerAutoConfiguration.java @@ -29,8 +29,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Craig Walls * @since 1.1.0 */ -public class SpringSocialLinkedInCompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class SpringSocialLinkedInCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -40,9 +40,9 @@ public class SpringSocialLinkedInCompilerAutoConfiguration extends @Override public void applyDependencies(DependencyCustomizer dependencies) throws CompilationFailedException { - dependencies.ifAnyMissingClasses( - "org.springframework.social.linkedin.api.LinkedIn").add( - "spring-boot-starter-social-linkedin"); + dependencies + .ifAnyMissingClasses("org.springframework.social.linkedin.api.LinkedIn") + .add("spring-boot-starter-social-linkedin"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialTwitterCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialTwitterCompilerAutoConfiguration.java index c107f52841..1249fea364 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialTwitterCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringSocialTwitterCompilerAutoConfiguration.java @@ -29,8 +29,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Craig Walls * @since 1.1.0 */ -public class SpringSocialTwitterCompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class SpringSocialTwitterCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -40,8 +40,7 @@ public class SpringSocialTwitterCompilerAutoConfiguration extends @Override public void applyDependencies(DependencyCustomizer dependencies) throws CompilationFailedException { - dependencies - .ifAnyMissingClasses("org.springframework.social.twitter.api.Twitter") + dependencies.ifAnyMissingClasses("org.springframework.social.twitter.api.Twitter") .add("spring-boot-starter-social-twitter"); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java index e361a3dc6b..2c756c577e 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java @@ -47,14 +47,14 @@ public class SpringTestCompilerAutoConfiguration extends CompilerAutoConfigurati @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses("org.springframework.http.HttpHeaders").add( - "spring-boot-starter-web"); + dependencies.ifAnyMissingClasses("org.springframework.http.HttpHeaders") + .add("spring-boot-starter-web"); } @Override - public void apply(GroovyClassLoader loader, - GroovyCompilerConfiguration configuration, GeneratorContext generatorContext, - SourceUnit source, ClassNode classNode) throws CompilationFailedException { + public void apply(GroovyClassLoader loader, GroovyCompilerConfiguration configuration, + GeneratorContext generatorContext, SourceUnit source, ClassNode classNode) + throws CompilationFailedException { if (!AstUtils.hasAtLeastOneAnnotation(classNode, "RunWith")) { AnnotationNode runwith = new AnnotationNode(ClassHelper.make("RunWith")); runwith.addMember("value", @@ -67,7 +67,7 @@ public class SpringTestCompilerAutoConfiguration extends CompilerAutoConfigurati public void applyImports(ImportCustomizer imports) throws CompilationFailedException { imports.addStarImports("org.junit.runner", "org.springframework.boot.test", "org.springframework.http", "org.springframework.test.context.junit4", - "org.springframework.test.annotation").addImports( - "org.springframework.test.context.web.WebAppConfiguration"); + "org.springframework.test.annotation") + .addImports("org.springframework.test.context.web.WebAppConfiguration"); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringWebsocketCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringWebsocketCompilerAutoConfiguration.java index 8cce4f8a4e..020ee812ae 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringWebsocketCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringWebsocketCompilerAutoConfiguration.java @@ -49,8 +49,8 @@ public class SpringWebsocketCompilerAutoConfiguration extends CompilerAutoConfig "org.springframework.messaging.simp.config", "org.springframework.web.socket.handler", "org.springframework.web.socket.sockjs.transport.handler", - "org.springframework.web.socket.config.annotation").addImports( - "org.springframework.web.socket.WebSocketHandler"); + "org.springframework.web.socket.config.annotation") + .addImports("org.springframework.web.socket.WebSocketHandler"); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/TransactionManagementCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/TransactionManagementCompilerAutoConfiguration.java index 018a04e1dc..9eb2815d38 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/TransactionManagementCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/TransactionManagementCompilerAutoConfiguration.java @@ -28,8 +28,8 @@ import org.springframework.boot.cli.compiler.DependencyCustomizer; * @author Dave Syer * @author Phillip Webb */ -public class TransactionManagementCompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class TransactionManagementCompilerAutoConfiguration + extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -38,9 +38,10 @@ public class TransactionManagementCompilerAutoConfiguration extends @Override public void applyDependencies(DependencyCustomizer dependencies) { - dependencies.ifAnyMissingClasses( - "org.springframework.transaction.annotation.Transactional").add( - "spring-tx", "spring-boot-starter-aop"); + dependencies + .ifAnyMissingClasses( + "org.springframework.transaction.annotation.Transactional") + .add("spring-tx", "spring-boot-starter-aop"); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/ManagedDependenciesArtifactCoordinatesResolver.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/ManagedDependenciesArtifactCoordinatesResolver.java index 7c8f0ee55c..5c3ca0164c 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/ManagedDependenciesArtifactCoordinatesResolver.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/ManagedDependenciesArtifactCoordinatesResolver.java @@ -26,8 +26,8 @@ import org.springframework.util.StringUtils; * * @author Phillip Webb */ -public class ManagedDependenciesArtifactCoordinatesResolver implements - ArtifactCoordinatesResolver { +public class ManagedDependenciesArtifactCoordinatesResolver + implements ArtifactCoordinatesResolver { private final ManagedDependencies dependencies; @@ -35,7 +35,8 @@ public class ManagedDependenciesArtifactCoordinatesResolver implements this(ManagedDependencies.get()); } - public ManagedDependenciesArtifactCoordinatesResolver(ManagedDependencies dependencies) { + public ManagedDependenciesArtifactCoordinatesResolver( + ManagedDependencies dependencies) { this.dependencies = dependencies; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java index bad29755bd..dda867bc72 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java @@ -44,9 +44,9 @@ import groovy.grape.GrapeEngine; import groovy.lang.GroovyClassLoader; /** - * A {@link GrapeEngine} implementation that uses Aether, the dependency resolution system used by - * Maven. + * A {@link GrapeEngine} implementation that uses + * Aether, the dependency resolution system used + * by Maven. * * @author Andy Wilkinson * @author Phillip Webb @@ -55,6 +55,7 @@ import groovy.lang.GroovyClassLoader; public class AetherGrapeEngine implements GrapeEngine { private static final Collection WILDCARD_EXCLUSION; + static { List exclusions = new ArrayList(); exclusions.add(new Exclusion("*", "*", "*", "*")); @@ -196,8 +197,8 @@ public class AetherGrapeEngine implements GrapeEngine { private List getDependencies(DependencyResult dependencyResult) { List dependencies = new ArrayList(); for (ArtifactResult artifactResult : dependencyResult.getArtifactResults()) { - dependencies.add(new Dependency(artifactResult.getArtifact(), - JavaScopes.COMPILE)); + dependencies.add( + new Dependency(artifactResult.getArtifact(), JavaScopes.COMPILE)); } return dependencies; } @@ -236,8 +237,8 @@ public class AetherGrapeEngine implements GrapeEngine { } private RemoteRepository getPossibleMirror(RemoteRepository remoteRepository) { - RemoteRepository mirror = this.session.getMirrorSelector().getMirror( - remoteRepository); + RemoteRepository mirror = this.session.getMirrorSelector() + .getMirror(remoteRepository); if (mirror != null) { return mirror; } @@ -295,8 +296,8 @@ public class AetherGrapeEngine implements GrapeEngine { try { CollectRequest collectRequest = getCollectRequest(dependencies); DependencyRequest dependencyRequest = getDependencyRequest(collectRequest); - DependencyResult result = this.repositorySystem.resolveDependencies( - this.session, dependencyRequest); + DependencyResult result = this.repositorySystem + .resolveDependencies(this.session, dependencyRequest); addManagedDependencies(result); return getFiles(result); } @@ -311,8 +312,8 @@ public class AetherGrapeEngine implements GrapeEngine { private CollectRequest getCollectRequest(List dependencies) { CollectRequest collectRequest = new CollectRequest((Dependency) null, dependencies, new ArrayList(this.repositories)); - collectRequest.setManagedDependencies(this.resolutionContext - .getManagedDependencies()); + collectRequest + .setManagedDependencies(this.resolutionContext.getManagedDependencies()); return collectRequest; } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java index b9a4130dde..d99847e141 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java @@ -47,8 +47,8 @@ public abstract class AetherGrapeEngineFactory { List repositoryConfigurations, DependencyResolutionContext dependencyResolutionContext) { - RepositorySystem repositorySystem = createServiceLocator().getService( - RepositorySystem.class); + RepositorySystem repositorySystem = createServiceLocator() + .getService(RepositorySystem.class); DefaultRepositorySystemSession repositorySystemSession = MavenRepositorySystemUtils .newSession(); @@ -60,8 +60,8 @@ public abstract class AetherGrapeEngineFactory { autoConfiguration.apply(repositorySystemSession, repositorySystem); } - new DefaultRepositorySystemSessionAutoConfiguration().apply( - repositorySystemSession, repositorySystem); + new DefaultRepositorySystemSessionAutoConfiguration() + .apply(repositorySystemSession, repositorySystem); return new AetherGrapeEngine(classLoader, repositorySystem, repositorySystemSession, createRepositories(repositoryConfigurations), @@ -84,13 +84,13 @@ public abstract class AetherGrapeEngineFactory { repositoryConfigurations.size()); for (RepositoryConfiguration repositoryConfiguration : repositoryConfigurations) { RemoteRepository.Builder builder = new RemoteRepository.Builder( - repositoryConfiguration.getName(), "default", repositoryConfiguration - .getUri().toASCIIString()); + repositoryConfiguration.getName(), "default", + repositoryConfiguration.getUri().toASCIIString()); if (!repositoryConfiguration.getSnapshotsEnabled()) { - builder.setSnapshotPolicy(new RepositoryPolicy(false, - RepositoryPolicy.UPDATE_POLICY_NEVER, - RepositoryPolicy.CHECKSUM_POLICY_IGNORE)); + builder.setSnapshotPolicy( + new RepositoryPolicy(false, RepositoryPolicy.UPDATE_POLICY_NEVER, + RepositoryPolicy.CHECKSUM_POLICY_IGNORE)); } repositories.add(builder.build()); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java index 3393b92a73..1cb55d640e 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java @@ -33,8 +33,8 @@ import org.springframework.util.StringUtils; * * @author Andy Wilkinson */ -public class DefaultRepositorySystemSessionAutoConfiguration implements - RepositorySystemSessionAutoConfiguration { +public class DefaultRepositorySystemSessionAutoConfiguration + implements RepositorySystemSessionAutoConfiguration { @Override public void apply(DefaultRepositorySystemSession session, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporter.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporter.java index ffa70a3aa7..1d6426bfc7 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporter.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporter.java @@ -31,7 +31,8 @@ import org.eclipse.aether.transfer.TransferResource; */ final class DetailedProgressReporter implements ProgressReporter { - DetailedProgressReporter(DefaultRepositorySystemSession session, final PrintStream out) { + DetailedProgressReporter(DefaultRepositorySystemSession session, + final PrintStream out) { session.setTransferListener(new AbstractTransferListener() { @@ -56,8 +57,8 @@ final class DetailedProgressReporter implements ProgressReporter { private String getTransferSpeed(TransferEvent event) { long kb = event.getTransferredBytes() / 1024; - float seconds = (System.currentTimeMillis() - event.getResource() - .getTransferStartTime()) / 1000.0f; + float seconds = (System.currentTimeMillis() + - event.getResource().getTransferStartTime()) / 1000.0f; return String.format("%dKB at %.1fKB/sec", kb, (kb / seconds)); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfiguration.java index 0fbb818b76..dbbdc5220d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfiguration.java @@ -31,8 +31,8 @@ import org.springframework.util.StringUtils; * @author Andy Wilkinson * @since 1.2.5 */ -public class GrapeRootRepositorySystemSessionAutoConfiguration implements - RepositorySystemSessionAutoConfiguration { +public class GrapeRootRepositorySystemSessionAutoConfiguration + implements RepositorySystemSessionAutoConfiguration { @Override public void apply(DefaultRepositorySystemSession session, 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 877580100a..78b90dc33d 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 @@ -55,8 +55,8 @@ import org.springframework.boot.cli.util.Log; * * @author Andy Wilkinson */ -public class SettingsXmlRepositorySystemSessionAutoConfiguration implements - RepositorySystemSessionAutoConfiguration { +public class SettingsXmlRepositorySystemSessionAutoConfiguration + implements RepositorySystemSessionAutoConfiguration { private final String homeDir; @@ -75,14 +75,15 @@ public class SettingsXmlRepositorySystemSessionAutoConfiguration implements Settings settings = loadSettings(); SettingsDecryptionResult decryptionResult = decryptSettings(settings); if (!decryptionResult.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 } session.setOffline(settings.isOffline()); session.setMirrorSelector(createMirrorSelector(settings)); - session.setAuthenticationSelector(createAuthenticationSelector(decryptionResult - .getServers())); + session.setAuthenticationSelector( + createAuthenticationSelector(decryptionResult.getServers())); session.setProxySelector(createProxySelector(decryptionResult.getProxies())); String localRepository = settings.getLocalRepository(); @@ -102,8 +103,8 @@ public class SettingsXmlRepositorySystemSessionAutoConfiguration implements .getEffectiveSettings(); } catch (SettingsBuildingException ex) { - throw new IllegalStateException("Failed to build settings from " - + settingsFile, ex); + throw new IllegalStateException( + "Failed to build settings from " + settingsFile, ex); } } @@ -128,8 +129,8 @@ public class SettingsXmlRepositorySystemSessionAutoConfiguration implements field.set(target, value); } catch (Exception e) { - throw new IllegalStateException("Failed to set field '" + fieldName - + "' on '" + target + "'", e); + throw new IllegalStateException( + "Failed to set field '" + fieldName + "' on '" + target + "'", e); } } @@ -159,9 +160,10 @@ public class SettingsXmlRepositorySystemSessionAutoConfiguration implements 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; } 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 d2529ffec4..419a709c0c 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 @@ -48,7 +48,8 @@ final class SummaryProgressReporter implements ProgressReporter { private boolean finished; - public SummaryProgressReporter(DefaultRepositorySystemSession session, PrintStream out) { + public SummaryProgressReporter(DefaultRepositorySystemSession session, + PrintStream out) { this.out = out; session.setTransferListener(new AbstractTransferListener() { @@ -74,13 +75,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/main/java/org/springframework/boot/cli/jar/PackagedSpringApplicationLauncher.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/jar/PackagedSpringApplicationLauncher.java index 10f6a817a8..7432168221 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/jar/PackagedSpringApplicationLauncher.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/jar/PackagedSpringApplicationLauncher.java @@ -52,8 +52,8 @@ public class PackagedSpringApplicationLauncher { return loadClasses(classLoader, sources.split(",")); } } - throw new IllegalStateException("Cannot locate " + SOURCE_ENTRY - + " in MANIFEST.MF"); + throw new IllegalStateException( + "Cannot locate " + SOURCE_ENTRY + " in MANIFEST.MF"); } private boolean isCliPackaged(Manifest manifest) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java index 8b29584649..61821e5d45 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java @@ -77,8 +77,8 @@ public abstract class ResourceUtils { return getUrlsFromWildcardPath(path, classLoader); } catch (Exception ex) { - throw new IllegalArgumentException("Cannot create URL from path [" + path - + "]", ex); + throw new IllegalArgumentException( + "Cannot create URL from path [" + path + "]", ex); } } @@ -160,8 +160,9 @@ public abstract class ResourceUtils { public Resource getResource(String location) { Assert.notNull(location, "Location must not be null"); if (location.startsWith(CLASSPATH_URL_PREFIX)) { - return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX - .length()), getClassLoader()); + return new ClassPathResource( + location.substring(CLASSPATH_URL_PREFIX.length()), + getClassLoader()); } else { if (location.startsWith(FILE_URL_PREFIX)) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java b/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java index ea2f99ee2c..74a0d4c588 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java @@ -37,18 +37,19 @@ import groovy.text.TemplateEngine; */ public abstract class GroovyTemplate { - public static String template(String name) throws IOException, - CompilationFailedException, ClassNotFoundException { + public static String template(String name) + throws IOException, CompilationFailedException, ClassNotFoundException { return template(name, Collections.emptyMap()); } - public static String template(String name, Map model) throws IOException, - CompilationFailedException, ClassNotFoundException { + public static String template(String name, Map model) + throws IOException, CompilationFailedException, ClassNotFoundException { return template(new GStringTemplateEngine(), name, model); } - public static String template(TemplateEngine engine, String name, Map model) - throws IOException, CompilationFailedException, ClassNotFoundException { + public static String template(TemplateEngine engine, String name, + Map model) throws IOException, CompilationFailedException, + ClassNotFoundException { Writable writable = getTemplate(engine, name).make(model); StringWriter result = new StringWriter(); writable.writeTo(result); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java index 9dee88b090..08bfc88527 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java @@ -160,8 +160,8 @@ public class CliTester implements TestRule { @Override public Statement apply(final Statement base, final Description description) { - final Statement statement = CliTester.this.outputCapture.apply( - new RunLauncherStatement(base), description); + final Statement statement = CliTester.this.outputCapture + .apply(new RunLauncherStatement(base), description); return new Statement() { @Override @@ -181,8 +181,8 @@ public class CliTester implements TestRule { public String getHttpOutput(String uri) { try { - InputStream stream = URI.create("http://localhost:" + this.port + uri) - .toURL().openStream(); + InputStream stream = URI.create("http://localhost:" + this.port + uri).toURL() + .openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String line; StringBuilder result = new StringBuilder(); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java index 541f5289b3..fa68510b09 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java @@ -155,8 +155,8 @@ public class CommandRunnerTests { willThrow(new NullPointerException()).given(this.regularCommand).run(); int status = this.commandRunner.runAndHandleErrors("command"); assertThat(status, equalTo(1)); - assertThat(this.calls, equalTo((Set) EnumSet.of(Call.ERROR_MESSAGE, - Call.PRINT_STACK_TRACE))); + assertThat(this.calls, equalTo( + (Set) EnumSet.of(Call.ERROR_MESSAGE, Call.PRINT_STACK_TRACE))); } @Test @@ -165,8 +165,8 @@ public class CommandRunnerTests { int status = this.commandRunner.runAndHandleErrors("command", "-d"); assertEquals("true", System.getProperty("debug")); assertThat(status, equalTo(1)); - assertThat(this.calls, equalTo((Set) EnumSet.of(Call.ERROR_MESSAGE, - Call.PRINT_STACK_TRACE))); + assertThat(this.calls, equalTo( + (Set) EnumSet.of(Call.ERROR_MESSAGE, Call.PRINT_STACK_TRACE))); } @Test @@ -175,8 +175,8 @@ public class CommandRunnerTests { int status = this.commandRunner.runAndHandleErrors("command", "--debug"); assertEquals("true", System.getProperty("debug")); assertThat(status, equalTo(1)); - assertThat(this.calls, equalTo((Set) EnumSet.of(Call.ERROR_MESSAGE, - Call.PRINT_STACK_TRACE))); + assertThat(this.calls, equalTo( + (Set) EnumSet.of(Call.ERROR_MESSAGE, Call.PRINT_STACK_TRACE))); } @Test diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java index e47260fe71..e03db58122 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java @@ -87,8 +87,8 @@ public abstract class AbstractHttpClientMockTests { CloseableHttpResponse response = mock(CloseableHttpResponse.class); mockHttpEntity(response, request.content, request.contentType); mockStatus(response, 200); - String header = (request.fileName != null ? contentDispositionValue(request.fileName) - : null); + String header = (request.fileName != null + ? contentDispositionValue(request.fileName) : null); mockHttpHeader(response, "Content-Disposition", header); given(this.http.execute(argThat(getForNonMetadata()))).willReturn(response); } @@ -117,8 +117,8 @@ public abstract class AbstractHttpClientMockTests { try { HttpEntity entity = mock(HttpEntity.class); given(entity.getContent()).willReturn(new ByteArrayInputStream(content)); - Header contentTypeHeader = contentType != null ? new BasicHeader( - "Content-Type", contentType) : null; + Header contentTypeHeader = contentType != null + ? new BasicHeader("Content-Type", contentType) : null; given(entity.getContentType()).willReturn(contentTypeHeader); given(response.getEntity()).willReturn(entity); return entity; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java index 42035a1a2a..563eb24dc0 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java @@ -241,7 +241,8 @@ public class InitCommandTests extends AbstractHttpClientMockTests { MockHttpProjectGenerationRequest request = new MockHttpProjectGenerationRequest( "application/zip", file.getAbsolutePath()); mockSuccessfulProjectGeneration(request); - assertEquals("Should not have failed", ExitStatus.OK, this.command.run("--force")); + assertEquals("Should not have failed", ExitStatus.OK, + this.command.run("--force")); assertTrue("File should have changed", fileLength != file.length()); } @@ -369,8 +370,8 @@ public class InitCommandTests extends AbstractHttpClientMockTests { return bos.toByteArray(); } - private static class TestableInitCommandOptionHandler extends - InitCommand.InitOptionHandler { + private static class TestableInitCommandOptionHandler + extends InitCommand.InitOptionHandler { private boolean disableProjectGeneration; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java index 2ca4ac3215..2bd2da41ef 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java @@ -62,8 +62,8 @@ public class InitializrServiceMetadataTests { // Security description assertEquals("AOP", metadata.getDependency("aop").getName()); assertEquals("Security", metadata.getDependency("security").getName()); - assertEquals("Security description", metadata.getDependency("security") - .getDescription()); + assertEquals("Security description", + metadata.getDependency("security").getDescription()); assertEquals("JDBC", metadata.getDependency("jdbc").getName()); assertEquals("JPA", metadata.getDependency("data-jpa").getName()); assertEquals("MongoDB", metadata.getDependency("data-mongodb").getName()); @@ -88,12 +88,12 @@ public class InitializrServiceMetadataTests { } private static JSONObject readJson(String version) throws IOException { - Resource resource = new ClassPathResource("metadata/service-metadata-" + version - + ".json"); + Resource resource = new ClassPathResource( + "metadata/service-metadata-" + version + ".json"); InputStream stream = resource.getInputStream(); try { - return new JSONObject(StreamUtils.copyToString(stream, - Charset.forName("UTF-8"))); + return new JSONObject( + StreamUtils.copyToString(stream, Charset.forName("UTF-8"))); } finally { stream.close(); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceTests.java index a2d14457ac..7be9fdfc82 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceTests.java @@ -57,7 +57,8 @@ public class InitializrServiceTests extends AbstractHttpClientMockTests { MockHttpProjectGenerationRequest mockHttpRequest = new MockHttpProjectGenerationRequest( "application/xml", "foo.zip"); ProjectGenerationResponse entity = generateProject(request, mockHttpRequest); - assertProjectEntity(entity, mockHttpRequest.contentType, mockHttpRequest.fileName); + assertProjectEntity(entity, mockHttpRequest.contentType, + mockHttpRequest.fileName); } @Test @@ -158,8 +159,8 @@ public class InitializrServiceTests extends AbstractHttpClientMockTests { assertNull("No content type expected", entity.getContentType()); } else { - assertEquals("wrong mime type", mimeType, entity.getContentType() - .getMimeType()); + assertEquals("wrong mime type", mimeType, + entity.getContentType().getMimeType()); } assertEquals("wrong filename", fileName, entity.getFileName()); } 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 a3c030c837..0fb9778333 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 @@ -59,8 +59,9 @@ public class ProjectGenerationRequestTests { String customServerUrl = "http://foo:8080/initializr"; this.request.setServiceUrl(customServerUrl); this.request.getDependencies().add("security"); - assertEquals(new URI(customServerUrl - + "/starter.zip?dependencies=security&type=test-type"), + assertEquals( + new URI(customServerUrl + + "/starter.zip?dependencies=security&type=test-type"), this.request.generateUrl(createDefaultMetadata())); } @@ -107,8 +108,9 @@ public class ProjectGenerationRequestTests { InitializrServiceMetadata metadata = new InitializrServiceMetadata(projectType); this.request.setType("custom"); this.request.getDependencies().add("data-rest"); - assertEquals(new URI(ProjectGenerationRequest.DEFAULT_SERVICE_URL - + "/foo?dependencies=data-rest&type=custom"), + assertEquals( + new URI(ProjectGenerationRequest.DEFAULT_SERVICE_URL + + "/foo?dependencies=data-rest&type=custom"), this.request.generateUrl(metadata)); } @@ -193,8 +195,8 @@ public class ProjectGenerationRequestTests { private static InitializrServiceMetadata readMetadata(String version) { try { - Resource resource = new ClassPathResource("metadata/service-metadata-" - + version + ".json"); + Resource resource = new ClassPathResource( + "metadata/service-metadata-" + version + ".json"); String content = StreamUtils.copyToString(resource.getInputStream(), Charset.forName("UTF-8")); JSONObject json = new JSONObject(content); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java index 7c746390cd..f716944bf5 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java @@ -85,16 +85,16 @@ public class GroovyGrabDependencyResolverTests { @Test public void resolveArtifactWithNoDependencies() throws Exception { - List resolved = this.resolver.resolve(Arrays - .asList("commons-logging:commons-logging:1.1.3")); + List resolved = this.resolver + .resolve(Arrays.asList("commons-logging:commons-logging:1.1.3")); assertThat(resolved, hasSize(1)); assertThat(getNames(resolved), hasItems("commons-logging-1.1.3.jar")); } @Test public void resolveArtifactWithDependencies() throws Exception { - List resolved = this.resolver.resolve(Arrays - .asList("org.springframework:spring-core:4.1.1.RELEASE")); + List resolved = this.resolver + .resolve(Arrays.asList("org.springframework:spring-core:4.1.1.RELEASE")); assertThat(resolved, hasSize(2)); assertThat(getNames(resolved), hasItems("commons-logging-1.1.3.jar", "spring-core-4.1.1.RELEASE.jar")); @@ -114,10 +114,8 @@ public class GroovyGrabDependencyResolverTests { List resolved = this.resolver.resolve(Arrays.asList("junit:junit:4.11", "commons-logging:commons-logging:1.1.3")); assertThat(resolved, hasSize(3)); - assertThat( - getNames(resolved), - hasItems("junit-4.11.jar", "commons-logging-1.1.3.jar", - "hamcrest-core-1.3.jar")); + assertThat(getNames(resolved), hasItems("junit-4.11.jar", + "commons-logging-1.1.3.jar", "hamcrest-core-1.3.jar")); } public Set getNames(Collection files) { diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java index e667d7f962..1cd786686b 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java @@ -84,18 +84,18 @@ public class InstallerTests { File alpha = createTemporaryFile("alpha.jar"); File bravo = createTemporaryFile("bravo.jar"); File charlie = createTemporaryFile("charlie.jar"); - given(this.resolver.resolve(Arrays.asList("bravo"))).willReturn( - Arrays.asList(bravo, alpha)); - given(this.resolver.resolve(Arrays.asList("charlie"))).willReturn( - Arrays.asList(charlie, alpha)); + given(this.resolver.resolve(Arrays.asList("bravo"))) + .willReturn(Arrays.asList(bravo, alpha)); + given(this.resolver.resolve(Arrays.asList("charlie"))) + .willReturn(Arrays.asList(charlie, alpha)); this.installer.install(Arrays.asList("bravo")); assertThat(getNamesOfFilesInLib(), containsInAnyOrder("alpha.jar", "bravo.jar", ".installed")); this.installer.install(Arrays.asList("charlie")); - assertThat(getNamesOfFilesInLib(), - containsInAnyOrder("alpha.jar", "bravo.jar", "charlie.jar", ".installed")); + assertThat(getNamesOfFilesInLib(), containsInAnyOrder("alpha.jar", "bravo.jar", + "charlie.jar", ".installed")); this.installer.uninstall(Arrays.asList("bravo")); assertThat(getNamesOfFilesInLib(), @@ -111,15 +111,15 @@ public class InstallerTests { File bravo = createTemporaryFile("bravo.jar"); File charlie = createTemporaryFile("charlie.jar"); - given(this.resolver.resolve(Arrays.asList("bravo"))).willReturn( - Arrays.asList(bravo, alpha)); - given(this.resolver.resolve(Arrays.asList("charlie"))).willReturn( - Arrays.asList(charlie, alpha)); + given(this.resolver.resolve(Arrays.asList("bravo"))) + .willReturn(Arrays.asList(bravo, alpha)); + given(this.resolver.resolve(Arrays.asList("charlie"))) + .willReturn(Arrays.asList(charlie, alpha)); this.installer.install(Arrays.asList("bravo")); this.installer.install(Arrays.asList("charlie")); - assertThat(getNamesOfFilesInLib(), - containsInAnyOrder("alpha.jar", "bravo.jar", "charlie.jar", ".installed")); + assertThat(getNamesOfFilesInLib(), containsInAnyOrder("alpha.jar", "bravo.jar", + "charlie.jar", ".installed")); this.installer.uninstallAll(); assertThat(getNamesOfFilesInLib(), containsInAnyOrder(".installed")); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/jar/ResourceMatcherTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/jar/ResourceMatcherTests.java index 66d87cced5..dad9c8f66e 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/jar/ResourceMatcherTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/jar/ResourceMatcherTests.java @@ -45,10 +45,11 @@ public class ResourceMatcherTests { @Test public void nonExistentRoot() throws IOException { - ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("alpha/**", - "bravo/*", "*"), Arrays.asList(".*", "alpha/**/excluded")); - List matchedResources = resourceMatcher.find(Arrays - .asList(new File("does-not-exist"))); + ResourceMatcher resourceMatcher = new ResourceMatcher( + Arrays.asList("alpha/**", "bravo/*", "*"), + Arrays.asList(".*", "alpha/**/excluded")); + List matchedResources = resourceMatcher + .find(Arrays.asList(new File("does-not-exist"))); assertEquals(0, matchedResources.size()); } @@ -67,18 +68,18 @@ public class ResourceMatcherTests { public void excludedWins() throws Exception { ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("*"), Arrays.asList("**/*.jar")); - List found = resourceMatcher.find(Arrays.asList(new File( - "src/test/resources"))); + List found = resourceMatcher + .find(Arrays.asList(new File("src/test/resources"))); assertThat(found, not(hasItem(new FooJarMatcher(MatchedResource.class)))); } @SuppressWarnings("unchecked") @Test public void includedDeltas() throws Exception { - ResourceMatcher resourceMatcher = new ResourceMatcher( - Arrays.asList("-static/**"), Arrays.asList("")); - Collection includes = (Collection) ReflectionTestUtils.getField( - resourceMatcher, "includes"); + ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("-static/**"), + Arrays.asList("")); + Collection includes = (Collection) ReflectionTestUtils + .getField(resourceMatcher, "includes"); assertTrue(includes.contains("templates/**")); assertFalse(includes.contains("static/**")); } @@ -86,10 +87,10 @@ public class ResourceMatcherTests { @SuppressWarnings("unchecked") @Test public void includedDeltasAndNewEntries() throws Exception { - ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("-static/**", - "foo.jar"), Arrays.asList("-**/*.jar")); - Collection includes = (Collection) ReflectionTestUtils.getField( - resourceMatcher, "includes"); + ResourceMatcher resourceMatcher = new ResourceMatcher( + Arrays.asList("-static/**", "foo.jar"), Arrays.asList("-**/*.jar")); + Collection includes = (Collection) ReflectionTestUtils + .getField(resourceMatcher, "includes"); assertTrue(includes.contains("foo.jar")); assertTrue(includes.contains("templates/**")); assertFalse(includes.contains("static/**")); @@ -110,8 +111,9 @@ public class ResourceMatcherTests { public void jarFileAlwaysMatches() throws Exception { ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("*"), Arrays.asList("**/*.jar")); - List found = resourceMatcher.find(Arrays.asList(new File( - "src/test/resources/templates"), new File("src/test/resources/foo.jar"))); + List found = resourceMatcher + .find(Arrays.asList(new File("src/test/resources/templates"), + new File("src/test/resources/foo.jar"))); FooJarMatcher matcher = new FooJarMatcher(MatchedResource.class); assertThat(found, hasItem(matcher)); // A jar file is always treated as a dependency (stick it in /lib) @@ -120,12 +122,13 @@ public class ResourceMatcherTests { @Test public void resourceMatching() throws IOException { - ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("alpha/**", - "bravo/*", "*"), Arrays.asList(".*", "alpha/**/excluded")); - List matchedResources = resourceMatcher.find(Arrays.asList( - new File("src/test/resources/resource-matcher/one"), new File( - "src/test/resources/resource-matcher/two"), new File( - "src/test/resources/resource-matcher/three"))); + ResourceMatcher resourceMatcher = new ResourceMatcher( + Arrays.asList("alpha/**", "bravo/*", "*"), + Arrays.asList(".*", "alpha/**/excluded")); + List matchedResources = resourceMatcher + .find(Arrays.asList(new File("src/test/resources/resource-matcher/one"), + new File("src/test/resources/resource-matcher/two"), + new File("src/test/resources/resource-matcher/three"))); System.out.println(matchedResources); List paths = new ArrayList(); for (MatchedResource resource : matchedResources) { diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java index d1aa0438c2..152b1c60fe 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java @@ -35,8 +35,8 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { @Test public void simple() throws Exception { String s = "one two"; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "one", "two" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "one", "two" })); assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "one", "two" })); assertThat(this.delimiter.isDelimiter(s, 2), equalTo(false)); @@ -47,8 +47,8 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { @Test public void escaped() throws Exception { String s = "o\\ ne two"; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "o\\ ne", "two" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "o\\ ne", "two" })); assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "o ne", "two" })); assertThat(this.delimiter.isDelimiter(s, 2), equalTo(false)); @@ -60,28 +60,28 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { @Test public void quoted() throws Exception { String s = "'o ne' 't w o'"; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "'o ne'", "'t w o'" })); - assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "o ne", - "t w o" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "'o ne'", "'t w o'" })); + assertThat(this.delimiter.parseArguments(s), + equalTo(new String[] { "o ne", "t w o" })); } @Test public void doubleQuoted() throws Exception { String s = "\"o ne\" \"t w o\""; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "\"o ne\"", "\"t w o\"" })); - assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "o ne", - "t w o" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "\"o ne\"", "\"t w o\"" })); + assertThat(this.delimiter.parseArguments(s), + equalTo(new String[] { "o ne", "t w o" })); } @Test public void nestedQuotes() throws Exception { String s = "\"o 'n''e\" 't \"w o'"; - assertThat(this.delimiter.delimit(s, 0).getArguments(), equalTo(new String[] { - "\"o 'n''e\"", "'t \"w o'" })); - assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { "o 'n''e", - "t \"w o" })); + assertThat(this.delimiter.delimit(s, 0).getArguments(), + equalTo(new String[] { "\"o 'n''e\"", "'t \"w o'" })); + assertThat(this.delimiter.parseArguments(s), + equalTo(new String[] { "o 'n''e", "t \"w o" })); } @Test @@ -95,7 +95,8 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { @Test public void escapes() throws Exception { String s = "\\ \\\\.\\\\\\t"; - assertThat(this.delimiter.parseArguments(s), equalTo(new String[] { " \\.\\\t" })); + assertThat(this.delimiter.parseArguments(s), + equalTo(new String[] { " \\.\\\t" })); } } 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 58280bdd6f..1da080c62b 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,15 +56,15 @@ 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"); given(this.resolver.getVersion("spring-boot-starter-logging")) .willReturn("1.2.3"); 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(this.resolver)); } @@ -99,48 +99,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/ResolveDependencyCoordinatesTransformationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformationTests.java index 8ca69e0afd..93cab6fbf5 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( this.coordinatesResolver); @@ -73,8 +74,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"); given(this.coordinatesResolver.getVersion("spring-core")).willReturn("4.0.0.RC1"); } @@ -229,8 +230,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/grape/AetherGrapeEngineTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java index 9795b8f428..39a10cc7cf 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 @@ -49,9 +49,9 @@ public class AetherGrapeEngineTests { private final AetherGrapeEngine grapeEngine = createGrapeEngine(); private AetherGrapeEngine createGrapeEngine() { - return AetherGrapeEngineFactory.create(this.groovyClassLoader, Arrays - .asList(new RepositoryConfiguration("central", URI - .create("http://repo1.maven.org/maven2"), false)), + return AetherGrapeEngineFactory.create(this.groovyClassLoader, + Arrays.asList(new RepositoryConfiguration("central", + URI.create("http://repo1.maven.org/maven2"), false)), new DependencyResolutionContext()); } @@ -134,10 +134,8 @@ public class AetherGrapeEngineTests { public void nonTransitiveDependencyResolution() { Map args = new HashMap(); - this.grapeEngine.grab( - args, - createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE", - false)); + this.grapeEngine.grab(args, createDependency("org.springframework", "spring-jdbc", + "3.2.4.RELEASE", false)); assertEquals(1, this.groovyClassLoader.getURLs().length); } @@ -158,8 +156,8 @@ public class AetherGrapeEngineTests { @Test public void resolutionWithCustomResolver() { Map args = new HashMap(); - this.grapeEngine.addResolver(createResolver("restlet.org", - "http://maven.restlet.org")); + this.grapeEngine + .addResolver(createResolver("restlet.org", "http://maven.restlet.org")); this.grapeEngine.grab(args, createDependency("org.restlet", "org.restlet", "1.1.6")); assertEquals(1, this.groovyClassLoader.getURLs().length); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfigurationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfigurationTests.java index 87dededf9a..d551265f6e 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfigurationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/GrapeRootRepositorySystemSessionAutoConfigurationTests.java @@ -58,38 +58,36 @@ public class GrapeRootRepositorySystemSessionAutoConfigurationTests { @Test public void noLocalRepositoryWhenNoGrapeRoot() { - given( - this.repositorySystem.newLocalRepositoryManager(eq(this.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( - GrapeRootRepositorySystemSessionAutoConfigurationTests.this.session, - localRepository); - } - }); + given(this.repositorySystem.newLocalRepositoryManager(eq(this.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( + GrapeRootRepositorySystemSessionAutoConfigurationTests.this.session, + localRepository); + } + }); new GrapeRootRepositorySystemSessionAutoConfiguration().apply(this.session, this.repositorySystem); - verify(this.repositorySystem, times(0)).newLocalRepositoryManager( - eq(this.session), any(LocalRepository.class)); + verify(this.repositorySystem, times(0)) + .newLocalRepositoryManager(eq(this.session), any(LocalRepository.class)); assertThat(this.session.getLocalRepository(), is(nullValue())); } @Test public void grapeRootConfiguresLocalRepositoryLocation() { - given( - this.repositorySystem.newLocalRepositoryManager(eq(this.session), - any(LocalRepository.class))).willAnswer( - new LocalRepositoryManagerAnswer()); + given(this.repositorySystem.newLocalRepositoryManager(eq(this.session), + any(LocalRepository.class))) + .willAnswer(new LocalRepositoryManagerAnswer()); System.setProperty("grape.root", "foo"); try { @@ -100,8 +98,8 @@ public class GrapeRootRepositorySystemSessionAutoConfigurationTests { System.clearProperty("grape.root"); } - verify(this.repositorySystem, times(1)).newLocalRepositoryManager( - eq(this.session), any(LocalRepository.class)); + verify(this.repositorySystem, times(1)) + .newLocalRepositoryManager(eq(this.session), any(LocalRepository.class)); assertThat(this.session.getLocalRepository(), is(notNullValue())); assertThat(this.session.getLocalRepository().getBasedir().getAbsolutePath(), 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 2c23789358..dec40dd040 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 @@ -74,26 +74,25 @@ 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() { - - @Override - public LocalRepositoryManager answer(InvocationOnMock invocation) - throws Throwable { - LocalRepository localRepository = invocation.getArgumentAt(1, - LocalRepository.class); - return new SimpleLocalRepositoryManagerFactory().newInstance( - session, localRepository); - } - }); + 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); + } + }); System.setProperty("foo", "bar"); try { new SettingsXmlRepositorySystemSessionAutoConfiguration( - "src/test/resources/maven-settings/property-interpolation").apply( - session, this.repositorySystem); + "src/test/resources/maven-settings/property-interpolation") + .apply(session, this.repositorySystem); } finally { System.clearProperty("foo"); @@ -109,8 +108,8 @@ public class SettingsXmlRepositorySystemSessionAutoConfigurationTests { new SettingsXmlRepositorySystemSessionAutoConfiguration(userHome).apply(session, this.repositorySystem); - 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); @@ -121,8 +120,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)); @@ -130,10 +129,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()); } @@ -142,8 +142,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-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java index d03befe9b2..437d46a81b 100644 --- a/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java @@ -24,7 +24,7 @@ import org.springframework.http.ResponseEntity; import static org.junit.Assert.assertEquals; /** - * Integration Tests for {@link SampleTomcatDeployApplication}. + * Integration Tests for {@link SampleTomcatDeployApplication}. */ public class SampleTomcatDeployApplicationIT { diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java index 50ecb7b6e6..f531df7c88 100644 --- a/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java @@ -24,7 +24,7 @@ import org.springframework.http.ResponseEntity; import static org.junit.Assert.assertEquals; /** - * Integration Tests for {@link SampleTomEEDeployApplication}. + * Integration Tests for {@link SampleTomEEDeployApplication}. */ public class SampleTomEEDeployApplicationIT { diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java index b27770776f..8e585ef163 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java @@ -52,8 +52,8 @@ public class FlatdirTests { if (!this.libs.exists()) { this.libs.mkdirs(); } - FileCopyUtils.copy(new File("src/test/resources/foo.jar"), new File(this.libs, - "foo-1.0.0.jar")); + FileCopyUtils.copy(new File("src/test/resources/foo.jar"), + new File(this.libs, "foo-1.0.0.jar")); this.project.newBuild().forTasks("build") .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); } diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java index 21cc2d660b..3e191d702b 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java @@ -58,8 +58,8 @@ public class MultiProjectRepackagingTests { .withArguments("-PbootVersion=" + BOOT_VERSION).run(); File buildLibs = new File( "target/multi-project-common-file-dependency/build/libs"); - JarFile jarFile = new JarFile(new File(buildLibs, - "multi-project-common-file-dependency.jar")); + JarFile jarFile = new JarFile( + new File(buildLibs, "multi-project-common-file-dependency.jar")); assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue()); jarFile.close(); } diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java index 0010d2188f..e29420c95a 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java @@ -123,8 +123,8 @@ public class RepackagingTests { @Test public void repackageWithFileDependency() throws Exception { - FileCopyUtils.copy(new File("src/test/resources/foo.jar"), new File( - "target/repackage/foo.jar")); + FileCopyUtils.copy(new File("src/test/resources/foo.jar"), + new File("target/repackage/foo.jar")); project.newBuild().forTasks("clean", "build") .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run(); File buildLibs = new File("target/repackage/build/libs"); 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 996cce67bc..2b5c87b795 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 @@ -47,8 +47,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(); @@ -56,28 +55,27 @@ 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); } @Test public void springLoadedCanBeUsedWithGradle16() throws IOException { ProjectConnection project = new ProjectCreator("1.6") .createProject("spring-loaded-old-gradle"); - project.newBuild() - .forTasks("bootRun") + project.newBuild().forTasks("bootRun") .withArguments("-PbootVersion=" + BOOT_VERSION, "-PspringLoadedVersion=" + SPRING_LOADED_VERSION, "--stacktrace") .run(); List output = getOutput(); - 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/WarPackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java index b98b5d95c7..900accf912 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 @@ -54,8 +54,8 @@ public class WarPackagingTests { private static final Set JETTY_EXPECTED_IN_WEB_INF_LIB_PROVIDED = new HashSet( Arrays.asList("spring-boot-starter-jetty-", "jetty-util-", "jetty-xml-", "jetty-schemas-", "javax.servlet-", "jetty-io-", "jetty-http-", - "jetty-server-", "jetty-security-", "jetty-servlet-", - "jetty-webapp-", "javax.servlet.jsp-2", "javax.servlet.jsp-api-", + "jetty-server-", "jetty-security-", "jetty-servlet-", "jetty-webapp-", + "javax.servlet.jsp-2", "javax.servlet.jsp-api-", "javax.servlet.jsp.jstl-1.2.2", "javax.servlet.jsp.jstl-1.2.0", "javax.el-", "org.eclipse.jdt.core-", "jetty-jsp-", "websocket-api", "javax.annotation-api", "jetty-plus", "javax-websocket-server-impl-", @@ -89,10 +89,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"); @@ -112,9 +112,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) { @@ -122,8 +121,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) @@ -174,7 +175,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 1137113d76..affb27fce5 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 @@ -50,8 +50,8 @@ public class SampleActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity entity = new TestRestTemplate().getForEntity( - "http://localhost:" + port, Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity("http://localhost:" + port, Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map body = entity.getBody(); diff --git a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorApplicationTests.java index f9a8c2b6cd..8a04ae531d 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorApplicationTests.java @@ -50,8 +50,8 @@ public class SampleActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity entity = new TestRestTemplate().getForEntity( - "http://localhost:" + port, Map.class); + ResponseEntity entity = new TestRestTemplate() + .getForEntity("http://localhost:" + port, Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map body = entity.getBody(); diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java index bfe9339def..eda264c58d 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java @@ -52,8 +52,8 @@ public class SampleActuatorUiApplicationPortTests { @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()); } diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java index 8e62e1714b..23324479b2 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java @@ -58,11 +58,11 @@ public class SampleActuatorUiApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity(headers), String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("Hello")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Hello")); } @Test @@ -76,8 +76,8 @@ public class SampleActuatorUiApplicationTests { @Test public void testMetrics() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/metrics", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/metrics", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } @@ -89,14 +89,12 @@ public class SampleActuatorUiApplicationTests { "http://localhost:" + this.port + "/error", HttpMethod.GET, new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); + assertTrue("Wrong body:\n" + entity.getBody(), + entity.getBody().contains("<html>")); + assertTrue("Wrong body:\n" + entity.getBody(), + entity.getBody().contains("<body>")); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody() - .contains("<html>")); - assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody() - .contains("<body>")); - assertTrue( - "Wrong body:\n" + entity.getBody(), - entity.getBody().contains( - "Please contact the operator with the above information")); + .contains("Please contact the operator with the above information")); } } diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java index 59210db11d..fd750a7b9a 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java @@ -60,17 +60,16 @@ public class ManagementAddressActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } @Test public void testHealth() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate() - .getForEntity( - "http://localhost:" + this.managementPort + "/admin/health", - String.class); + ResponseEntity<String> entity = new TestRestTemplate().getForEntity( + "http://localhost:" + this.managementPort + "/admin/health", + String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body: " + entity.getBody(), entity.getBody().contains("\"status\":\"UP\"")); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java index 814a3f55cc..81796ac834 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java @@ -61,14 +61,14 @@ public class ManagementPathSampleActuatorApplicationTests { @Test public void testHomeIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Wrong body: " + body, "Unauthorized", body.get("error")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } } diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java index 90c6bf90d1..cd1bf3cc48 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java @@ -48,8 +48,8 @@ public class NonSensitiveHealthTests { @Test public void testSecureHealth() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/health", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/health", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body: " + entity.getBody(), entity.getBody().contains("\"hello\":1")); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java index 803c273fb2..393f3a2747 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java @@ -64,30 +64,30 @@ public class SampleActuatorApplicationTests { @Test public void testHomeIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Wrong body: " + body, "Unauthorized", body.get("error")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } @Test public void testMetricsIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/metrics", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/metrics", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); - entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port - + "/metrics/", Map.class); + entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/metrics/", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); - entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port - + "/metrics/foo", Map.class); + entity = new TestRestTemplate().getForEntity( + "http://localhost:" + this.port + "/metrics/foo", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); - entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port - + "/metrics.json", Map.class); + entity = new TestRestTemplate().getForEntity( + "http://localhost:" + this.port + "/metrics.json", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } @@ -127,8 +127,8 @@ public class SampleActuatorApplicationTests { @Test public void testHealth() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/health", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/health", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body: " + entity.getBody(), entity.getBody().contains("\"status\":\"UP\"")); @@ -147,11 +147,11 @@ public class SampleActuatorApplicationTests { @Test public void testInfo() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/info", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/info", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body: " + entity.getBody(), - entity.getBody().contains("\"artifact\":\"spring-boot-sample-actuator\"")); + assertTrue("Wrong body: " + entity.getBody(), entity.getBody() + .contains("\"artifact\":\"spring-boot-sample-actuator\"")); } @Test @@ -199,8 +199,8 @@ public class SampleActuatorApplicationTests { @Test public void testErrorPageDirectAccess() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/error", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/error", Map.class); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); @@ -225,7 +225,8 @@ public class SampleActuatorApplicationTests { public void testConfigProps() throws Exception { @SuppressWarnings("rawtypes") ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword()) - .getForEntity("http://localhost:" + this.port + "/configprops", Map.class); + .getForEntity("http://localhost:" + this.port + "/configprops", + Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java index f6fd5bf6a5..24d8bfd005 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java @@ -74,14 +74,14 @@ public class ServletPathSampleActuatorApplicationTests { @Test public void testHomeIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/spring/", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/spring/", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Wrong body: " + body, "Unauthorized", body.get("error")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } } diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathUnsecureSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathUnsecureSampleActuatorApplicationTests.java index 2d6abd7d8a..b1b7b69911 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathUnsecureSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathUnsecureSampleActuatorApplicationTests.java @@ -53,14 +53,14 @@ public class ServletPathUnsecureSampleActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/spring/", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/spring/", Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Hello Phil", body.get("message")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } @Test diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureManagementSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureManagementSampleActuatorApplicationTests.java index 8458764f4b..2cdfdc68a9 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureManagementSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureManagementSampleActuatorApplicationTests.java @@ -55,14 +55,14 @@ public class UnsecureManagementSampleActuatorApplicationTests { @Test public void testHomeIsSecure() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Wrong body: " + body, "Unauthorized", body.get("error")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } @Test @@ -74,12 +74,13 @@ public class UnsecureManagementSampleActuatorApplicationTests { // ignore; } @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/metrics", Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/metrics", Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); - assertTrue("Wrong body: " + body, body.containsKey("counter.status.401.unmapped")); + assertTrue("Wrong body: " + body, + body.containsKey("counter.status.401.unmapped")); } } diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureSampleActuatorApplicationTests.java index 4d5369393d..6a70e8987e 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/UnsecureSampleActuatorApplicationTests.java @@ -52,14 +52,14 @@ public class UnsecureSampleActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity<Map> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity<Map> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("Hello Phil", body.get("message")); - assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders() - .containsKey("Set-Cookie")); + assertFalse("Wrong headers: " + entity.getHeaders(), + entity.getHeaders().containsKey("Set-Cookie")); } } diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/ChatService.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/ChatService.java index 7a6ad57ac5..bc40cb5b14 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/ChatService.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/ChatService.java @@ -53,8 +53,8 @@ public class ChatService { return message; } - public static class JacksonEncoderDecoder implements Encoder<Message, String>, - Decoder<String, Message> { + public static class JacksonEncoderDecoder + implements Encoder<Message, String>, Decoder<String, Message> { private final ObjectMapper mapper = new ObjectMapper(); diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/SampleAtmosphereApplicationTests.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/SampleAtmosphereApplicationTests.java index e4afd6665a..6b60e2b546 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/SampleAtmosphereApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/SampleAtmosphereApplicationTests.java @@ -60,9 +60,9 @@ public class SampleAtmosphereApplicationTests { public void chatEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties( - "websocket.uri:ws://localhost:" + this.port + "/chat/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + this.port + + "/chat/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java b/spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java index ca0394a5be..e542ce47b7 100644 --- a/spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java +++ b/spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java @@ -64,7 +64,7 @@ public class SampleBatchApplication { public static void main(String[] args) throws Exception { // System.exit is common for Batch applications since the exit code can be used to // drive a workflow - System.exit(SpringApplication.exit(SpringApplication.run( - SampleBatchApplication.class, args))); + System.exit(SpringApplication + .exit(SpringApplication.run(SampleBatchApplication.class, args))); } } diff --git a/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java b/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java index 6b469edd87..8c92a38beb 100644 --- a/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java @@ -31,8 +31,8 @@ public class SampleBatchApplicationTests { @Test public void testDefaultSettings() throws Exception { - assertEquals(0, SpringApplication.exit(SpringApplication - .run(SampleBatchApplication.class))); + assertEquals(0, SpringApplication + .exit(SpringApplication.run(SampleBatchApplication.class))); String output = this.outputCapture.toString(); assertTrue("Wrong output: " + output, output.contains("completed with the following parameters")); diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java index 9498194135..66b2dc7bbe 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java @@ -88,8 +88,8 @@ public class Gemstone implements Serializable { @Override public String toString() { - return String.format("{ @type = %1$s, id = %2$d, name = %3$s }", getClass() - .getName(), getId(), getName()); + return String.format("{ @type = %1$s, id = %2$d, name = %3$s }", + getClass().getName(), getId(), getName()); } } diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java index f27de6d43f..16edd8b849 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java @@ -40,8 +40,8 @@ import sample.data.gemfire.domain.Gemstone; public class GemstoneServiceImpl implements GemstoneService { protected static final List<String> APPROVED_GEMS = new ArrayList<String>( - Arrays.asList("ALEXANDRITE", "AQUAMARINE", "DIAMOND", "OPAL", "PEARL", - "RUBY", "SAPPHIRE", "SPINEL", "TOPAZ")); + Arrays.asList("ALEXANDRITE", "AQUAMARINE", "DIAMOND", "OPAL", "PEARL", "RUBY", + "SAPPHIRE", "SPINEL", "TOPAZ")); @Autowired private GemstoneRepository gemstoneRepo; @@ -127,9 +127,10 @@ public class GemstoneServiceImpl implements GemstoneService { // to demonstrate transactions in GemFire. Gemstone savedGemstone = validate(this.gemstoneRepo.save(gemstone)); - Assert.state(savedGemstone.equals(get(gemstone.getId())), String.format( - "Failed to find Gemstone (%1$s) in GemFire's Cache Region 'Gemstones'!", - gemstone)); + Assert.state(savedGemstone.equals(get(gemstone.getId())), + String.format( + "Failed to find Gemstone (%1$s) in GemFire's Cache Region 'Gemstones'!", + gemstone)); System.out.printf("Saved Gemstone (%1$s)%n", savedGemstone.getName()); @@ -141,8 +142,8 @@ public class GemstoneServiceImpl implements GemstoneService { // NOTE if the Gemstone is not valid, blow chunks (should cause transaction to // rollback in GemFire)! System.err.printf("Illegal Gemstone (%1$s)!%n", gemstone.getName()); - throw new IllegalGemstoneException(String.format( - "'%1$s' is not a valid Gemstone!", gemstone.getName())); + throw new IllegalGemstoneException( + String.format("'%1$s' is not a valid Gemstone!", gemstone.getName())); } return gemstone; diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java index 6c4eb1a7e6..ad6df69110 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java @@ -95,8 +95,8 @@ public class SampleDataGemFireApplicationTests { this.gemstoneService.save(createGemstone("Ruby")); assertEquals(2, this.gemstoneService.count()); - assertTrue(asList(this.gemstoneService.list()).containsAll( - getGemstones("Diamond", "Ruby"))); + assertTrue(asList(this.gemstoneService.list()) + .containsAll(getGemstones("Diamond", "Ruby"))); try { this.gemstoneService.save(createGemstone("Coal")); @@ -105,15 +105,15 @@ public class SampleDataGemFireApplicationTests { } assertEquals(2, this.gemstoneService.count()); - assertTrue(asList(this.gemstoneService.list()).containsAll( - getGemstones("Diamond", "Ruby"))); + assertTrue(asList(this.gemstoneService.list()) + .containsAll(getGemstones("Diamond", "Ruby"))); this.gemstoneService.save(createGemstone("Pearl")); this.gemstoneService.save(createGemstone("Sapphire")); assertEquals(4, this.gemstoneService.count()); - assertTrue(asList(this.gemstoneService.list()).containsAll( - getGemstones("Diamond", "Ruby", "Pearl", "Sapphire"))); + assertTrue(asList(this.gemstoneService.list()) + .containsAll(getGemstones("Diamond", "Ruby", "Pearl", "Sapphire"))); try { this.gemstoneService.save(createGemstone("Quartz")); @@ -122,8 +122,8 @@ public class SampleDataGemFireApplicationTests { } assertEquals(4, this.gemstoneService.count()); - assertTrue(asList(this.gemstoneService.list()).containsAll( - getGemstones("Diamond", "Ruby", "Pearl", "Sapphire"))); + assertTrue(asList(this.gemstoneService.list()) + .containsAll(getGemstones("Diamond", "Ruby", "Pearl", "Sapphire"))); assertEquals(createGemstone("Diamond"), this.gemstoneService.get("Diamond")); assertEquals(createGemstone("Pearl"), this.gemstoneService.get("Pearl")); } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java index fabe2daeb6..bf03d13efc 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java @@ -39,10 +39,10 @@ public class HotelSummary implements Serializable { public HotelSummary(City city, String name, Double averageRating) { this.city = city; this.name = name; - this.averageRating = averageRating == null ? null : new BigDecimal(averageRating, - MATH_CONTEXT).doubleValue(); - this.averageRatingRounded = averageRating == null ? null : (int) Math - .round(averageRating); + this.averageRating = averageRating == null ? null + : new BigDecimal(averageRating, MATH_CONTEXT).doubleValue(); + this.averageRatingRounded = averageRating == null ? null + : (int) Math.round(averageRating); } public City getCity() { diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java index d5fd6dfa68..c733b3adfb 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java @@ -36,7 +36,8 @@ class CityServiceImpl implements CityService { private final HotelRepository hotelRepository; @Autowired - public CityServiceImpl(CityRepository cityRepository, HotelRepository hotelRepository) { + public CityServiceImpl(CityRepository cityRepository, + HotelRepository hotelRepository) { this.cityRepository = cityRepository; this.hotelRepository = hotelRepository; } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java index 4d6de81333..2f6f6f40ae 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java @@ -73,12 +73,9 @@ public class SampleDataJpaApplicationTests { @Test public void testJmx() throws Exception { - assertEquals( - 1, - ManagementFactory - .getPlatformMBeanServer() - .queryMBeans(new ObjectName("jpa.sample:type=ConnectionPool,*"), - null).size()); + assertEquals(1, ManagementFactory.getPlatformMBeanServer() + .queryMBeans(new ObjectName("jpa.sample:type=ConnectionPool,*"), null) + .size()); } } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java index e53f468fe2..846039c3c6 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java @@ -59,10 +59,10 @@ public class HotelRepositoryIntegrationTests { .get(0); assertThat(city.getName(), is("Atlanta")); - Page<HotelSummary> hotels = this.repository.findByCity(city, new PageRequest(0, - 10, Direction.ASC, "name")); - Hotel hotel = this.repository.findByCityAndName(city, hotels.getContent().get(0) - .getName()); + Page<HotelSummary> hotels = this.repository.findByCity(city, + new PageRequest(0, 10, Direction.ASC, "name")); + Hotel hotel = this.repository.findByCityAndName(city, + hotels.getContent().get(0).getName()); assertThat(hotel.getName(), is("Doubletree")); List<RatingCount> counts = this.repository.findRatingCounts(hotel); diff --git a/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java b/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java index 6727479ccd..e3d9d96825 100644 --- a/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java @@ -34,8 +34,8 @@ public class SampleFlywayApplicationTests { @Test public void testDefaultSettings() throws Exception { - assertEquals(new Integer(1), this.template.queryForObject( - "SELECT COUNT(*) from PERSON", Integer.class)); + assertEquals(new Integer(1), this.template + .queryForObject("SELECT COUNT(*) from PERSON", Integer.class)); } } diff --git a/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/web/CustomerController.java b/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/web/CustomerController.java index aeda87376c..c048d7e0bb 100644 --- a/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/web/CustomerController.java +++ b/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/web/CustomerController.java @@ -49,7 +49,8 @@ public class CustomerController { @RequestMapping(method = RequestMethod.GET) HttpEntity<Resources<Customer>> showCustomers() { - Resources<Customer> resources = new Resources<Customer>(this.repository.findAll()); + Resources<Customer> resources = new Resources<Customer>( + this.repository.findAll()); resources.add(this.entityLinks.linkToCollectionResource(Customer.class)); return new ResponseEntity<Resources<Customer>>(resources, HttpStatus.OK); } diff --git a/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/SampleHateoasApplicationTests.java b/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/SampleHateoasApplicationTests.java index 419209b822..d1bc4fed05 100644 --- a/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/SampleHateoasApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/SampleHateoasApplicationTests.java @@ -48,8 +48,8 @@ public class SampleHateoasApplicationTests { ResponseEntity<String> entity = new TestRestTemplate().getForEntity( "http://localhost:" + this.port + "/customers/1", String.class); assertThat(entity.getStatusCode(), equalTo(HttpStatus.OK)); - assertThat(entity.getBody(), startsWith("{\"id\":1,\"firstName\":\"Oliver\"" - + ",\"lastName\":\"Gierke\"")); + assertThat(entity.getBody(), startsWith( + "{\"id\":1,\"firstName\":\"Oliver\"" + ",\"lastName\":\"Gierke\"")); assertThat(entity.getBody(), containsString("_links\":{\"self\":{\"href\"")); } diff --git a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java index 28e60d0785..5447b72504 100644 --- a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java @@ -75,8 +75,8 @@ public class SampleIntegrationApplicationTests { } private String getOutput() throws Exception { - Future<String> future = Executors.newSingleThreadExecutor().submit( - new Callable<String>() { + Future<String> future = Executors.newSingleThreadExecutor() + .submit(new Callable<String>() { @Override public String call() throws Exception { Resource[] resources = getResourcesWithContent(); @@ -96,8 +96,9 @@ public class SampleIntegrationApplicationTests { } private Resource[] getResourcesWithContent() throws IOException { - Resource[] candidates = ResourcePatternUtils.getResourcePatternResolver( - new DefaultResourceLoader()).getResources("file:target/output/**"); + Resource[] candidates = ResourcePatternUtils + .getResourcePatternResolver(new DefaultResourceLoader()) + .getResources("file:target/output/**"); for (Resource candidate : candidates) { if (candidate.contentLength() == 0) { return new Resource[0]; diff --git a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/producer/ProducerApplication.java b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/producer/ProducerApplication.java index 2907b73acf..f703e4686d 100644 --- a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/producer/ProducerApplication.java +++ b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/producer/ProducerApplication.java @@ -30,8 +30,8 @@ public class ProducerApplication implements CommandLineRunner { public void run(String... args) throws Exception { new File("target/input").mkdirs(); if (args.length > 0) { - FileOutputStream stream = new FileOutputStream("target/input/data" - + System.currentTimeMillis() + ".txt"); + FileOutputStream stream = new FileOutputStream( + "target/input/data" + System.currentTimeMillis() + ".txt"); for (String arg : args) { stream.write(arg.getBytes()); } diff --git a/spring-boot-samples/spring-boot-sample-jersey/src/main/java/sample/jersey/SampleJerseyApplication.java b/spring-boot-samples/spring-boot-sample-jersey/src/main/java/sample/jersey/SampleJerseyApplication.java index ee8213c9e9..7bd15a9915 100644 --- a/spring-boot-samples/spring-boot-sample-jersey/src/main/java/sample/jersey/SampleJerseyApplication.java +++ b/spring-boot-samples/spring-boot-sample-jersey/src/main/java/sample/jersey/SampleJerseyApplication.java @@ -29,8 +29,9 @@ public class SampleJerseyApplication extends SpringBootServletInitializer { } public static void main(String[] args) { - new SampleJerseyApplication().configure( - new SpringApplicationBuilder(SampleJerseyApplication.class)).run(args); + new SampleJerseyApplication() + .configure(new SpringApplicationBuilder(SampleJerseyApplication.class)) + .run(args); } } diff --git a/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java index 724c716dd5..d0d29ef988 100644 --- a/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java @@ -43,8 +43,8 @@ public class SampleJerseyApplicationTests { @Test public void contextLoads() { - ResponseEntity<String> entity = this.restTemplate.getForEntity( - "http://localhost:" + this.port + "/hello", String.class); + ResponseEntity<String> entity = this.restTemplate + .getForEntity("http://localhost:" + this.port + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); } @@ -58,8 +58,8 @@ public class SampleJerseyApplicationTests { @Test public void validation() { - ResponseEntity<String> entity = this.restTemplate.getForEntity( - "http://localhost:" + this.port + "/reverse", String.class); + ResponseEntity<String> entity = this.restTemplate + .getForEntity("http://localhost:" + this.port + "/reverse", String.class); assertEquals(HttpStatus.BAD_REQUEST, entity.getStatusCode()); } diff --git a/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java b/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java index 67e32d5235..963429fe94 100644 --- a/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java @@ -38,8 +38,8 @@ public class SampleJersey1ApplicationTests { @Test public void contextLoads() { - assertEquals("Hello World", new TestRestTemplate().getForObject( - "http://localhost:" + this.port + "/", String.class)); + assertEquals("Hello World", new TestRestTemplate() + .getForObject("http://localhost:" + this.port + "/", String.class)); } } diff --git a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/SampleJettySslApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/SampleJettySslApplicationTests.java index a682ed4e2c..754a72a2ad 100644 --- a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/SampleJettySslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/SampleJettySslApplicationTests.java @@ -54,8 +54,8 @@ public class SampleJettySslApplicationTests { @Test public void testHome() throws Exception { 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(); @@ -63,8 +63,8 @@ public class SampleJettySslApplicationTests { TestRestTemplate testRestTemplate = new TestRestTemplate(); ((HttpComponentsClientHttpRequestFactory) testRestTemplate.getRequestFactory()) .setHttpClient(httpClient); - ResponseEntity<String> entity = testRestTemplate.getForEntity( - "https://localhost:" + this.port, String.class); + ResponseEntity<String> entity = testRestTemplate + .getForEntity("https://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } 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 bbc5ffb73f..1d563aa6c5 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 @@ -47,8 +47,8 @@ public class SampleJettyApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty/SampleJetty8SslApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty/SampleJetty8SslApplicationTests.java index 8ac26477e0..4ad9cfaad1 100644 --- a/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty/SampleJetty8SslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty/SampleJetty8SslApplicationTests.java @@ -54,8 +54,8 @@ public class SampleJetty8SslApplicationTests { @Test public void testHome() throws Exception { 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(); @@ -63,8 +63,8 @@ public class SampleJetty8SslApplicationTests { TestRestTemplate testRestTemplate = new TestRestTemplate(); ((HttpComponentsClientHttpRequestFactory) testRestTemplate.getRequestFactory()) .setHttpClient(httpClient); - ResponseEntity<String> entity = testRestTemplate.getForEntity( - "https://localhost:" + this.port, String.class); + ResponseEntity<String> entity = testRestTemplate + .getForEntity("https://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty/SampleJetty8ApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty/SampleJetty8ApplicationTests.java index 535df11217..36cb4f2670 100644 --- a/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty/SampleJetty8ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty/SampleJetty8ApplicationTests.java @@ -47,8 +47,8 @@ public class SampleJetty8ApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/SampleAtomikosApplication.java b/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/SampleAtomikosApplication.java index 801bc9ec36..3fc7484bf6 100644 --- a/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/SampleAtomikosApplication.java +++ b/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/SampleAtomikosApplication.java @@ -26,8 +26,8 @@ import org.springframework.context.ApplicationContext; public class SampleAtomikosApplication { public static void main(String[] args) throws Exception { - ApplicationContext context = SpringApplication.run( - SampleAtomikosApplication.class, args); + ApplicationContext context = SpringApplication + .run(SampleAtomikosApplication.class, args); AccountService service = context.getBean(AccountService.class); AccountRepository repository = context.getBean(AccountRepository.class); service.createAccountAndNotify("josh"); diff --git a/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/SampleBitronixApplication.java b/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/SampleBitronixApplication.java index edfa4c8a09..830dae3e51 100644 --- a/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/SampleBitronixApplication.java +++ b/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/SampleBitronixApplication.java @@ -26,8 +26,8 @@ import org.springframework.context.ApplicationContext; public class SampleBitronixApplication { public static void main(String[] args) throws Exception { - ApplicationContext context = SpringApplication.run( - SampleBitronixApplication.class, args); + ApplicationContext context = SpringApplication + .run(SampleBitronixApplication.class, args); AccountService service = context.getBean(AccountService.class); AccountRepository repository = context.getBean(AccountRepository.class); service.createAccountAndNotify("josh"); diff --git a/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java b/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java index 390e729780..9dc68d26c9 100644 --- a/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java @@ -41,20 +41,19 @@ public class SampleLiquibaseApplicationTests { } } String output = this.outputCapture.toString(); - assertTrue( - "Wrong output: " + output, + assertTrue("Wrong output: " + output, output.contains("Successfully acquired change log lock") && output.contains("Creating database history " + "table with name: PUBLIC.DATABASECHANGELOG") - && output.contains("Table person created") - && output.contains("ChangeSet classpath:/db/" - + "changelog/db.changelog-master.yaml::1::" - + "marceloverdijk ran successfully") - && output.contains("New row inserted into person") - && output.contains("ChangeSet classpath:/db/changelog/" - + "db.changelog-master.yaml::2::" - + "marceloverdijk ran successfully") - && output.contains("Successfully released change log lock")); + && output.contains("Table person created") + && output.contains("ChangeSet classpath:/db/" + + "changelog/db.changelog-master.yaml::1::" + + "marceloverdijk ran successfully") + && output.contains("New row inserted into person") + && output.contains("ChangeSet classpath:/db/changelog/" + + "db.changelog-master.yaml::2::" + + "marceloverdijk ran successfully") + && output.contains("Successfully released change log lock")); } private boolean serverNotRunning(IllegalStateException ex) { 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 a2e6db6708..239e8574ea 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 @@ -27,8 +27,8 @@ import org.springframework.context.annotation.ImportResource; 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); } @EnableAutoConfiguration diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java index 61a8a546e3..4212d5df3f 100644 --- a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java @@ -86,15 +86,16 @@ public class SampleIntegrationParentApplicationTests { } private Resource[] findResources() throws IOException { - return ResourcePatternUtils.getResourcePatternResolver( - new DefaultResourceLoader()).getResources("file:target/output/**/*.msg"); + return ResourcePatternUtils + .getResourcePatternResolver(new DefaultResourceLoader()) + .getResources("file:target/output/**/*.msg"); } private String readResources(Resource[] resources) throws IOException { StringBuilder builder = new StringBuilder(); for (Resource resource : resources) { - builder.append(new String(StreamUtils.copyToByteArray(resource - .getInputStream()))); + builder.append( + new String(StreamUtils.copyToByteArray(resource.getInputStream()))); } return builder.toString(); } diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/producer/ProducerApplication.java b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/producer/ProducerApplication.java index 4ae50ad3d6..fb14d4774f 100644 --- a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/producer/ProducerApplication.java +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/producer/ProducerApplication.java @@ -30,8 +30,8 @@ public class ProducerApplication implements CommandLineRunner { public void run(String... args) throws Exception { new File("target/input").mkdirs(); if (args.length > 0) { - FileOutputStream stream = new FileOutputStream("target/input/data" - + System.currentTimeMillis() + ".txt"); + FileOutputStream stream = new FileOutputStream( + "target/input/data" + System.currentTimeMillis() + ".txt"); for (String arg : args) { stream.write(arg.getBytes()); } diff --git a/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleSecureApplication.java b/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleSecureApplication.java index dbfeb69b2f..7f2c3129ef 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleSecureApplication.java +++ b/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleSecureApplication.java @@ -36,9 +36,9 @@ public class SampleSecureApplication implements CommandLineRunner { @Override public void run(String... args) throws Exception { - SecurityContextHolder.getContext().setAuthentication( - new UsernamePasswordAuthenticationToken("user", "N/A", AuthorityUtils - .commaSeparatedStringToAuthorityList("ROLE_USER"))); + SecurityContextHolder.getContext() + .setAuthentication(new UsernamePasswordAuthenticationToken("user", "N/A", + AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER"))); try { System.out.println(this.service.secure()); } 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 500fd13049..d297accf3f 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 @@ -59,8 +59,8 @@ public class SampleSecureApplicationTests { public void init() { AuthenticationManager authenticationManager = this.context .getBean(AuthenticationManager.class); - this.authentication = authenticationManager - .authenticate(new UsernamePasswordAuthenticationToken("user", "password")); + this.authentication = authenticationManager.authenticate( + new UsernamePasswordAuthenticationToken("user", "password")); } @After diff --git a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java index 66e644d195..1e35adad46 100644 --- a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java @@ -52,8 +52,8 @@ public class SampleServletApplicationTests { @Test public void testHomeIsSecure() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } diff --git a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java index a8c6613013..422e11032f 100644 --- a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java @@ -43,8 +43,8 @@ public class SampleTestNGApplicationTests extends AbstractTestNGSpringContextTes @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java index eab03b070f..b774d1b024 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java @@ -48,8 +48,8 @@ public class SampleWebJspApplicationTests { @Test public void testJspWithEl() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("/resources/text.txt")); diff --git a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/SampleTomcatTwoConnectorsApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/SampleTomcatTwoConnectorsApplicationTests.java index 74cd46100f..9d17eada35 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/SampleTomcatTwoConnectorsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/SampleTomcatTwoConnectorsApplicationTests.java @@ -71,15 +71,13 @@ public class SampleTomcatTwoConnectorsApplicationTests { X509TrustManager tm = new X509TrustManager() { @Override - public void checkClientTrusted( - java.security.cert.X509Certificate[] chain, String authType) - throws java.security.cert.CertificateException { + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, + String authType) throws java.security.cert.CertificateException { } @Override - public void checkServerTrusted( - java.security.cert.X509Certificate[] chain, String authType) - throws java.security.cert.CertificateException { + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, + String authType) throws java.security.cert.CertificateException { } @Override @@ -103,19 +101,21 @@ public class SampleTomcatTwoConnectorsApplicationTests { new HostnameVerifier() { @Override - public boolean verify(final String hostname, final SSLSession session) { + public boolean verify(final String hostname, + final SSLSession session) { return true; // these guys are alright by me... } }); template.setRequestFactory(factory); - ResponseEntity<String> entity = template.getForEntity("http://localhost:" - + this.port + "/hello", String.class); + ResponseEntity<String> entity = template + .getForEntity("http://localhost:" + this.port + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("hello", entity.getBody()); - ResponseEntity<String> httpsEntity = template.getForEntity("https://localhost:" - + this.context.getBean("port") + "/hello", String.class); + ResponseEntity<String> httpsEntity = template.getForEntity( + "https://localhost:" + this.context.getBean("port") + "/hello", + String.class); assertEquals(HttpStatus.OK, httpsEntity.getStatusCode()); assertEquals("hello", httpsEntity.getBody()); diff --git a/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java index b6c5fa3545..1cf2b9751f 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java @@ -49,8 +49,8 @@ public class SampleTomcatSslApplicationTests { @Test public void testHome() throws Exception { 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(); @@ -58,8 +58,8 @@ public class SampleTomcatSslApplicationTests { TestRestTemplate testRestTemplate = new TestRestTemplate(); ((HttpComponentsClientHttpRequestFactory) testRestTemplate.getRequestFactory()) .setHttpClient(httpClient); - ResponseEntity<String> entity = testRestTemplate.getForEntity( - "https://localhost:" + this.port, String.class); + ResponseEntity<String> entity = testRestTemplate + .getForEntity("https://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello, world", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java index 0347547065..68a340055b 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java @@ -65,7 +65,8 @@ public class NonAutoConfigurationSampleTomcatApplicationTests { ServerPropertiesAutoConfiguration.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) - @ComponentScan(basePackageClasses = { SampleController.class, HelloWorldService.class }) + @ComponentScan(basePackageClasses = { SampleController.class, + HelloWorldService.class }) public static class NonAutoConfigurationSampleTomcatApplication { public static void main(String[] args) throws Exception { @@ -76,8 +77,8 @@ public class NonAutoConfigurationSampleTomcatApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } 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 f24ec1536f..2a6b8b18a2 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 @@ -45,8 +45,8 @@ public class SampleTomcatApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java index f51062a3ba..7c923f26e7 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java @@ -48,8 +48,8 @@ public class SampleWebJspApplicationTests { @Test public void testJspWithEl() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("/resources/text.txt")); diff --git a/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java b/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java index f83b928da1..5f605eb76c 100644 --- a/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java +++ b/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java @@ -51,7 +51,8 @@ public class WebConfig extends WebMvcConfigurerAdapter { } @Override - public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { + public void configureDefaultServletHandling( + DefaultServletHandlerConfigurer configurer) { configurer.enable(); } } diff --git a/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java b/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java index eb2754460f..f290636883 100644 --- a/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java @@ -48,8 +48,8 @@ public class SampleTraditionalApplicationTests { @Test public void testHomeJsp() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); String body = entity.getBody(); assertTrue("Wrong body:\n" + body, body.contains("<html>")); diff --git a/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/SampleUndertowSslApplicationTests.java b/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/SampleUndertowSslApplicationTests.java index 3d5a12a07e..2cd7379878 100644 --- a/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/SampleUndertowSslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/SampleUndertowSslApplicationTests.java @@ -54,8 +54,8 @@ public class SampleUndertowSslApplicationTests { @Test public void testHome() throws Exception { 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(); @@ -63,8 +63,8 @@ public class SampleUndertowSslApplicationTests { TestRestTemplate testRestTemplate = new TestRestTemplate(); ((HttpComponentsClientHttpRequestFactory) testRestTemplate.getRequestFactory()) .setHttpClient(httpClient); - ResponseEntity<String> entity = testRestTemplate.getForEntity( - "https://localhost:" + this.port, String.class); + ResponseEntity<String> entity = testRestTemplate + .getForEntity("https://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } 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 2e1f835ceb..584b25ec85 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 @@ -57,8 +57,8 @@ public class SampleUndertowApplicationTests { } private void assertOkResponse(String path, String body) { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + path, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + path, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals(body, entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java index 553ec8526c..dcc7f72ddc 100644 --- a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java @@ -55,8 +55,8 @@ public class SampleWebFreeMarkerApplicationTests { @Test public void testFreeMarkerTemplate() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("Hello, Andy")); @@ -73,8 +73,8 @@ public class SampleWebFreeMarkerApplicationTests { requestEntity, String.class); assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode()); - assertTrue("Wrong body:\n" + responseEntity.getBody(), responseEntity.getBody() - .contains("Something went wrong: 404 Not Found")); + assertTrue("Wrong body:\n" + responseEntity.getBody(), + responseEntity.getBody().contains("Something went wrong: 404 Not Found")); } } diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/ui/SampleGroovyTemplateApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/ui/SampleGroovyTemplateApplicationTests.java index 7e8691164c..3ec0840054 100644 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/ui/SampleGroovyTemplateApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/ui/SampleGroovyTemplateApplicationTests.java @@ -53,13 +53,13 @@ public class SampleGroovyTemplateApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("<title>Messages")); - assertFalse("Wrong body (found layout:fragment):\n" + entity.getBody(), entity - .getBody().contains("layout:fragment")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Messages")); + assertFalse("Wrong body (found layout:fragment):\n" + entity.getBody(), + entity.getBody().contains("layout:fragment")); } @Test @@ -67,8 +67,8 @@ public class SampleGroovyTemplateApplicationTests { MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>(); map.set("text", "FOO text"); map.set("summary", "FOO"); - URI location = new TestRestTemplate().postForLocation("http://localhost:" - + this.port, map); + URI location = new TestRestTemplate() + .postForLocation("http://localhost:" + this.port, map); assertTrue("Wrong location:\n" + location, location.toString().contains("localhost:" + this.port)); } diff --git a/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java index 405633255f..212cee74b9 100644 --- a/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java @@ -48,8 +48,8 @@ public class SampleWebJspApplicationTests { @Test public void testJspWithEl() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("/resources/text.txt")); diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/ui/method/SampleMethodSecurityApplication.java b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/ui/method/SampleMethodSecurityApplication.java index 6c1bb1ccf2..17486f6993 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/ui/method/SampleMethodSecurityApplication.java +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/ui/method/SampleMethodSecurityApplication.java @@ -75,8 +75,8 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter { @Order(Ordered.HIGHEST_PRECEDENCE) @Configuration - protected static class AuthenticationSecurity extends - GlobalAuthenticationConfigurerAdapter { + protected static class AuthenticationSecurity + extends GlobalAuthenticationConfigurerAdapter { @Override public void init(AuthenticationManagerBuilder auth) throws Exception { diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/ui/method/SampleMethodSecurityApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/ui/method/SampleMethodSecurityApplicationTests.java index 4566c92ebd..6ad2344225 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/ui/method/SampleMethodSecurityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/ui/method/SampleMethodSecurityApplicationTests.java @@ -61,11 +61,11 @@ public class SampleMethodSecurityApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("<title>Login")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Login")); } @Test @@ -81,8 +81,8 @@ public class SampleMethodSecurityApplicationTests { new HttpEntity<MultiValueMap<String, String>>(form, headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertEquals("http://localhost:" + this.port + "/", entity.getHeaders() - .getLocation().toString()); + assertEquals("http://localhost:" + this.port + "/", + entity.getHeaders().getLocation().toString()); } @Test @@ -100,18 +100,18 @@ public class SampleMethodSecurityApplicationTests { assertEquals(HttpStatus.FOUND, entity.getStatusCode()); String cookie = entity.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); - ResponseEntity<String> page = new TestRestTemplate().exchange(entity.getHeaders() - .getLocation(), HttpMethod.GET, new HttpEntity<Void>(headers), - String.class); + ResponseEntity<String> page = new TestRestTemplate().exchange( + entity.getHeaders().getLocation(), HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.FORBIDDEN, page.getStatusCode()); - assertTrue("Wrong body (message doesn't match):\n" + entity.getBody(), page - .getBody().contains("Access denied")); + assertTrue("Wrong body (message doesn't match):\n" + entity.getBody(), + page.getBody().contains("Access denied")); } @Test public void testManagementProtected() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/beans", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/beans", String.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } @@ -130,8 +130,8 @@ public class SampleMethodSecurityApplicationTests { } private void getCsrf(MultiValueMap<String, String> form, HttpHeaders headers) { - ResponseEntity<String> page = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/login", String.class); + ResponseEntity<String> page = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/login", String.class); String cookie = page.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); String body = page.getBody(); diff --git a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java index 6ec050a5f4..deb307cc7b 100644 --- a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java @@ -55,8 +55,8 @@ public class SampleWebMustacheApplicationTests { @Test public void testMustacheTemplate() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("Hello, Andy")); @@ -73,8 +73,8 @@ public class SampleWebMustacheApplicationTests { requestEntity, String.class); assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode()); - assertTrue("Wrong body:\n" + responseEntity.getBody(), responseEntity.getBody() - .contains("Something went wrong: 404 Not Found")); + assertTrue("Wrong body:\n" + responseEntity.getBody(), + responseEntity.getBody().contains("Something went wrong: 404 Not Found")); } } diff --git a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java index e71c443a1a..67c609fd0d 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java @@ -62,11 +62,11 @@ public class SampleWebSecureCustomApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/login")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/login")); } @Test @@ -94,16 +94,16 @@ public class SampleWebSecureCustomApplicationTests { new HttpEntity<MultiValueMap<String, String>>(form, headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/")); assertNotNull("Missing cookie:\n" + entity.getHeaders(), entity.getHeaders().get("Set-Cookie")); } private HttpHeaders getHeaders() { HttpHeaders headers = new HttpHeaders(); - ResponseEntity<String> page = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/login", String.class); + ResponseEntity<String> page = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/login", String.class); assertEquals(HttpStatus.OK, page.getStatusCode()); String cookie = page.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); diff --git a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java index e71c443a1a..67c609fd0d 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java @@ -62,11 +62,11 @@ public class SampleWebSecureCustomApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/login")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/login")); } @Test @@ -94,16 +94,16 @@ public class SampleWebSecureCustomApplicationTests { new HttpEntity<MultiValueMap<String, String>>(form, headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/")); assertNotNull("Missing cookie:\n" + entity.getHeaders(), entity.getHeaders().get("Set-Cookie")); } private HttpHeaders getHeaders() { HttpHeaders headers = new HttpHeaders(); - ResponseEntity<String> page = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/login", String.class); + ResponseEntity<String> page = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/login", String.class); assertEquals(HttpStatus.OK, page.getStatusCode()); String cookie = page.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); diff --git a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/ui/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/ui/secure/SampleSecureApplicationTests.java index ae106719b1..93dce17546 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/ui/secure/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/ui/secure/SampleSecureApplicationTests.java @@ -62,11 +62,11 @@ public class SampleSecureApplicationTests { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = new TestRestTemplate().exchange( - "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>( - headers), String.class); + "http://localhost:" + this.port, HttpMethod.GET, + new HttpEntity<Void>(headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/login")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/login")); } @Test @@ -94,16 +94,16 @@ public class SampleSecureApplicationTests { new HttpEntity<MultiValueMap<String, String>>(form, headers), String.class); assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders() - .getLocation().toString().endsWith(port + "/")); + assertTrue("Wrong location:\n" + entity.getHeaders(), + entity.getHeaders().getLocation().toString().endsWith(port + "/")); assertNotNull("Missing cookie:\n" + entity.getHeaders(), entity.getHeaders().get("Set-Cookie")); } private HttpHeaders getHeaders() { HttpHeaders headers = new HttpHeaders(); - ResponseEntity<String> page = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/login", String.class); + ResponseEntity<String> page = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port + "/login", String.class); assertEquals(HttpStatus.OK, page.getStatusCode()); String cookie = page.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); diff --git a/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/ui/SampleWebStaticApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/ui/SampleWebStaticApplicationTests.java index 3b031801a2..564ef529dc 100644 --- a/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/ui/SampleWebStaticApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/ui/SampleWebStaticApplicationTests.java @@ -49,23 +49,25 @@ public class SampleWebStaticApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("<title>Static")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Static")); } @Test public void testCss() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port - + "/webjars/bootstrap/3.0.3/css/bootstrap.min.css", String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity( + "http://localhost:" + this.port + + "/webjars/bootstrap/3.0.3/css/bootstrap.min.css", + String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("body")); assertEquals("Wrong content type:\n" + entity.getHeaders().getContentType(), - MediaType.valueOf("text/css;charset=UTF-8"), entity.getHeaders() - .getContentType()); + MediaType.valueOf("text/css;charset=UTF-8"), + entity.getHeaders().getContentType()); } } diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/ui/SampleWebUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/ui/SampleWebUiApplicationTests.java index 07e7c94318..47706a42d7 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/ui/SampleWebUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/ui/SampleWebUiApplicationTests.java @@ -53,13 +53,13 @@ public class SampleWebUiApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), entity - .getBody().contains("<title>Messages")); - assertFalse("Wrong body (found layout:fragment):\n" + entity.getBody(), entity - .getBody().contains("layout:fragment")); + assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(), + entity.getBody().contains("<title>Messages")); + assertFalse("Wrong body (found layout:fragment):\n" + entity.getBody(), + entity.getBody().contains("layout:fragment")); } @Test @@ -67,8 +67,8 @@ public class SampleWebUiApplicationTests { MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>(); map.set("text", "FOO text"); map.set("summary", "FOO"); - URI location = new TestRestTemplate().postForLocation("http://localhost:" - + this.port, map); + URI location = new TestRestTemplate() + .postForLocation("http://localhost:" + this.port, map); assertTrue("Wrong location:\n" + location, location.toString().contains("localhost:" + this.port)); } diff --git a/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/velocity/SampleWebVelocityApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/velocity/SampleWebVelocityApplicationTests.java index b3032d8623..5641f69175 100644 --- a/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/velocity/SampleWebVelocityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/velocity/SampleWebVelocityApplicationTests.java @@ -55,8 +55,8 @@ public class SampleWebVelocityApplicationTests { @Test public void testVelocityTemplate() throws Exception { - ResponseEntity<String> entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port, String.class); + ResponseEntity<String> entity = new TestRestTemplate() + .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("Hello, Andy")); @@ -73,8 +73,8 @@ public class SampleWebVelocityApplicationTests { requestEntity, String.class); assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode()); - assertTrue("Wrong body:\n" + responseEntity.getBody(), responseEntity.getBody() - .contains("Something went wrong: 404 Not Found")); + assertTrue("Wrong body:\n" + responseEntity.getBody(), + responseEntity.getBody().contains("Something went wrong: 404 Not Found")); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java index a7802edcd2..434fcba9f3 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java @@ -27,7 +27,7 @@ public class ReverseWebSocketEndpoint { @OnMessage public void handleMessage(Session session, String message) throws IOException { - session.getBasicRemote().sendText( - "Reversed: " + new StringBuilder(message).reverse()); + session.getBasicRemote() + .sendText("Reversed: " + new StringBuilder(message).reverse()); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java index a278eb09be..b3e745eaa9 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java @@ -106,7 +106,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { SnakeTimer.removeSnake(this.snake); - SnakeTimer.broadcast(String.format("{'type': 'leave', 'id': %d}", - Integer.valueOf(this.id))); + SnakeTimer.broadcast( + String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java index c12b3109f8..0087b0d60a 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java @@ -61,9 +61,9 @@ public class SampleWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties( - "websocket.uri:ws://localhost:" + this.port + "/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + this.port + + "/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -76,8 +76,9 @@ public class SampleWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + this.port + "/reverse") - .run("--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + this.port + "/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java index 0a204fbc7f..0366f25107 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java @@ -67,8 +67,9 @@ public class CustomContainerWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + PORT + + "/ws/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -81,8 +82,9 @@ public class CustomContainerWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/reverse").run( - "--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + PORT + "/ws/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java index a7802edcd2..434fcba9f3 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java @@ -27,7 +27,7 @@ public class ReverseWebSocketEndpoint { @OnMessage public void handleMessage(Session session, String message) throws IOException { - session.getBasicRemote().sendText( - "Reversed: " + new StringBuilder(message).reverse()); + session.getBasicRemote() + .sendText("Reversed: " + new StringBuilder(message).reverse()); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java index a278eb09be..b3e745eaa9 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java @@ -106,7 +106,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { SnakeTimer.removeSnake(this.snake); - SnakeTimer.broadcast(String.format("{'type': 'leave', 'id': %d}", - Integer.valueOf(this.id))); + SnakeTimer.broadcast( + String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java index bd25281692..4434a96e72 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java @@ -61,9 +61,9 @@ public class SampleWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties( - "websocket.uri:ws://localhost:" + this.port + "/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + this.port + + "/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -76,8 +76,9 @@ public class SampleWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + this.port + "/reverse") - .run("--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + this.port + "/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java index 1844e4142f..dd0f32d47b 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java @@ -67,8 +67,9 @@ public class CustomContainerWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + PORT + + "/ws/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -81,8 +82,9 @@ public class CustomContainerWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/reverse").run( - "--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + PORT + "/ws/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java index a7802edcd2..434fcba9f3 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/reverse/ReverseWebSocketEndpoint.java @@ -27,7 +27,7 @@ public class ReverseWebSocketEndpoint { @OnMessage public void handleMessage(Session session, String message) throws IOException { - session.getBasicRemote().sendText( - "Reversed: " + new StringBuilder(message).reverse()); + session.getBasicRemote() + .sendText("Reversed: " + new StringBuilder(message).reverse()); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java index a278eb09be..b3e745eaa9 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java @@ -106,7 +106,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { SnakeTimer.removeSnake(this.snake); - SnakeTimer.broadcast(String.format("{'type': 'leave', 'id': %d}", - Integer.valueOf(this.id))); + SnakeTimer.broadcast( + String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java index f93e2fb5da..36b375d828 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/SampleWebSocketsApplicationTests.java @@ -61,9 +61,9 @@ public class SampleWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties( - "websocket.uri:ws://localhost:" + this.port + "/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + this.port + + "/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -76,8 +76,9 @@ public class SampleWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + this.port + "/reverse") - .run("--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + this.port + "/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java index 4501e44323..1eb8a742ed 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java @@ -67,8 +67,9 @@ public class CustomContainerWebSocketsApplicationTests { public void echoEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/echo/websocket") - .run("--spring.main.web_environment=false"); + .properties("websocket.uri:ws://localhost:" + PORT + + "/ws/echo/websocket") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; @@ -81,8 +82,9 @@ public class CustomContainerWebSocketsApplicationTests { public void reverseEndpoint() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) - .properties("websocket.uri:ws://localhost:" + PORT + "/ws/reverse").run( - "--spring.main.web_environment=false"); + .properties( + "websocket.uri:ws://localhost:" + PORT + "/ws/reverse") + .run("--spring.main.web_environment=false"); long count = context.getBean(ClientConfiguration.class).latch.getCount(); AtomicReference<String> messagePayloadReference = context .getBean(ClientConfiguration.class).messagePayload; diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java index c74c2e916d..3850c6efd2 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java @@ -33,7 +33,8 @@ import org.springframework.xml.xsd.XsdSchema; public class WebServiceConfig extends WsConfigurerAdapter { @Bean - public ServletRegistrationBean dispatcherServlet(ApplicationContext applicationContext) { + public ServletRegistrationBean dispatcherServlet( + ApplicationContext applicationContext) { MessageDispatcherServlet servlet = new MessageDispatcherServlet(); servlet.setApplicationContext(applicationContext); return new ServletRegistrationBean(servlet, "/services/*"); diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java index a7b7634ff4..dfa079b0ac 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java @@ -69,10 +69,10 @@ public class HolidayEndpoint { public void handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date startDate = dateFormat.parse(this.startDateExpression.evaluateFirst( - holidayRequest).getText()); - Date endDate = dateFormat.parse(this.endDateExpression.evaluateFirst( - holidayRequest).getText()); + Date startDate = dateFormat + .parse(this.startDateExpression.evaluateFirst(holidayRequest).getText()); + Date endDate = dateFormat + .parse(this.endDateExpression.evaluateFirst(holidayRequest).getText()); String name = this.nameExpression.evaluateFirst(holidayRequest); this.humanResourceService.bookHoliday(startDate, endDate, name); diff --git a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java index 35ce213229..46e7405e06 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java @@ -51,22 +51,18 @@ public class SampleWsApplicationTests { @Before public void setUp() { - this.webServiceTemplate.setDefaultUri("http://localhost:" + this.serverPort - + "/services/"); + this.webServiceTemplate + .setDefaultUri("http://localhost:" + this.serverPort + "/services/"); } @Test public void testSendingHolidayRequest() { final String request = "<hr:HolidayRequest xmlns:hr=\"http://mycompany.com/hr/schemas\">" - + " <hr:Holiday>" - + " <hr:StartDate>2013-10-20</hr:StartDate>" - + " <hr:EndDate>2013-11-22</hr:EndDate>" - + " </hr:Holiday>" - + " <hr:Employee>" - + " <hr:Number>1</hr:Number>" + + " <hr:Holiday>" + " <hr:StartDate>2013-10-20</hr:StartDate>" + + " <hr:EndDate>2013-11-22</hr:EndDate>" + " </hr:Holiday>" + + " <hr:Employee>" + " <hr:Number>1</hr:Number>" + " <hr:FirstName>John</hr:FirstName>" - + " <hr:LastName>Doe</hr:LastName>" - + " </hr:Employee>" + + " <hr:LastName>Doe</hr:LastName>" + " </hr:Employee>" + "</hr:HolidayRequest>"; StreamSource source = new StreamSource(new StringReader(request)); 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 f2659e6d2f..49235b402e 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 @@ -160,13 +160,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); } } @@ -198,8 +198,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); @@ -211,9 +211,9 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor boolean deprecated = hasDeprecateAnnotation(getter) || hasDeprecateAnnotation(setter) || hasDeprecateAnnotation(element); - this.metadataCollector.add(ItemMetadata - .newProperty(prefix, name, dataType, sourceType, null, - description, defaultValue, deprecated)); + this.metadataCollector + .add(ItemMetadata.newProperty(prefix, name, dataType, sourceType, + null, description, defaultValue, deprecated)); } } } @@ -227,8 +227,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); @@ -240,9 +240,9 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor Object defaultValue = fieldValues.get(name); boolean deprecated = hasDeprecateAnnotation(field) || hasDeprecateAnnotation(element); - this.metadataCollector.add(ItemMetadata - .newProperty(prefix, name, dataType, sourceType, null, - description, defaultValue, deprecated)); + this.metadataCollector + .add(ItemMetadata.newProperty(prefix, name, dataType, sourceType, + null, description, defaultValue, deprecated)); } } } @@ -256,8 +256,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, @@ -267,8 +267,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); @@ -328,8 +328,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor Map<String, Object> values = new LinkedHashMap<String, Object>(); for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annotation .getElementValues().entrySet()) { - values.put(entry.getKey().getSimpleName().toString(), entry.getValue() - .getValue()); + values.put(entry.getKey().getSimpleName().toString(), + entry.getValue().getValue()); } return values; } @@ -349,7 +349,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.addAll(this.metadataStore.readAdditionalMetadata()); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java index 6623e60405..7b7ff32457 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java @@ -95,11 +95,13 @@ public class MetadataCollector { private boolean shouldBeMerged(ItemMetadata itemMetadata) { String sourceType = itemMetadata.getSourceType(); - return (sourceType != null && !deletedInCurrentBuild(sourceType) && !processedInCurrentBuild(sourceType)); + return (sourceType != null && !deletedInCurrentBuild(sourceType) + && !processedInCurrentBuild(sourceType)); } private boolean deletedInCurrentBuild(String sourceType) { - return this.processingEnvironment.getElementUtils().getTypeElement(sourceType) == null; + return this.processingEnvironment.getElementUtils() + .getTypeElement(sourceType) == null; } private boolean processedInCurrentBuild(String sourceType) { 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 154b26ffb9..52999a2ccb 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,21 +89,21 @@ public class MetadataStore { } private FileObject getMetadataResource() throws IOException { - FileObject resource = this.environment.getFiler().getResource( - StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); + FileObject resource = this.environment.getFiler() + .getResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); return resource; } private FileObject createMetadataResource() throws IOException { - FileObject resource = this.environment.getFiler().createResource( - StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); + FileObject resource = this.environment.getFiler() + .createResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); return resource; } private InputStream getAdditionalMetadataStream() throws IOException { // Most build systems will have copied the file to the class output location - FileObject fileObject = this.environment.getFiler().getResource( - StandardLocation.CLASS_OUTPUT, "", ADDITIONAL_METADATA_PATH); + FileObject fileObject = this.environment.getFiler() + .getResource(StandardLocation.CLASS_OUTPUT, "", ADDITIONAL_METADATA_PATH); File file = new File(fileObject.toUri()); if (!file.exists()) { // Gradle keeps things separate @@ -115,8 +115,8 @@ public class MetadataStore { file = new File(path); } } - return (file.exists() ? new FileInputStream(file) : fileObject.toUri().toURL() - .openStream()); + return (file.exists() ? new FileInputStream(file) + : fileObject.toUri().toURL().openStream()); } } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java index 8e9bb0ebf8..c55804bfd8 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java @@ -54,8 +54,8 @@ class TypeElementMembers { } private void process(TypeElement element) { - for (ExecutableElement method : ElementFilter.methodsIn(element - .getEnclosedElements())) { + for (ExecutableElement method : ElementFilter + .methodsIn(element.getEnclosedElements())) { processMethod(method); } for (VariableElement field : ElementFilter @@ -95,14 +95,14 @@ class TypeElementMembers { } private boolean isSetterReturnType(ExecutableElement method) { - return (TypeKind.VOID == method.getReturnType().getKind() || this.env - .getTypeUtils().isSameType(method.getEnclosingElement().asType(), - method.getReturnType())); + return (TypeKind.VOID == method.getReturnType().getKind() + || this.env.getTypeUtils().isSameType( + method.getEnclosingElement().asType(), method.getReturnType())); } private String getAccessorName(String methodName) { - String name = methodName.startsWith("is") ? methodName.substring(2) : methodName - .substring(3); + String name = methodName.startsWith("is") ? methodName.substring(2) + : methodName.substring(3); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); return name; } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java index 10789f8665..484a4c23f5 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java @@ -40,6 +40,7 @@ import javax.lang.model.util.Types; class TypeUtils { private static final Map<TypeKind, Class<?>> PRIMITIVE_WRAPPERS; + static { Map<TypeKind, Class<?>> wrappers = new HashMap<TypeKind, Class<?>>(); wrappers.put(TypeKind.BOOLEAN, Boolean.class); @@ -63,8 +64,9 @@ class TypeUtils { this.env = env; Types types = env.getTypeUtils(); WildcardType wc = types.getWildcardType(null, null); - this.collectionType = types.getDeclaredType(this.env.getElementUtils() - .getTypeElement(Collection.class.getName()), wc); + this.collectionType = types.getDeclaredType( + this.env.getElementUtils().getTypeElement(Collection.class.getName()), + wc); this.mapType = types.getDeclaredType( this.env.getElementUtils().getTypeElement(Map.class.getName()), wc, wc); @@ -109,8 +111,8 @@ class TypeUtils { } public String getJavaDoc(Element element) { - String javadoc = (element == null ? null : this.env.getElementUtils() - .getDocComment(element)); + String javadoc = (element == null ? null + : this.env.getElementUtils().getDocComment(element)); if (javadoc != null) { javadoc = javadoc.trim(); } 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 7ed1bbb63a..8873b821e7 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 @@ -30,9 +30,11 @@ 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<?> 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/fieldvalues/javac/JavaCompilerFieldValuesParser.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java index 818e934113..ba5f88f251 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java @@ -56,6 +56,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser { private static class FieldCollector implements TreeVisitor { private static final Map<String, Class<?>> WRAPPER_TYPES; + static { Map<String, Class<?>> types = new HashMap<String, Class<?>>(); types.put("boolean", Boolean.class); @@ -72,6 +73,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser { } private static final Map<Class<?>, Object> DEFAULT_TYPE_VALUES; + static { Map<Class<?>, Object> values = new HashMap<Class<?>, Object>(); values.put(Boolean.class, false); @@ -83,6 +85,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser { } private static final Map<String, Object> WELL_KNOWN_STATIC_FINALS; + static { Map<String, Object> values = new HashMap<String, Object>(); values.put("Boolean.TRUE", true); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java index 86c197f762..e19f0f587d 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java @@ -41,9 +41,11 @@ class Tree extends ReflectionWrapper { } public void accept(TreeVisitor visitor) throws Exception { - this.acceptMethod.invoke(getInstance(), Proxy.newProxyInstance(getInstance() - .getClass().getClassLoader(), new Class<?>[] { this.treeVisitorType }, - new TreeVisitorInvocationHandler(visitor)), 0); + this.acceptMethod.invoke(getInstance(), + Proxy.newProxyInstance(getInstance().getClass().getClassLoader(), + new Class<?>[] { this.treeVisitorType }, + new TreeVisitorInvocationHandler(visitor)), + 0); } /** @@ -59,7 +61,8 @@ class Tree extends ReflectionWrapper { @Override @SuppressWarnings("rawtypes") - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { if (method.getName().equals("visitClass")) { if ((Integer) args[1] == 0) { Iterable members = (Iterable) Tree.this.GET_CLASS_TREE_MEMBERS 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 93aa9f6490..8c2aae21ed 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 @@ -92,14 +92,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")).withDeprecated()); - assertThat( - metadata, + assertThat(metadata, containsProperty("simple.flag", Boolean.class) .fromSource(SimpleProperties.class) .withDescription("A simple flag.").withDeprecated()); @@ -113,10 +111,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 @@ -181,69 +177,48 @@ public class ConfigurationMetadataAnnotationProcessorTests { public void parseCollectionConfig() throws Exception { ConfigurationMetadata metadata = compile(SimpleCollectionProperties.class); // getter and setter - assertThat( - metadata, - containsProperty("collection.integers-to-names", - "java.util.Map<java.lang.Integer,java.lang.String>")); - assertThat( - metadata, - containsProperty("collection.longs", - "java.util.Collection<java.lang.Long>")); + assertThat(metadata, containsProperty("collection.integers-to-names", + "java.util.Map<java.lang.Integer,java.lang.String>")); + assertThat(metadata, containsProperty("collection.longs", + "java.util.Collection<java.lang.Long>")); assertThat(metadata, containsProperty("collection.floats", "java.util.List<java.lang.Float>")); // getter only - assertThat( - metadata, - containsProperty("collection.names-to-integers", - "java.util.Map<java.lang.String,java.lang.Integer>")); - assertThat( - metadata, - containsProperty("collection.bytes", - "java.util.Collection<java.lang.Byte>")); - assertThat( - metadata, - containsProperty("collection.doubles", "java.util.List<java.lang.Double>")); + assertThat(metadata, containsProperty("collection.names-to-integers", + "java.util.Map<java.lang.String,java.lang.Integer>")); + assertThat(metadata, containsProperty("collection.bytes", + "java.util.Collection<java.lang.Byte>")); + assertThat(metadata, containsProperty("collection.doubles", + "java.util.List<java.lang.Double>")); } @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 @@ -320,7 +295,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 @@ -347,9 +323,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { assertThat(metadata, containsProperty("simple.comparator")); - assertThat(metadata, - containsProperty("foo", String.class) - .fromSource(AdditionalMetadata.class)); + assertThat(metadata, containsProperty("foo", String.class) + .fromSource(AdditionalMetadata.class)); } @Test @@ -411,9 +386,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); @@ -430,9 +404,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) 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 adfd99d52c..f227374c7c 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 @@ -119,12 +119,12 @@ public class ConfigurationMetadataMatchers { ConfigurationMetadata metadata = (ConfigurationMetadata) item; ItemMetadata property = getFirstPropertyWithName(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); } } @@ -151,12 +151,14 @@ public class ConfigurationMetadataMatchers { public ContainsItemMatcher ofType(Class<?> dataType) { return new ContainsItemMatcher(this.itemType, this.name, dataType.getName(), - this.sourceType, this.description, this.defaultValue, this.deprecated); + this.sourceType, this.description, this.defaultValue, + this.deprecated); } public ContainsItemMatcher ofType(String dataType) { return new ContainsItemMatcher(this.itemType, this.name, dataType, - this.sourceType, this.description, this.defaultValue, this.deprecated); + this.sourceType, this.description, this.defaultValue, + this.deprecated); } public ContainsItemMatcher fromSource(Class<?> sourceType) { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestCompiler.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestCompiler.java index a66b7b7186..37143a6f45 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestCompiler.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestCompiler.java @@ -73,9 +73,10 @@ public class TestCompiler { return getTask(javaFileObjects); } - private TestCompilationTask getTask(Iterable<? extends JavaFileObject> javaFileObjects) { - return new TestCompilationTask(this.compiler.getTask(null, this.fileManager, - null, null, null, javaFileObjects)); + private TestCompilationTask getTask( + Iterable<? extends JavaFileObject> javaFileObjects) { + return new TestCompilationTask(this.compiler.getTask(null, this.fileManager, null, + null, null, javaFileObjects)); } public File getOutputLocation() { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestConfigurationMetadataAnnotationProcessor.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestConfigurationMetadataAnnotationProcessor.java index 6ed037db89..efaaf3ec37 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestConfigurationMetadataAnnotationProcessor.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestConfigurationMetadataAnnotationProcessor.java @@ -34,8 +34,8 @@ import org.springframework.boot.configurationprocessor.metadata.JsonMarshaller; */ @SupportedAnnotationTypes({ "*" }) @SupportedSourceVersion(SourceVersion.RELEASE_6) -public class TestConfigurationMetadataAnnotationProcessor extends - ConfigurationMetadataAnnotationProcessor { +public class TestConfigurationMetadataAnnotationProcessor + extends ConfigurationMetadataAnnotationProcessor { static final String CONFIGURATION_PROPERTIES_ANNOTATION = "org.springframework.boot.configurationsample.ConfigurationProperties"; @@ -66,8 +66,8 @@ public class TestConfigurationMetadataAnnotationProcessor extends File metadataFile = new File(this.outputLocation, "META-INF/spring-configuration-metadata.json"); if (metadataFile.isFile()) { - this.metadata = new JsonMarshaller().read(new FileInputStream( - metadataFile)); + this.metadata = new JsonMarshaller() + .read(new FileInputStream(metadataFile)); } else { this.metadata = new ConfigurationMetadata(); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java index 0bfccd2f7c..6c105eb3ba 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java @@ -140,8 +140,8 @@ public class TestProject { File targetFile = getSourceFile(target); String contents = getContents(targetFile); int insertAt = contents.lastIndexOf('}'); - String additionalSource = FileCopyUtils.copyToString(new InputStreamReader( - snippetStream)); + String additionalSource = FileCopyUtils + .copyToString(new InputStreamReader(snippetStream)); contents = contents.substring(0, insertAt) + additionalSource + contents.substring(insertAt); putContents(targetFile, contents); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java index d571e1746b..45d8f1207b 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java @@ -82,8 +82,8 @@ public abstract class AbstractFieldValuesProcessorTests { equalToObject(new Object[] { "FOO", "BAR" })); assertThat(values.get("stringArrayNone"), nullValue()); assertThat(values.get("stringEmptyArray"), equalToObject(new Object[0])); - assertThat(values.get("stringArrayConst"), equalToObject(new Object[] { "OK", - "KO" })); + assertThat(values.get("stringArrayConst"), + equalToObject(new Object[] { "OK", "KO" })); assertThat(values.get("stringArrayConstElements"), equalToObject(new Object[] { "c" })); assertThat(values.get("integerArray"), equalToObject(new Object[] { 42, 24 })); @@ -94,7 +94,8 @@ public abstract class AbstractFieldValuesProcessorTests { return equalTo(object); } - @SupportedAnnotationTypes({ "org.springframework.boot.configurationsample.ConfigurationProperties" }) + @SupportedAnnotationTypes({ + "org.springframework.boot.configurationsample.ConfigurationProperties" }) @SupportedSourceVersion(SourceVersion.RELEASE_6) private class TestProcessor extends AbstractProcessor { @@ -114,8 +115,8 @@ public abstract class AbstractFieldValuesProcessorTests { for (Element element : roundEnv.getElementsAnnotatedWith(annotation)) { if (element instanceof TypeElement) { try { - this.values.putAll(this.processor - .getFieldValues((TypeElement) element)); + this.values.putAll( + this.processor.getFieldValues((TypeElement) element)); } catch (Exception ex) { throw new IllegalStateException(ex); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesProcessorTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesProcessorTests.java index bc1424ac74..ae22d1cd97 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesProcessorTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesProcessorTests.java @@ -28,8 +28,8 @@ import static org.junit.Assume.assumeNoException; * * @author Phillip Webb */ -public class JavaCompilerFieldValuesProcessorTests extends - AbstractFieldValuesProcessorTests { +public class JavaCompilerFieldValuesProcessorTests + extends AbstractFieldValuesProcessorTests { @Override protected FieldValuesParser createProcessor(ProcessingEnvironment env) { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadataTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadataTests.java index e383035037..99640b7040 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadataTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadataTests.java @@ -40,7 +40,8 @@ public class ConfigurationMetadataTests { @Test public void toDashedCaseWordsSeveralUnderScores() { - assertThat(toDashedCase("Word___With__underscore"), is("word___with__underscore")); + assertThat(toDashedCase("Word___With__underscore"), + is("word___with__underscore")); } @Test 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 298f8d461a..2d4fada428 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 @@ -41,12 +41,12 @@ public class JsonMarshallerTests { ConfigurationMetadata metadata = new ConfigurationMetadata(); metadata.add(ItemMetadata.newProperty("a", "b", StringBuffer.class.getName(), InputStream.class.getName(), "sourceMethod", "desc", "x", true)); - metadata.add(ItemMetadata.newProperty("b.c.d", null, null, null, null, null, - null, false)); - metadata.add(ItemMetadata.newProperty("c", null, null, null, null, null, 123, - false)); - metadata.add(ItemMetadata.newProperty("d", null, null, null, null, null, true, + metadata.add(ItemMetadata.newProperty("b.c.d", null, null, null, null, null, null, false)); + metadata.add( + ItemMetadata.newProperty("c", null, null, null, null, null, 123, false)); + metadata.add( + ItemMetadata.newProperty("d", null, null, null, null, null, true, false)); metadata.add(ItemMetadata.newProperty("e", null, null, null, null, null, new String[] { "y", "n" }, false)); metadata.add(ItemMetadata.newProperty("f", null, null, null, null, null, @@ -55,8 +55,8 @@ public class JsonMarshallerTests { 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")) @@ -66,8 +66,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")); } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java index 0baf41aeb3..c975032bad 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java @@ -21,8 +21,8 @@ package org.springframework.boot.configurationsample.simple; * * @author Stephane Nicoll */ -public abstract class HierarchicalPropertiesParent extends - HierarchicalPropertiesGrandparent { +public abstract class HierarchicalPropertiesParent + extends HierarchicalPropertiesGrandparent { private String second; diff --git a/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java index e584147e18..7d358f9f24 100644 --- a/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java +++ b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java @@ -105,8 +105,8 @@ public abstract class ManagedDependencies implements Dependencies { */ public static ManagedDependencies get( Collection<Dependencies> versionManagedDependencies) { - return new ManagedDependencies(new ManagedDependenciesDelegate( - versionManagedDependencies)) { + return new ManagedDependencies( + new ManagedDependenciesDelegate(versionManagedDependencies)) { }; } diff --git a/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegate.java b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegate.java index 212ac2967f..96bc9fe5a2 100644 --- a/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegate.java +++ b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegate.java @@ -35,7 +35,8 @@ class ManagedDependenciesDelegate extends AbstractDependencies { * @param versionManagedDependencies a collection of {@link Dependencies} that take * precedence over the `spring-boot-dependencies`. */ - public ManagedDependenciesDelegate(Collection<Dependencies> versionManagedDependencies) { + public ManagedDependenciesDelegate( + Collection<Dependencies> versionManagedDependencies) { this(getSpringBootDependencies(), versionManagedDependencies); } @@ -57,7 +58,8 @@ class ManagedDependenciesDelegate extends AbstractDependencies { private static Dependencies getSpringBootDependencies() { if (springBootDependencies == null) { - springBootDependencies = new PomDependencies(getResource("effective-pom.xml")); + springBootDependencies = new PomDependencies( + getResource("effective-pom.xml")); } return springBootDependencies; } diff --git a/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/PomDependencies.java b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/PomDependencies.java index 32bc855601..ca96e98143 100644 --- a/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/PomDependencies.java +++ b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/PomDependencies.java @@ -91,8 +91,8 @@ public class PomDependencies extends AbstractDependencies { String groupId = getTextContent(element, "groupId"); String artifactId = getTextContent(element, "artifactId"); String version = getTextContent(element, "version"); - List<Exclusion> exclusions = createExclusions(element - .getElementsByTagName("exclusions")); + List<Exclusion> exclusions = createExclusions( + element.getElementsByTagName("exclusions")); return new Dependency(groupId, artifactId, version, exclusions); } diff --git a/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java b/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java index 7cf95485c5..6d6f618ea1 100644 --- a/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java +++ b/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java @@ -36,10 +36,10 @@ public class ManagedDependenciesDelegateTests { @Before public void setup() throws Exception { - PropertiesFileDependencies root = new PropertiesFileDependencies(getClass() - .getResourceAsStream("external.properties")); - PropertiesFileDependencies extra = new PropertiesFileDependencies(getClass() - .getResourceAsStream("additional-external.properties")); + PropertiesFileDependencies root = new PropertiesFileDependencies( + getClass().getResourceAsStream("external.properties")); + PropertiesFileDependencies extra = new PropertiesFileDependencies( + getClass().getResourceAsStream("additional-external.properties")); this.dependencies = new ManagedDependenciesDelegate(root, Collections.<Dependencies>singleton(extra)); } diff --git a/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/PropertiesFileDependenciesTests.java b/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/PropertiesFileDependenciesTests.java index ea53aa63ca..f65f439ee5 100644 --- a/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/PropertiesFileDependenciesTests.java +++ b/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/PropertiesFileDependenciesTests.java @@ -36,8 +36,8 @@ public class PropertiesFileDependenciesTests { @Before public void setup() throws Exception { - this.dependencies = new PropertiesFileDependencies(getClass() - .getResourceAsStream("external.properties")); + this.dependencies = new PropertiesFileDependencies( + getClass().getResourceAsStream("external.properties")); } @Test diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java index c193ecd47f..c63e5af108 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java @@ -64,8 +64,8 @@ public abstract class FileUtils { */ public static String sha1Hash(File file) throws IOException { try { - DigestInputStream inputStream = new DigestInputStream(new FileInputStream( - file), MessageDigest.getInstance("SHA-1")); + DigestInputStream inputStream = new DigestInputStream( + new FileInputStream(file), MessageDigest.getInstance("SHA-1")); try { byte[] buffer = new byte[4098]; while (inputStream.read(buffer) != -1) { 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 ef35fc4737..53a78f337c 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 @@ -142,8 +142,8 @@ public class JarWriter { */ public void writeLoaderClasses() throws IOException { URL loaderJar = getClass().getClassLoader().getResource(NESTED_LOADER_JAR); - JarInputStream inputStream = new JarInputStream(new BufferedInputStream( - loaderJar.openStream())); + JarInputStream inputStream = new JarInputStream( + new BufferedInputStream(loaderJar.openStream())); JarEntry entry; while ((entry = inputStream.getNextJarEntry()) != null) { if (entry.getName().endsWith(".class")) { @@ -267,8 +267,8 @@ public class JarWriter { @Override public int read(byte[] b, int off, int len) throws IOException { - int read = (this.headerStream == null ? -1 : this.headerStream.read(b, off, - len)); + int read = (this.headerStream == null ? -1 + : this.headerStream.read(b, off, len)); if (read != -1) { this.headerStream = null; return read; diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JvmUtils.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JvmUtils.java index 5aead662e4..479e4badc8 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JvmUtils.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JvmUtils.java @@ -31,8 +31,8 @@ abstract class JvmUtils { /** * Various search locations for tools, including the odd Java 6 OSX jar */ - private static final String[] TOOLS_LOCATIONS = { "lib/tools.jar", - "../lib/tools.jar", "../Classes/classes.jar" }; + private static final String[] TOOLS_LOCATIONS = { "lib/tools.jar", "../lib/tools.jar", + "../Classes/classes.jar" }; public static ClassLoader getToolsClassLoader() { ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java index ed1a5cb125..371dd0d98b 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java @@ -116,6 +116,7 @@ public class Layouts { public static class War implements Layout { private static final Map<LibraryScope, String> SCOPE_DESTINATIONS; + static { Map<LibraryScope, String> map = new HashMap<LibraryScope, String>(); map.put(LibraryScope.COMPILE, "WEB-INF/lib/"); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java index 77af5d9ca7..3f21d06826 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java @@ -113,7 +113,8 @@ public abstract class MainClassFinder { return null; // nothing to do } if (!rootFolder.isDirectory()) { - throw new IllegalArgumentException("Invalid root folder '" + rootFolder + "'"); + throw new IllegalArgumentException( + "Invalid root folder '" + rootFolder + "'"); } String prefix = rootFolder.getAbsolutePath() + "/"; Deque<File> stack = new ArrayDeque<File>(); @@ -230,7 +231,8 @@ public abstract class MainClassFinder { return name; } - private static List<JarEntry> getClassEntries(JarFile source, String classesLocation) { + private static List<JarEntry> getClassEntries(JarFile source, + String classesLocation) { classesLocation = (classesLocation != null ? classesLocation : ""); Enumeration<JarEntry> sourceEntries = source.entries(); List<JarEntry> classEntries = new ArrayList<JarEntry>(); 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 642cef6dbb..eebf118bed 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 @@ -120,8 +120,8 @@ public class Repackager { destination = destination.getAbsoluteFile(); File workingSource = this.source; if (this.source.equals(destination)) { - workingSource = new File(this.source.getParentFile(), this.source.getName() - + ".original"); + workingSource = new File(this.source.getParentFile(), + this.source.getName() + ".original"); workingSource.delete(); renameFile(this.source, workingSource); } @@ -146,8 +146,8 @@ public class Repackager { JarFile jarFile = new JarFile(this.source); try { Manifest manifest = jarFile.getManifest(); - return (manifest != null && manifest.getMainAttributes().getValue( - BOOT_VERSION_ATTRIBUTE) != null); + return (manifest != null && manifest.getMainAttributes() + .getValue(BOOT_VERSION_ATTRIBUTE) != null); } finally { jarFile.close(); @@ -196,12 +196,12 @@ public class Repackager { private void writeNestedLibraries(List<Library> libraries, Set<String> alreadySeen, JarWriter writer) throws IOException { for (Library library : libraries) { - String destination = Repackager.this.layout.getLibraryDestination( - library.getName(), library.getScope()); + String destination = Repackager.this.layout + .getLibraryDestination(library.getName(), library.getScope()); if (destination != null) { if (!alreadySeen.add(destination + library.getName())) { - throw new IllegalStateException("Duplicate library " - + library.getName()); + throw new IllegalStateException( + "Duplicate library " + library.getName()); } writer.writeNestedLibrary(destination, library); } @@ -248,8 +248,8 @@ public class Repackager { } String launcherClassName = this.layout.getLauncherClassName(); if (launcherClassName != null) { - manifest.getMainAttributes() - .putValue(MAIN_CLASS_ATTRIBUTE, launcherClassName); + manifest.getMainAttributes().putValue(MAIN_CLASS_ATTRIBUTE, + launcherClassName); if (startClass == null) { throw new IllegalStateException("Unable to find main class"); } @@ -270,8 +270,8 @@ public class Repackager { private void renameFile(File file, File dest) { if (!file.renameTo(dest)) { - throw new IllegalStateException("Unable to rename '" + file + "' to '" + dest - + "'"); + throw new IllegalStateException( + "Unable to rename '" + file + "' to '" + dest + "'"); } } 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 98f00ef387..e1555d74c2 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 @@ -35,8 +35,8 @@ import org.springframework.util.ReflectionUtils; */ public class RunProcess { - private static final Method INHERIT_IO_METHOD = ReflectionUtils.findMethod( - ProcessBuilder.class, "inheritIO"); + private static final Method INHERIT_IO_METHOD = ReflectionUtils + .findMethod(ProcessBuilder.class, "inheritIO"); private static final long JUST_ENDED_LIMIT = 500; @@ -125,8 +125,8 @@ public class RunProcess { } private void redirectOutput(Process process) { - final BufferedReader reader = new BufferedReader(new InputStreamReader( - process.getInputStream())); + final BufferedReader reader = new BufferedReader( + new InputStreamReader(process.getInputStream())); new Thread() { @Override diff --git a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java index 25cd327de3..10db5bca0f 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java @@ -91,8 +91,8 @@ public class MainClassFinderTests { public void findMainClassInJarSubLocation() throws Exception { this.testJarFile.addClass("a/B.class", ClassWithMainMethod.class); this.testJarFile.addClass("a/b/c/E.class", ClassWithMainMethod.class); - String actual = MainClassFinder - .findMainClass(this.testJarFile.getJarFile(), "a/"); + String actual = MainClassFinder.findMainClass(this.testJarFile.getJarFile(), + "a/"); assertThat(actual, equalTo("B")); } 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 eea9ee6bd8..f5a75a4f30 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 @@ -288,8 +288,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)); } }); @@ -351,9 +351,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 @@ -394,7 +393,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/LaunchedURLClassLoader.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java index 835b4dfa8f..94bdc73c57 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java @@ -212,7 +212,8 @@ public class LaunchedURLClassLoader extends URLClassLoader { // manifest if (jarFile.getJarEntryData(path) != null && jarFile.getManifest() != null) { - definePackage(packageName, jarFile.getManifest(), url); + definePackage(packageName, jarFile.getManifest(), + url); return null; } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java index 770a086a66..650f0077c9 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java @@ -151,7 +151,8 @@ public abstract class Launcher { throw new IllegalStateException( "Unable to determine code source archive from " + root); } - return (root.isDirectory() ? new ExplodedArchive(root) : new JarFileArchive(root)); + return (root.isDirectory() ? new ExplodedArchive(root) + : new JarFileArchive(root)); } } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java index 3aef0ae070..feb7847b2f 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java @@ -47,8 +47,8 @@ public class MainMethodRunner implements Runnable { .loadClass(this.mainClassName); Method mainMethod = mainClass.getDeclaredMethod("main", String[].class); if (mainMethod == null) { - throw new IllegalStateException(this.mainClassName - + " does not have a main method"); + throw new IllegalStateException( + this.mainClassName + " does not have a main method"); } mainMethod.invoke(null, new Object[] { this.args }); } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java index 7c05ee138a..93096c7390 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java @@ -170,16 +170,17 @@ public class PropertiesLauncher extends Launcher { } protected File getHomeDirectory() { - return new File(SystemPropertyUtils.resolvePlaceholders(System.getProperty(HOME, - "${user.dir}"))); + return new File(SystemPropertyUtils + .resolvePlaceholders(System.getProperty(HOME, "${user.dir}"))); } private void initializeProperties(File home) throws Exception, IOException { String config = "classpath:" - + SystemPropertyUtils.resolvePlaceholders(SystemPropertyUtils - .getProperty(CONFIG_NAME, "application")) + ".properties"; - config = SystemPropertyUtils.resolvePlaceholders(SystemPropertyUtils.getProperty( - CONFIG_LOCATION, config)); + + SystemPropertyUtils.resolvePlaceholders( + SystemPropertyUtils.getProperty(CONFIG_NAME, "application")) + + ".properties"; + config = SystemPropertyUtils.resolvePlaceholders( + SystemPropertyUtils.getProperty(CONFIG_LOCATION, config)); InputStream resource = getResource(config); if (resource != null) { @@ -198,8 +199,9 @@ public class PropertiesLauncher extends Launcher { this.properties.put(key, value); } } - if (SystemPropertyUtils.resolvePlaceholders( - "${" + SET_SYSTEM_PROPERTIES + ":false}").equals("true")) { + if (SystemPropertyUtils + .resolvePlaceholders("${" + SET_SYSTEM_PROPERTIES + ":false}") + .equals("true")) { this.logger.info("Adding resolved properties to System properties"); for (Object key : Collections.list(this.properties.propertyNames())) { String value = this.properties.getProperty((String) key); @@ -278,8 +280,8 @@ public class PropertiesLauncher extends Launcher { // Try a URL connection content-length header... URLConnection connection = url.openConnection(); try { - connection.setUseCaches(connection.getClass().getSimpleName() - .startsWith("JNLP")); + connection.setUseCaches( + connection.getClass().getSimpleName().startsWith("JNLP")); if (connection instanceof HttpURLConnection) { HttpURLConnection httpConnection = (HttpURLConnection) connection; httpConnection.setRequestMethod("HEAD"); @@ -306,7 +308,8 @@ public class PropertiesLauncher extends Launcher { path = this.properties.getProperty(PATH); } if (path != null) { - this.paths = parsePathsProperty(SystemPropertyUtils.resolvePlaceholders(path)); + this.paths = parsePathsProperty( + SystemPropertyUtils.resolvePlaceholders(path)); } this.logger.info("Nested archive paths: " + this.paths); } @@ -344,8 +347,8 @@ public class PropertiesLauncher extends Launcher { protected String getMainClass() throws Exception { String mainClass = getProperty(MAIN, "Start-Class"); if (mainClass == null) { - throw new IllegalStateException("No '" + MAIN - + "' or 'Start-Class' specified"); + throw new IllegalStateException( + "No '" + MAIN + "' or 'Start-Class' specified"); } return mainClass; } @@ -365,8 +368,8 @@ public class PropertiesLauncher extends Launcher { private ClassLoader wrapWithCustomClassLoader(ClassLoader parent, String loaderClassName) throws Exception { - Class<ClassLoader> loaderClass = (Class<ClassLoader>) Class.forName( - loaderClassName, true, parent); + Class<ClassLoader> loaderClass = (Class<ClassLoader>) Class + .forName(loaderClassName, true, parent); try { return loaderClass.getConstructor(ClassLoader.class).newInstance(parent); @@ -404,8 +407,8 @@ public class PropertiesLauncher extends Launcher { } if (this.properties.containsKey(propertyKey)) { - String value = SystemPropertyUtils.resolvePlaceholders(this.properties - .getProperty(propertyKey)); + String value = SystemPropertyUtils + .resolvePlaceholders(this.properties.getProperty(propertyKey)); this.logger.fine("Property '" + propertyKey + "' from properties: " + value); return value; } @@ -429,8 +432,8 @@ public class PropertiesLauncher extends Launcher { if (manifest != null) { String value = manifest.getMainAttributes().getValue(manifestKey); if (value != null) { - this.logger.fine("Property '" + manifestKey + "' from archive manifest: " - + value); + this.logger.fine( + "Property '" + manifestKey + "' from archive manifest: " + value); return value; } } @@ -468,14 +471,14 @@ public class PropertiesLauncher extends Launcher { } Archive archive = getArchive(file); if (archive != null) { - this.logger.info("Adding classpath entries from archive " + archive.getUrl() - + root); + this.logger.info( + "Adding classpath entries from archive " + archive.getUrl() + root); lib.add(archive); } Archive nested = getNestedArchive(root); if (nested != null) { - this.logger.info("Adding classpath entries from nested " + nested.getUrl() - + root); + this.logger.info( + "Adding classpath entries from nested " + nested.getUrl() + root); lib.add(nested); } return lib; @@ -509,8 +512,8 @@ public class PropertiesLauncher extends Launcher { return new FilteredArchive(this.parent, filter); } - private void addParentClassLoaderEntries(List<Archive> lib) throws IOException, - URISyntaxException { + private void addParentClassLoaderEntries(List<Archive> lib) + throws IOException, URISyntaxException { ClassLoader parentClassLoader = getClass().getClassLoader(); List<Archive> urls = new ArrayList<Archive>(); for (URL url : getURLs(parentClassLoader)) { @@ -521,8 +524,8 @@ public class PropertiesLauncher extends Launcher { String name = url.getFile(); File dir = new File(name.substring(0, name.length() - 1)); if (dir.exists()) { - urls.add(new ExplodedArchive(new File(name.substring(0, - name.length() - 1)), false)); + urls.add(new ExplodedArchive( + new File(name.substring(0, name.length() - 1)), false)); } } else { diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java index 66b9eb9afa..fc4e5d8bed 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java @@ -44,8 +44,8 @@ import org.springframework.boot.loader.util.AsciiBytes; */ public class ExplodedArchive extends Archive { - private static final Set<String> SKIPPED_NAMES = new HashSet<String>(Arrays.asList( - ".", "..")); + private static final Set<String> SKIPPED_NAMES = new HashSet<String>( + Arrays.asList(".", "..")); private static final AsciiBytes MANIFEST_ENTRY_NAME = new AsciiBytes( "META-INF/MANIFEST.MF"); @@ -152,7 +152,8 @@ public class ExplodedArchive extends Archive { protected Archive getNestedArchive(Entry entry) throws IOException { File file = ((FileEntry) entry).getFile(); - return (file.isDirectory() ? new ExplodedArchive(file) : new JarFileArchive(file)); + return (file.isDirectory() ? new ExplodedArchive(file) + : new JarFileArchive(file)); } @Override @@ -204,8 +205,8 @@ public class ExplodedArchive extends Archive { @Override protected URLConnection openConnection(URL url) throws IOException { - String name = url.getPath().substring( - ExplodedArchive.this.root.toURI().getPath().length()); + String name = url.getPath() + .substring(ExplodedArchive.this.root.toURI().getPath().length()); if (ExplodedArchive.this.entries.containsKey(new AsciiBytes(name))) { return new URL(url.toString()).openConnection(); } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java index bbc0692535..1289fca026 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/FilteredArchive.java @@ -85,8 +85,8 @@ public class FilteredArchive extends Archive { return this.parent.getFilteredArchive(new EntryRenameFilter() { @Override public AsciiBytes apply(AsciiBytes entryName, Entry entry) { - return FilteredArchive.this.filter.matches(entry) ? filter.apply( - entryName, entry) : null; + return FilteredArchive.this.filter.matches(entry) + ? filter.apply(entryName, entry) : null; } }); } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java index 0fc16f83e0..a5ddc55517 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java @@ -247,8 +247,9 @@ public class RandomAccessDataFile implements RandomAccessData { try { this.available.acquire(); RandomAccessFile file = this.files.poll(); - return (file == null ? new RandomAccessFile( - RandomAccessDataFile.this.file, "r") : file); + return (file == null + ? new RandomAccessFile(RandomAccessDataFile.this.file, "r") + : file); } catch (InterruptedException ex) { throw new IOException(ex); diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java index b0f4ecf2e8..2e619172d9 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java @@ -82,8 +82,8 @@ class CentralDirectoryEndRecord { return false; } // Total size must be the structure size + comment - long commentLength = Bytes.littleEndianValue(this.block, this.offset - + COMMENT_LENGTH_OFFSET, 2); + long commentLength = Bytes.littleEndianValue(this.block, + this.offset + COMMENT_LENGTH_OFFSET, 2); return this.size == MINIMUM_SIZE + commentLength; } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java index 4cfcd52dd8..93d1d4837e 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java @@ -45,14 +45,16 @@ public class Handler extends URLStreamHandler { private static final String SEPARATOR = "!/"; - private static final String[] FALLBACK_HANDLERS = { "sun.net.www.protocol.jar.Handler" }; + private static final String[] FALLBACK_HANDLERS = { + "sun.net.www.protocol.jar.Handler" }; private static final Method OPEN_CONNECTION_METHOD; + static { Method method = null; try { - method = URLStreamHandler.class - .getDeclaredMethod("openConnection", URL.class); + method = URLStreamHandler.class.getDeclaredMethod("openConnection", + URL.class); } catch (Exception ex) { } @@ -60,6 +62,7 @@ public class Handler extends URLStreamHandler { } private static SoftReference<Map<File, JarFile>> rootFileCache; + static { rootFileCache = new SoftReference<Map<File, JarFile>>(null); } @@ -186,7 +189,8 @@ public class Handler extends URLStreamHandler { * which are then swallowed. * @param useFastConnectionExceptions if fast connection exceptions can be used. */ - public static void setUseFastConnectionExceptions(boolean useFastConnectionExceptions) { + public static void setUseFastConnectionExceptions( + boolean useFastConnectionExceptions) { JarURLConnection.setUseFastExceptions(useFastConnectionExceptions); } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryData.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryData.java index adc3bde0b2..bbc7317135 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryData.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryData.java @@ -107,13 +107,13 @@ public final class JarEntryData { // aspectjrt-1.7.4.jar has a different ext bytes length in the // local directory to the central directory. We need to re-read // here to skip them - byte[] localHeader = Bytes.get(this.source.getData().getSubsection( - this.localHeaderOffset, LOCAL_FILE_HEADER_SIZE)); + byte[] localHeader = Bytes.get(this.source.getData() + .getSubsection(this.localHeaderOffset, LOCAL_FILE_HEADER_SIZE)); long nameLength = Bytes.littleEndianValue(localHeader, 26, 2); long extraLength = Bytes.littleEndianValue(localHeader, 28, 2); - this.data = this.source.getData().getSubsection( - this.localHeaderOffset + LOCAL_FILE_HEADER_SIZE + nameLength - + extraLength, getCompressedSize()); + this.data = this.source.getData().getSubsection(this.localHeaderOffset + + LOCAL_FILE_HEADER_SIZE + nameLength + extraLength, + getCompressedSize()); } return this.data; } @@ -154,8 +154,8 @@ public final class JarEntryData { } /** - * Decode MSDOS Date Time details. See <a - * href="http://mindprod.com/jgloss/zip.html">mindprod.com/jgloss/zip.html</a> for + * Decode MSDOS Date Time details. See + * <a href="http://mindprod.com/jgloss/zip.html">mindprod.com/jgloss/zip.html</a> for * more details of the format. * @param date the date part * @param time the time part 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 bb838ca995..bf2c1e181a 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 @@ -124,7 +124,7 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD private JarFile(RandomAccessDataFile rootFile, String pathFromRoot, RandomAccessData data, List<JarEntryData> entries, JarEntryFilter... filters) - throws IOException { + throws IOException { super(rootFile.getFile()); this.rootFile = rootFile; this.pathFromRoot = pathFromRoot; @@ -167,7 +167,8 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD for (JarEntryData entry : entries) { AsciiBytes name = entry.getName(); for (JarEntryFilter filter : filters) { - name = (filter == null || name == null ? name : filter.apply(name, entry)); + name = (filter == null || name == null ? name + : filter.apply(name, entry)); } if (name != null) { JarEntryData filteredCopy = entry.createFilteredCopy(this, name); @@ -291,8 +292,8 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD // Fallback to JarInputStream to obtain certificates, not fast but hopefully not // happening that often. try { - JarInputStream inputStream = new JarInputStream(getData().getInputStream( - ResourceAccess.ONCE)); + JarInputStream inputStream = new JarInputStream( + getData().getInputStream(ResourceAccess.ONCE)); try { java.util.jar.JarEntry entry = inputStream.getNextJarEntry(); while (entry != null) { @@ -343,8 +344,8 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD return sourceEntry.nestedJar; } catch (IOException ex) { - throw new IOException("Unable to open nested jar file '" - + sourceEntry.getName() + "'", ex); + throw new IOException( + "Unable to open nested jar file '" + sourceEntry.getName() + "'", ex); } } @@ -367,9 +368,10 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD return null; } }; - return new JarFile(this.rootFile, this.pathFromRoot + "!/" - + sourceEntry.getName().substring(0, sourceName.length() - 1), this.data, - this.entries, filter); + return new JarFile(this.rootFile, + this.pathFromRoot + "!/" + + sourceEntry.getName().substring(0, sourceName.length() - 1), + this.data, this.entries, filter); } private JarFile createJarFileFromFileEntry(JarEntryData sourceEntry) @@ -380,8 +382,8 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD + "jar files must be stored without compression. Please check the " + "mechanism used to create your executable jar file"); } - return new JarFile(this.rootFile, this.pathFromRoot + "!/" - + sourceEntry.getName(), sourceEntry.getData()); + return new JarFile(this.rootFile, + this.pathFromRoot + "!/" + sourceEntry.getName(), sourceEntry.getData()); } /** diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java index 3a321d7f4b..815d03f7c7 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java @@ -101,8 +101,8 @@ class JarURLConnection extends java.net.JarURLConnection { @Override public void connect() throws IOException { if (!this.jarEntryName.isEmpty()) { - this.jarEntryData = this.jarFile.getJarEntryData(this.jarEntryName - .asAsciiBytes()); + this.jarEntryData = this.jarFile + .getJarEntryData(this.jarEntryName.asAsciiBytes()); if (this.jarEntryData == null) { throwFileNotFound(this.jarEntryName, this.jarFile); } @@ -115,8 +115,8 @@ class JarURLConnection extends java.net.JarURLConnection { if (Boolean.TRUE.equals(useFastExceptions.get())) { throw FILE_NOT_FOUND_EXCEPTION; } - throw new FileNotFoundException("JAR entry " + entry + " not found in " - + jarFile.getName()); + throw new FileNotFoundException( + "JAR entry " + entry + " not found in " + jarFile.getName()); } @Override @@ -247,8 +247,8 @@ class JarURLConnection extends java.net.JarURLConnection { int hi = Character.digit(source.charAt(i + 1), 16); int lo = Character.digit(source.charAt(i + 2), 16); if (hi == -1 || lo == -1) { - throw new IllegalArgumentException("Invalid encoded sequence \"" - + source.substring(i) + "\""); + throw new IllegalArgumentException( + "Invalid encoded sequence \"" + source.substring(i) + "\""); } return ((char) ((hi << 4) + lo)); } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/AsciiBytes.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/AsciiBytes.java index 1fc2b41134..c05e18af8b 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/AsciiBytes.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/AsciiBytes.java @@ -101,8 +101,8 @@ public final class AsciiBytes { return false; } for (int i = 0; i < postfix.length; i++) { - if (this.bytes[this.offset + (this.length - 1) - i] != postfix.bytes[postfix.offset - + (postfix.length - 1) - i]) { + if (this.bytes[this.offset + (this.length - 1) + - i] != postfix.bytes[postfix.offset + (postfix.length - 1) - i]) { return false; } } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java index 0fb63a0157..7ecbada519 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java @@ -96,8 +96,8 @@ public abstract class SystemPropertyUtils { while (startIndex != -1) { int endIndex = findPlaceholderEndIndex(buf, startIndex); if (endIndex != -1) { - String placeholder = buf.substring( - startIndex + PLACEHOLDER_PREFIX.length(), endIndex); + String placeholder = buf + .substring(startIndex + PLACEHOLDER_PREFIX.length(), endIndex); String originalPlaceholder = placeholder; if (!visitedPlaceholders.add(originalPlaceholder)) { throw new IllegalArgumentException("Circular placeholder reference '" @@ -115,9 +115,10 @@ public abstract class SystemPropertyUtils { if (separatorIndex != -1) { String actualPlaceholder = placeholder.substring(0, separatorIndex); - String defaultValue = placeholder.substring(separatorIndex - + VALUE_SEPARATOR.length()); - propVal = resolvePlaceholder(properties, value, actualPlaceholder); + String defaultValue = placeholder + .substring(separatorIndex + VALUE_SEPARATOR.length()); + propVal = resolvePlaceholder(properties, value, + actualPlaceholder); if (propVal == null) { propVal = defaultValue; } @@ -135,8 +136,8 @@ public abstract class SystemPropertyUtils { } else { // Proceed with unprocessed value. - startIndex = buf.indexOf(PLACEHOLDER_PREFIX, endIndex - + PLACEHOLDER_SUFFIX.length()); + startIndex = buf.indexOf(PLACEHOLDER_PREFIX, + endIndex + PLACEHOLDER_SUFFIX.length()); } visitedPlaceholders.remove(originalPlaceholder); } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/ExecutableArchiveLauncherTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/ExecutableArchiveLauncherTests.java index 3108b35287..849e01cbd5 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/ExecutableArchiveLauncherTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/ExecutableArchiveLauncherTests.java @@ -90,8 +90,8 @@ public class ExecutableArchiveLauncherTests { assertArrayEquals(urls, ((URLClassLoader) classLoader).getURLs()); } - private static final class UnitTestExecutableArchiveLauncher extends - ExecutableArchiveLauncher { + private static final class UnitTestExecutableArchiveLauncher + extends ExecutableArchiveLauncher { public UnitTestExecutableArchiveLauncher(JavaAgentDetector javaAgentDetector) { super(javaAgentDetector); @@ -103,7 +103,8 @@ public class ExecutableArchiveLauncherTests { } } - private void doWithTccl(ClassLoader classLoader, Callable<?> action) throws Exception { + private void doWithTccl(ClassLoader classLoader, Callable<?> action) + throws Exception { ClassLoader old = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(classLoader); diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/InputArgumentsJavaAgentDetectorTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/InputArgumentsJavaAgentDetectorTests.java index b42e4c2c36..f4d930a992 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/InputArgumentsJavaAgentDetectorTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/InputArgumentsJavaAgentDetectorTests.java @@ -34,38 +34,39 @@ import static org.junit.Assert.assertTrue; public class InputArgumentsJavaAgentDetectorTests { @Test - public void nonAgentJarsDoNotProduceFalsePositives() throws MalformedURLException, - IOException { + public void nonAgentJarsDoNotProduceFalsePositives() + throws MalformedURLException, IOException { InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector( Arrays.asList("-javaagent:my-agent.jar")); - assertFalse(detector.isJavaAgentJar(new File("something-else.jar") - .getCanonicalFile().toURI().toURL())); + assertFalse(detector.isJavaAgentJar( + new File("something-else.jar").getCanonicalFile().toURI().toURL())); } @Test public void singleJavaAgent() throws MalformedURLException, IOException { InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector( Arrays.asList("-javaagent:my-agent.jar")); - assertTrue(detector.isJavaAgentJar(new File("my-agent.jar").getCanonicalFile() - .toURI().toURL())); + assertTrue(detector.isJavaAgentJar( + new File("my-agent.jar").getCanonicalFile().toURI().toURL())); } @Test public void singleJavaAgentWithOptions() throws MalformedURLException, IOException { InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector( Arrays.asList("-javaagent:my-agent.jar=a=alpha,b=bravo")); - assertTrue(detector.isJavaAgentJar(new File("my-agent.jar").getCanonicalFile() - .toURI().toURL())); + assertTrue(detector.isJavaAgentJar( + new File("my-agent.jar").getCanonicalFile().toURI().toURL())); } @Test public void multipleJavaAgents() throws MalformedURLException, IOException { InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector( - Arrays.asList("-javaagent:my-agent.jar", "-javaagent:my-other-agent.jar")); - assertTrue(detector.isJavaAgentJar(new File("my-agent.jar").getCanonicalFile() - .toURI().toURL())); - assertTrue(detector.isJavaAgentJar(new File("my-other-agent.jar") - .getCanonicalFile().toURI().toURL())); + Arrays.asList("-javaagent:my-agent.jar", + "-javaagent:my-other-agent.jar")); + assertTrue(detector.isJavaAgentJar( + new File("my-agent.jar").getCanonicalFile().toURI().toURL())); + assertTrue(detector.isJavaAgentJar( + new File("my-other-agent.jar").getCanonicalFile().toURI().toURL())); } } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/LaunchedURLClassLoaderTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/LaunchedURLClassLoaderTests.java index 1ffe87ea38..fed4cd8d24 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/LaunchedURLClassLoaderTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/LaunchedURLClassLoaderTests.java @@ -46,44 +46,44 @@ public class LaunchedURLClassLoaderTests { public void resolveResourceFromWindowsFilesystem() throws Exception { // This path is invalid - it should return null even on Windows. // A regular URLClassLoader will deal with it gracefully. - assertNull(getClass().getClassLoader().getResource( - "c:\\Users\\user\\bar.properties")); - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + assertNull(getClass().getClassLoader() + .getResource("c:\\Users\\user\\bar.properties")); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); // So we should too... assertNull(loader.getResource("c:\\Users\\user\\bar.properties")); } @Test public void resolveResourceFromArchive() throws Exception { - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); assertNotNull(loader.getResource("demo/Application.java")); } @Test public void resolveResourcesFromArchive() throws Exception { - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); assertTrue(loader.getResources("demo/Application.java").hasMoreElements()); } @Test public void resolveRootPathFromArchive() throws Exception { - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); assertNotNull(loader.getResource("")); } @Test public void resolveRootResourcesFromArchive() throws Exception { - LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { new URL( - "jar:file:src/test/resources/jars/app.jar!/") }, getClass() - .getClassLoader()); + LaunchedURLClassLoader loader = new LaunchedURLClassLoader( + new URL[] { new URL("jar:file:src/test/resources/jars/app.jar!/") }, + getClass().getClassLoader()); assertTrue(loader.getResources("").hasMoreElements()); } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java index 6c0043cea7..47fb1460f8 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java @@ -80,7 +80,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.config.name", "foo"); PropertiesLauncher launcher = new PropertiesLauncher(); assertEquals("my.Application", launcher.getMainClass()); - assertEquals("[etc/]", ReflectionTestUtils.getField(launcher, "paths").toString()); + assertEquals("[etc/]", + ReflectionTestUtils.getField(launcher, "paths").toString()); } @Test @@ -95,8 +96,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.path", "jars/*"); System.setProperty("loader.main", "demo.Application"); PropertiesLauncher launcher = new PropertiesLauncher(); - assertEquals("[jars/]", ReflectionTestUtils.getField(launcher, "paths") - .toString()); + assertEquals("[jars/]", + ReflectionTestUtils.getField(launcher, "paths").toString()); launcher.launch(new String[0]); waitFor("Hello World"); } @@ -106,8 +107,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.path", "jars/app.jar"); System.setProperty("loader.main", "demo.Application"); PropertiesLauncher launcher = new PropertiesLauncher(); - assertEquals("[jars/app.jar]", ReflectionTestUtils.getField(launcher, "paths") - .toString()); + assertEquals("[jars/app.jar]", + ReflectionTestUtils.getField(launcher, "paths").toString()); launcher.launch(new String[0]); waitFor("Hello World"); } @@ -117,8 +118,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.path", "./jars/app.jar"); System.setProperty("loader.main", "demo.Application"); PropertiesLauncher launcher = new PropertiesLauncher(); - assertEquals("[jars/app.jar]", ReflectionTestUtils.getField(launcher, "paths") - .toString()); + assertEquals("[jars/app.jar]", + ReflectionTestUtils.getField(launcher, "paths").toString()); launcher.launch(new String[0]); waitFor("Hello World"); } @@ -128,8 +129,8 @@ public class PropertiesLauncherTests { System.setProperty("loader.path", "jars/app.jar"); System.setProperty("loader.classLoader", URLClassLoader.class.getName()); PropertiesLauncher launcher = new PropertiesLauncher(); - assertEquals("[jars/app.jar]", ReflectionTestUtils.getField(launcher, "paths") - .toString()); + assertEquals("[jars/app.jar]", + ReflectionTestUtils.getField(launcher, "paths").toString()); launcher.launch(new String[0]); waitFor("Hello World"); } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/WarLauncherTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/WarLauncherTests.java index b7175cb633..9d2efeb8ce 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/WarLauncherTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/WarLauncherTests.java @@ -65,10 +65,8 @@ public class WarLauncherTests { List<Archive> archives = launcher.getClassPathArchives(); assertEquals(2, archives.size()); - assertThat( - getUrls(archives), - hasItems(webInfClasses.toURI().toURL(), new URL("jar:" - + webInfLibFoo.toURI().toURL() + "!/"))); + assertThat(getUrls(archives), hasItems(webInfClasses.toURI().toURL(), + new URL("jar:" + webInfLibFoo.toURI().toURL() + "!/"))); } @Test @@ -80,12 +78,10 @@ public class WarLauncherTests { List<Archive> archives = launcher.getClassPathArchives(); assertEquals(2, archives.size()); - assertThat( - getUrls(archives), - hasItems( - new URL("jar:" + warRoot.toURI().toURL() + "!/WEB-INF/classes!/"), - new URL("jar:" + warRoot.toURI().toURL() - + "!/WEB-INF/lib/foo.jar!/"))); + assertThat(getUrls(archives), + hasItems(new URL("jar:" + warRoot.toURI().toURL() + + "!/WEB-INF/classes!/"), + new URL("jar:" + warRoot.toURI().toURL() + "!/WEB-INF/lib/foo.jar!/"))); } private Set<URL> getUrls(List<Archive> archives) throws MalformedURLException { @@ -100,8 +96,8 @@ public class WarLauncherTests { File warRoot = new File("target/archive.war"); warRoot.delete(); - JarOutputStream jarOutputStream = new JarOutputStream(new FileOutputStream( - warRoot)); + JarOutputStream jarOutputStream = new JarOutputStream( + new FileOutputStream(warRoot)); jarOutputStream.putNextEntry(new JarEntry("WEB-INF/")); jarOutputStream.putNextEntry(new JarEntry("WEB-INF/classes/")); diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java index 03c1f21ca5..01f47fb109 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java @@ -69,8 +69,8 @@ public class ExplodedArchiveTests { Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); - File destination = new File(this.rootFolder.getAbsolutePath() - + File.separator + entry.getName()); + File destination = new File( + this.rootFolder.getAbsolutePath() + File.separator + entry.getName()); destination.getParentFile().mkdirs(); if (entry.isDirectory()) { destination.mkdir(); @@ -115,8 +115,8 @@ public class ExplodedArchiveTests { public void getNestedArchive() throws Exception { Entry entry = getEntriesMap(this.archive).get("nested.jar"); Archive nested = this.archive.getNestedArchive(entry); - assertThat(nested.getUrl().toString(), equalTo("jar:" + this.rootFolder.toURI() - + "nested.jar!/")); + assertThat(nested.getUrl().toString(), + equalTo("jar:" + this.rootFolder.toURI() + "nested.jar!/")); } @Test @@ -125,8 +125,8 @@ public class ExplodedArchiveTests { Archive nested = this.archive.getNestedArchive(entry); Map<String, Entry> nestedEntries = getEntriesMap(nested); assertThat(nestedEntries.size(), equalTo(1)); - assertThat(nested.getUrl().toString(), equalTo("file:" - + this.rootFolder.toURI().getPath() + "d/")); + assertThat(nested.getUrl().toString(), + equalTo("file:" + this.rootFolder.toURI().getPath() + "d/")); } @Test @@ -159,7 +159,8 @@ public class ExplodedArchiveTests { @Test public void getNonRecursiveManifest() throws Exception { - ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root")); + ExplodedArchive archive = new ExplodedArchive( + new File("src/test/resources/root")); assertNotNull(archive.getManifest()); Map<String, Archive.Entry> entries = getEntriesMap(archive); assertThat(entries.size(), equalTo(4)); @@ -167,8 +168,8 @@ public class ExplodedArchiveTests { @Test public void getNonRecursiveManifestEvenIfNonRecursive() throws Exception { - ExplodedArchive archive = new ExplodedArchive( - new File("src/test/resources/root"), false); + ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root"), + false); assertNotNull(archive.getManifest()); Map<String, Archive.Entry> entries = getEntriesMap(archive); assertThat(entries.size(), equalTo(3)); @@ -176,7 +177,8 @@ public class ExplodedArchiveTests { @Test public void getResourceAsStream() throws Exception { - ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root")); + ExplodedArchive archive = new ExplodedArchive( + new File("src/test/resources/root")); assertNotNull(archive.getManifest()); URLClassLoader loader = new URLClassLoader(new URL[] { archive.getUrl() }); assertNotNull(loader.getResourceAsStream("META-INF/spring/application.xml")); @@ -185,8 +187,8 @@ public class ExplodedArchiveTests { @Test public void getResourceAsStreamNonRecursive() throws Exception { - ExplodedArchive archive = new ExplodedArchive( - new File("src/test/resources/root"), false); + ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root"), + false); assertNotNull(archive.getManifest()); URLClassLoader loader = new URLClassLoader(new URL[] { archive.getUrl() }); assertNotNull(loader.getResourceAsStream("META-INF/spring/application.xml")); diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java index 4512345e16..3ebc190bb9 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java @@ -85,8 +85,8 @@ public class JarFileArchiveTests { public void getNestedArchive() throws Exception { Entry entry = getEntriesMap(this.archive).get("nested.jar"); Archive nested = this.archive.getNestedArchive(entry); - assertThat(nested.getUrl().toString(), equalTo("jar:" + this.rootJarFileUrl - + "!/nested.jar!/")); + assertThat(nested.getUrl().toString(), + equalTo("jar:" + this.rootJarFileUrl + "!/nested.jar!/")); } @Test diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/ByteArrayRandomAccessDataTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/ByteArrayRandomAccessDataTests.java index 506dc47a03..ed9c5f005e 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/ByteArrayRandomAccessDataTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/ByteArrayRandomAccessDataTests.java @@ -34,8 +34,8 @@ public class ByteArrayRandomAccessDataTests { public void testGetInputStream() throws Exception { byte[] bytes = new byte[] { 0, 1, 2, 3, 4, 5 }; RandomAccessData data = new ByteArrayRandomAccessData(bytes); - assertThat(FileCopyUtils.copyToByteArray(data - .getInputStream(ResourceAccess.PER_READ)), equalTo(bytes)); + assertThat(FileCopyUtils.copyToByteArray( + data.getInputStream(ResourceAccess.PER_READ)), equalTo(bytes)); assertThat(data.getSize(), equalTo((long) bytes.length)); } @@ -44,8 +44,10 @@ public class ByteArrayRandomAccessDataTests { byte[] bytes = new byte[] { 0, 1, 2, 3, 4, 5 }; RandomAccessData data = new ByteArrayRandomAccessData(bytes); data = data.getSubsection(1, 4).getSubsection(1, 2); - assertThat(FileCopyUtils.copyToByteArray(data - .getInputStream(ResourceAccess.PER_READ)), equalTo(new byte[] { 2, 3 })); + assertThat( + FileCopyUtils + .copyToByteArray(data.getInputStream(ResourceAccess.PER_READ)), + equalTo(new byte[] { 2, 3 })); assertThat(data.getSize(), equalTo(2L)); } } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java index 8b13a2ad51..f48f1a2820 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java @@ -50,6 +50,7 @@ import static org.junit.Assert.assertThat; public class RandomAccessDataFileTests { private static final byte[] BYTES; + static { BYTES = new byte[256]; for (int i = 0; i < BYTES.length; i++) { @@ -212,7 +213,8 @@ public class RandomAccessDataFileTests { @Test public void subsectionZeroLength() throws Exception { RandomAccessData subsection = this.file.getSubsection(0, 0); - assertThat(subsection.getInputStream(ResourceAccess.PER_READ).read(), equalTo(-1)); + assertThat(subsection.getInputStream(ResourceAccess.PER_READ).read(), + equalTo(-1)); } @Test diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java index dfbbb7149a..cd3fd14605 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java @@ -152,8 +152,8 @@ public class JarFileTests { @Test public void getInputStream() throws Exception { - InputStream inputStream = this.jarFile.getInputStream(this.jarFile - .getEntry("1.dat")); + InputStream inputStream = this.jarFile + .getInputStream(this.jarFile.getEntry("1.dat")); assertThat(inputStream.available(), equalTo(1)); assertThat(inputStream.read(), equalTo(1)); assertThat(inputStream.available(), equalTo(0)); @@ -180,8 +180,8 @@ public class JarFileTests { @Test public void close() throws Exception { - RandomAccessDataFile randomAccessDataFile = spy(new RandomAccessDataFile( - this.rootJarFile, 1)); + RandomAccessDataFile randomAccessDataFile = spy( + new RandomAccessDataFile(this.rootJarFile, 1)); JarFile jarFile = new JarFile(randomAccessDataFile); jarFile.close(); verify(randomAccessDataFile).close(); @@ -204,7 +204,8 @@ public class JarFileTests { @Test public void createEntryUrl() throws Exception { URL url = new URL(this.jarFile.getUrl(), "1.dat"); - assertThat(url.toString(), equalTo("jar:" + this.rootJarFile.toURI() + "!/1.dat")); + assertThat(url.toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/1.dat")); JarURLConnection jarURLConnection = (JarURLConnection) url.openConnection(); assertThat(jarURLConnection.getJarFile(), sameInstance(this.jarFile)); assertThat(jarURLConnection.getJarEntry(), @@ -217,8 +218,8 @@ public class JarFileTests { @Test public void getMissingEntryUrl() throws Exception { URL url = new URL(this.jarFile.getUrl(), "missing.dat"); - assertThat(url.toString(), equalTo("jar:" + this.rootJarFile.toURI() - + "!/missing.dat")); + assertThat(url.toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/missing.dat")); this.thrown.expect(FileNotFoundException.class); ((JarURLConnection) url.openConnection()).getJarEntry(); } @@ -242,8 +243,8 @@ public class JarFileTests { @Test public void getNestedJarFile() throws Exception { - JarFile nestedJarFile = this.jarFile.getNestedJarFile(this.jarFile - .getEntry("nested.jar")); + JarFile nestedJarFile = this.jarFile + .getNestedJarFile(this.jarFile.getEntry("nested.jar")); Enumeration<java.util.jar.JarEntry> entries = nestedJarFile.entries(); assertThat(entries.nextElement().getName(), equalTo("META-INF/")); @@ -253,14 +254,14 @@ public class JarFileTests { assertThat(entries.nextElement().getName(), equalTo("\u00E4.dat")); assertThat(entries.hasMoreElements(), equalTo(false)); - InputStream inputStream = nestedJarFile.getInputStream(nestedJarFile - .getEntry("3.dat")); + InputStream inputStream = nestedJarFile + .getInputStream(nestedJarFile.getEntry("3.dat")); assertThat(inputStream.read(), equalTo(3)); assertThat(inputStream.read(), equalTo(-1)); URL url = nestedJarFile.getUrl(); - assertThat(url.toString(), equalTo("jar:" + this.rootJarFile.toURI() - + "!/nested.jar!/")); + assertThat(url.toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar!/")); JarURLConnection conn = (JarURLConnection) url.openConnection(); assertThat(conn.getJarFile(), sameInstance(nestedJarFile)); assertThat(conn.getJarFileURL().toString(), @@ -276,8 +277,8 @@ public class JarFileTests { assertThat(entries.nextElement().getName(), equalTo("9.dat")); assertThat(entries.hasMoreElements(), equalTo(false)); - InputStream inputStream = nestedJarFile.getInputStream(nestedJarFile - .getEntry("9.dat")); + InputStream inputStream = nestedJarFile + .getInputStream(nestedJarFile.getEntry("9.dat")); assertThat(inputStream.read(), equalTo(9)); assertThat(inputStream.read(), equalTo(-1)); @@ -289,11 +290,11 @@ public class JarFileTests { @Test public void getNestJarEntryUrl() throws Exception { - JarFile nestedJarFile = this.jarFile.getNestedJarFile(this.jarFile - .getEntry("nested.jar")); + JarFile nestedJarFile = this.jarFile + .getNestedJarFile(this.jarFile.getEntry("nested.jar")); URL url = nestedJarFile.getJarEntry("3.dat").getUrl(); - assertThat(url.toString(), equalTo("jar:" + this.rootJarFile.toURI() - + "!/nested.jar!/3.dat")); + assertThat(url.toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar!/3.dat")); InputStream inputStream = url.openStream(); assertThat(inputStream, notNullValue()); assertThat(inputStream.read(), equalTo(3)); @@ -310,8 +311,8 @@ public class JarFileTests { assertThat(inputStream.read(), equalTo(3)); JarURLConnection connection = (JarURLConnection) url.openConnection(); assertThat(connection.getURL().toString(), equalTo(spec)); - assertThat(connection.getJarFileURL().toString(), equalTo("jar:" - + this.rootJarFile.toURI() + "!/nested.jar")); + assertThat(connection.getJarFileURL().toString(), + equalTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar")); assertThat(connection.getEntryName(), equalTo("3.dat")); } @@ -360,8 +361,8 @@ public class JarFileTests { assertThat(entries.nextElement().getName(), equalTo("x.dat")); assertThat(entries.hasMoreElements(), equalTo(false)); - InputStream inputStream = filteredJarFile.getInputStream(filteredJarFile - .getEntry("x.dat")); + InputStream inputStream = filteredJarFile + .getInputStream(filteredJarFile.getEntry("x.dat")); assertThat(inputStream.read(), equalTo(1)); assertThat(inputStream.read(), equalTo(-1)); } @@ -369,8 +370,10 @@ public class JarFileTests { @Test public void sensibleToString() throws Exception { assertThat(this.jarFile.toString(), equalTo(this.rootJarFile.getPath())); - assertThat(this.jarFile.getNestedJarFile(this.jarFile.getEntry("nested.jar")) - .toString(), equalTo(this.rootJarFile.getPath() + "!/nested.jar")); + assertThat( + this.jarFile.getNestedJarFile(this.jarFile.getEntry("nested.jar")) + .toString(), + equalTo(this.rootJarFile.getPath() + "!/nested.jar")); } @Test @@ -418,8 +421,8 @@ public class JarFileTests { @Test public void cannotLoadMissingJar() throws Exception { // relates to gh-1070 - JarFile nestedJarFile = this.jarFile.getNestedJarFile(this.jarFile - .getEntry("nested.jar")); + JarFile nestedJarFile = this.jarFile + .getNestedJarFile(this.jarFile.getEntry("nested.jar")); URL nestedUrl = nestedJarFile.getUrl(); URL url = new URL(nestedUrl, nestedJarFile.getUrl() + "missing.jar!/3.dat"); this.thrown.expect(FileNotFoundException.class); diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/util/SystemPropertyUtilsTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/util/SystemPropertyUtilsTests.java index 96355eeed6..17111bc125 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/util/SystemPropertyUtilsTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/util/SystemPropertyUtilsTests.java @@ -49,7 +49,8 @@ public class SystemPropertyUtilsTests { @Test public void testNestedPlaceholder() { - assertEquals("foo", SystemPropertyUtils.resolvePlaceholders("${bar:${spam:foo}}")); + assertEquals("foo", + SystemPropertyUtils.resolvePlaceholders("${bar:${spam:foo}}")); } @Test diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java index 6856d67f14..91e75e10c4 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java @@ -107,10 +107,10 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo { for (ArtifactsFilter additionalFilter : additionalFilters) { filters.addFilter(additionalFilter); } - filters.addFilter(new ArtifactIdFilter("", - cleanFilterConfig(this.excludeArtifactIds))); - filters.addFilter(new MatchingGroupIdFilter( - cleanFilterConfig(this.excludeGroupIds))); + filters.addFilter( + new ArtifactIdFilter("", cleanFilterConfig(this.excludeArtifactIds))); + filters.addFilter( + new MatchingGroupIdFilter(cleanFilterConfig(this.excludeGroupIds))); if (this.includes != null && !this.includes.isEmpty()) { filters.addFilter(new IncludeFilter(this.includes)); } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java index 50280ea7c8..9186de4408 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java @@ -41,6 +41,7 @@ import org.springframework.boot.loader.tools.LibraryScope; public class ArtifactsLibraries implements Libraries { private static final Map<String, LibraryScope> SCOPES; + static { Map<String, LibraryScope> scopes = new HashMap<String, LibraryScope>(); scopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java index 9adb0e6a38..1a086f26c4 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java @@ -65,8 +65,8 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer String name = (String) key; String value = properties.getProperty(name); String existing = this.data.getProperty(name); - this.data - .setProperty(name, existing == null ? value : existing + "," + value); + this.data.setProperty(name, + existing == null ? value : existing + "," + value); } } 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 c8041150a4..cb1e624608 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 @@ -147,10 +147,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"); } } } @@ -173,9 +172,8 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { throw new MojoExecutionException(ex.getMessage(), ex); } if (!source.equals(target)) { - 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/RunArguments.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java index dfcfe97149..07d57fa99e 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java @@ -43,8 +43,8 @@ class RunArguments { return CommandLineUtils.translateCommandline(arguments); } catch (Exception ex) { - throw new IllegalArgumentException("Failed to parse arguments [" + arguments - + "]", ex); + throw new IllegalArgumentException( + "Failed to parse arguments [" + arguments + "]", ex); } } 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 684b962894..b3cb91f457 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 @@ -154,7 +154,8 @@ public class RunMojo 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()) }; } } } @@ -170,7 +171,8 @@ public class RunMojo extends AbstractDependencyFilterMojo { private void run(String startClassName) throws MojoExecutionException { findAgent(); boolean hasAgent = (this.agent != null && this.agent.length > 0); - boolean hasJvmArgs = (this.jvmArguments != null && this.jvmArguments.length() > 0); + boolean hasJvmArgs = (this.jvmArguments != null + && this.jvmArguments.length() > 0); if (Boolean.TRUE.equals(this.fork) || (this.fork == null && (hasAgent || hasJvmArgs))) { runWithForkedJvm(startClassName); @@ -180,9 +182,8 @@ public class RunMojo 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); } @@ -196,8 +197,8 @@ public class RunMojo extends AbstractDependencyFilterMojo { args.add(startClassName); addArgs(args); try { - new RunProcess(new JavaExecutable().toString()).run(args - .toArray(new String[args.size()])); + new RunProcess(new JavaExecutable().toString()) + .run(args.toArray(new String[args.size()])); } catch (Exception ex) { throw new MojoExecutionException("Could not exec java", ex); @@ -206,8 +207,9 @@ public class RunMojo extends AbstractDependencyFilterMojo { private void runWithMavenJvm(String startClassName) throws MojoExecutionException { IsolatedThreadGroup threadGroup = new IsolatedThreadGroup(startClassName); - Thread launchThread = new Thread(threadGroup, new LaunchRunner(startClassName, - this.arguments), startClassName + ".main()"); + Thread launchThread = new Thread(threadGroup, + new LaunchRunner(startClassName, this.arguments), + startClassName + ".main()"); launchThread.setContextClassLoader(new URLClassLoader(getClassPathUrls())); launchThread.start(); join(threadGroup); @@ -236,8 +238,9 @@ public class RunMojo 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"); @@ -310,10 +313,11 @@ public class RunMojo extends AbstractDependencyFilterMojo { urls.add(this.classesDirectory.toURI().toURL()); } - private void addDependencies(List<URL> urls) throws MalformedURLException, - MojoExecutionException { + private void addDependencies(List<URL> urls) + throws MalformedURLException, MojoExecutionException { FilterArtifacts filters = getFilters(new TestArtifactFilter()); - Set<Artifact> artifacts = filterDependencies(this.project.getArtifacts(), filters); + Set<Artifact> artifacts = filterDependencies(this.project.getArtifacts(), + filters); for (Artifact artifact : artifacts) { if (artifact.getFile() != null) { urls.add(artifact.getFile().toURI().toURL()); @@ -382,7 +386,8 @@ public class RunMojo 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); @@ -420,7 +425,8 @@ public class RunMojo 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/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 1f37f240fa..43b65463b7 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 class TestableDependencyFilterMojo extends - AbstractDependencyFilterMojo { + private static class TestableDependencyFilterMojo + extends AbstractDependencyFilterMojo { private TestableDependencyFilterMojo(List<Exclude> excludes, String excludeGroupIds, String excludeArtifactIds) { diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java index 9330379acf..880e9c8b58 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java @@ -41,17 +41,17 @@ public class ExcludeFilterTests { @Test public void excludeSimple() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar"))); - Set result = filter.filter(Collections - .singleton(createArtifact("com.foo", "bar"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar"))); + Set result = filter + .filter(Collections.singleton(createArtifact("com.foo", "bar"))); assertEquals("Should have been filtered", 0, result.size()); } @Test public void excludeGroupIdNoMatch() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.baz", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -60,8 +60,8 @@ public class ExcludeFilterTests { @Test public void excludeArtifactIdNoMatch() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.foo", "biz"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -70,17 +70,17 @@ public class ExcludeFilterTests { @Test public void excludeClassifier() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar", "jdk5"))); - Set result = filter.filter(Collections.singleton(createArtifact("com.foo", "bar", - "jdk5"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar", "jdk5"))); + Set result = filter + .filter(Collections.singleton(createArtifact("com.foo", "bar", "jdk5"))); assertEquals("Should have been filtered", 0, result.size()); } @Test public void excludeClassifierNoTargetClassifier() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar", "jdk5"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -89,8 +89,8 @@ public class ExcludeFilterTests { @Test public void excludeClassifierNoMatch() throws ArtifactFilterException { - ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo", - "bar", "jdk5"))); + ExcludeFilter filter = new ExcludeFilter( + Arrays.asList(createExclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar", "jdk6"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -126,7 +126,8 @@ public class ExcludeFilterTests { return exclude; } - private Artifact createArtifact(String groupId, String artifactId, String classifier) { + private Artifact createArtifact(String groupId, String artifactId, + String classifier) { Artifact a = mock(Artifact.class); given(a.getGroupId()).willReturn(groupId); given(a.getArtifactId()).willReturn(artifactId); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java index fe002342e0..83df6e822d 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java @@ -39,8 +39,8 @@ public class IncludeFilterTests { @Test public void includeSimple() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.foo", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -49,8 +49,8 @@ public class IncludeFilterTests { @Test public void includeGroupIdNoMatch() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.baz", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should have been filtered", 0, result.size()); @@ -58,8 +58,8 @@ public class IncludeFilterTests { @Test public void includeArtifactIdNoMatch() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar"))); Artifact artifact = createArtifact("com.foo", "biz"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should have been filtered", 0, result.size()); @@ -67,8 +67,8 @@ public class IncludeFilterTests { @Test public void includeClassifier() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar", "jdk5"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar", "jdk5"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should not have been filtered", 1, result.size()); @@ -77,8 +77,8 @@ public class IncludeFilterTests { @Test public void includeClassifierNoTargetClassifier() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar", "jdk5"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should have been filtered", 0, result.size()); @@ -86,8 +86,8 @@ public class IncludeFilterTests { @Test public void includeClassifierNoMatch() throws ArtifactFilterException { - IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo", - "bar", "jdk5"))); + IncludeFilter filter = new IncludeFilter( + Arrays.asList(createInclude("com.foo", "bar", "jdk5"))); Artifact artifact = createArtifact("com.foo", "bar", "jdk6"); Set result = filter.filter(Collections.singleton(artifact)); assertEquals("Should have been filtered", 0, result.size()); @@ -121,7 +121,8 @@ public class IncludeFilterTests { return include; } - private Artifact createArtifact(String groupId, String artifactId, String classifier) { + private Artifact createArtifact(String groupId, String artifactId, + String classifier) { Artifact a = mock(Artifact.class); given(a.getGroupId()).willReturn(groupId); given(a.getArtifactId()).willReturn(artifactId); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/RunArgumentsTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/RunArgumentsTests.java index 57c3521abd..89a6e10798 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/RunArgumentsTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/RunArgumentsTests.java @@ -44,7 +44,8 @@ public class RunArgumentsTests { @Test public void parseDebugFlags() { - String[] args = parseArgs("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"); + String[] args = parseArgs( + "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"); assertEquals(2, args.length); assertEquals("-Xdebug", args[0]); assertEquals("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005", 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 f55377de2c..3d069b5393 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 @@ -118,8 +118,8 @@ public class Verify { return entry.getValue(); } } - throw new IllegalStateException("Unable to find entry starting with " - + entryName); + throw new IllegalStateException( + "Unable to find entry starting with " + entryName); } public boolean hasEntry(String entry) { @@ -191,16 +191,16 @@ public class Verify { verifier.assertHasEntryNameStartingWith("lib/spring-context"); verifier.assertHasEntryNameStartingWith("lib/spring-core"); verifier.assertHasEntryNameStartingWith("lib/javax.servlet-api-3"); - assertTrue("Unpacked launcher classes", verifier.hasEntry("org/" - + "springframework/boot/loader/JarLauncher.class")); - assertTrue("Own classes", verifier.hasEntry("org/" - + "test/SampleApplication.class")); + assertTrue("Unpacked launcher classes", verifier + .hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")); + assertTrue("Own classes", + verifier.hasEntry("org/" + "test/SampleApplication.class")); } @Override protected void verifyManifest(Manifest manifest) throws Exception { - assertEquals("org.springframework.boot.loader.JarLauncher", manifest - .getMainAttributes().getValue("Main-Class")); + assertEquals("org.springframework.boot.loader.JarLauncher", + manifest.getMainAttributes().getValue("Main-Class")); assertEquals(this.main, manifest.getMainAttributes().getValue("Start-Class")); assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used")); } @@ -217,20 +217,21 @@ public class Verify { super.verifyZipEntries(verifier); verifier.assertHasEntryNameStartingWith("WEB-INF/lib/spring-context"); verifier.assertHasEntryNameStartingWith("WEB-INF/lib/spring-core"); - verifier.assertHasEntryNameStartingWith("WEB-INF/lib-provided/javax.servlet-api-3"); - assertTrue("Unpacked launcher classes", verifier.hasEntry("org/" - + "springframework/boot/loader/JarLauncher.class")); - assertTrue("Own classes", verifier.hasEntry("WEB-INF/classes/org/" - + "test/SampleApplication.class")); + verifier.assertHasEntryNameStartingWith( + "WEB-INF/lib-provided/javax.servlet-api-3"); + assertTrue("Unpacked launcher classes", verifier + .hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")); + assertTrue("Own classes", verifier + .hasEntry("WEB-INF/classes/org/" + "test/SampleApplication.class")); assertTrue("Web content", verifier.hasEntry("index.html")); } @Override protected void verifyManifest(Manifest manifest) throws Exception { - assertEquals("org.springframework.boot.loader.WarLauncher", manifest - .getMainAttributes().getValue("Main-Class")); - assertEquals("org.test.SampleApplication", manifest.getMainAttributes() - .getValue("Start-Class")); + assertEquals("org.springframework.boot.loader.WarLauncher", + manifest.getMainAttributes().getValue("Main-Class")); + assertEquals("org.test.SampleApplication", + manifest.getMainAttributes().getValue("Start-Class")); assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used")); } } @@ -243,10 +244,10 @@ public class Verify { @Override protected void verifyManifest(Manifest manifest) throws Exception { - assertEquals("org.springframework.boot.loader.PropertiesLauncher", manifest - .getMainAttributes().getValue("Main-Class")); - assertEquals("org.test.SampleApplication", manifest.getMainAttributes() - .getValue("Start-Class")); + assertEquals("org.springframework.boot.loader.PropertiesLauncher", + manifest.getMainAttributes().getValue("Main-Class")); + assertEquals("org.test.SampleApplication", + manifest.getMainAttributes().getValue("Start-Class")); assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used")); } } @@ -263,10 +264,10 @@ public class Verify { verifier.assertHasEntryNameStartingWith("lib/spring-context"); verifier.assertHasEntryNameStartingWith("lib/spring-core"); verifier.assertHasNoEntryNameStartingWith("lib/javax.servlet-api-3"); - assertFalse("Unpacked launcher classes", verifier.hasEntry("org/" - + "springframework/boot/loader/JarLauncher.class")); - assertTrue("Own classes", verifier.hasEntry("org/" - + "test/SampleModule.class")); + assertFalse("Unpacked launcher classes", verifier + .hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")); + assertTrue("Own classes", + verifier.hasEntry("org/" + "test/SampleModule.class")); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java index 34bd3dd5fa..707b625da2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -186,8 +186,8 @@ class BeanDefinitionLoader { private int load(CharSequence source) { - String resolvedSource = this.xmlReader.getEnvironment().resolvePlaceholders( - source.toString()); + String resolvedSource = this.xmlReader.getEnvironment() + .resolvePlaceholders(source.toString()); // Attempt as a Class try { @@ -250,11 +250,12 @@ class BeanDefinitionLoader { // Attempt to find a class in this package ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver( getClass().getClassLoader()); - Resource[] resources = resolver.getResources(ClassUtils - .convertClassNameToResourcePath(source.toString()) + "/*.class"); + Resource[] resources = resolver.getResources( + ClassUtils.convertClassNameToResourcePath(source.toString()) + + "/*.class"); for (Resource resource : resources) { - String className = StringUtils.stripFilenameExtension(resource - .getFilename()); + String className = StringUtils + .stripFilenameExtension(resource.getFilename()); load(Class.forName(source.toString() + "." + className)); break; } @@ -284,7 +285,8 @@ class BeanDefinitionLoader { * Simple {@link TypeFilter} used to ensure that specified {@link Class} sources are * not accidentally re-added during scanning. */ - private static class ClassExcludeFilter extends AbstractTypeHierarchyTraversingFilter { + private static class ClassExcludeFilter + extends AbstractTypeHierarchyTraversingFilter { private final Set<String> classNames = new HashSet<String>(); diff --git a/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java b/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java index 0bc021c887..92bbea44c8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java +++ b/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java @@ -53,10 +53,10 @@ public class ResourceBanner implements Banner { } @Override - public void printBanner(Environment environment, Class<?> sourceClass, PrintStream out) { + public void printBanner(Environment environment, Class<?> sourceClass, + PrintStream out) { try { - String banner = StreamUtils.copyToString( - this.resource.getInputStream(), + String banner = StreamUtils.copyToString(this.resource.getInputStream(), environment.getProperty("banner.charset", Charset.class, Charset.forName("UTF-8"))); @@ -82,8 +82,8 @@ public class ResourceBanner implements Banner { private PropertyResolver getVersionResolver(Class<?> sourceClass) { MutablePropertySources propertySources = new MutablePropertySources(); - propertySources.addLast(new MapPropertySource("version", - getVersionsMap(sourceClass))); + propertySources + .addLast(new MapPropertySource("version", getVersionsMap(sourceClass))); return new PropertySourcesPropertyResolver(propertySources); } @@ -94,7 +94,8 @@ public class ResourceBanner implements Banner { versions.put("application.version", getVersionString(appVersion, false)); versions.put("spring-boot.version", getVersionString(bootVersion, false)); versions.put("application.formatted-version", getVersionString(appVersion, true)); - versions.put("spring-boot.formatted-version", getVersionString(bootVersion, true)); + versions.put("spring-boot.formatted-version", + getVersionString(bootVersion, true)); return versions; } 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 41e42ccb4b..7603123f87 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; * * <p> * <ul> - * <li>{@link Class} - A Java class to be loaded by {@link AnnotatedBeanDefinitionReader}</li> + * <li>{@link Class} - A Java class to be loaded by {@link AnnotatedBeanDefinitionReader} + * </li> * * <li>{@link Resource} - An XML resource to be loaded by {@link XmlBeanDefinitionReader}, * or a groovy script to be loaded by {@link GroovyBeanDefinitionReader}</li> @@ -228,7 +229,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(); } @@ -268,10 +270,8 @@ public class SpringApplication { stopWatch.start(); ConfigurableApplicationContext context = null; - 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))); Collection<SpringApplicationRunListener> runListeners = getRunListeners(args); for (SpringApplicationRunListener runListener : runListeners) { @@ -326,8 +326,8 @@ public class SpringApplication { stopWatch.stop(); if (this.logStartupInfo) { - new StartupInfoLogger(this.mainApplicationClass).logStarted( - getApplicationLog(), stopWatch); + new StartupInfoLogger(this.mainApplicationClass) + .logStarted(getApplicationLog(), stopWatch); } return context; } @@ -379,8 +379,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); } } @@ -410,7 +410,8 @@ 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); } @@ -426,16 +427,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); } @@ -511,14 +512,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); @@ -547,8 +548,8 @@ public class SpringApplication { .setResourceLoader(this.resourceLoader); } if (context instanceof DefaultResourceLoader) { - ((DefaultResourceLoader) context).setClassLoader(this.resourceLoader - .getClassLoader()); + ((DefaultResourceLoader) context) + .setClassLoader(this.resourceLoader.getClassLoader()); } } } @@ -599,8 +600,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); @@ -665,15 +666,16 @@ public class SpringApplication { } private void runCommandLineRunners(ApplicationContext context, String... args) { - List<CommandLineRunner> runners = new ArrayList<CommandLineRunner>(context - .getBeansOfType(CommandLineRunner.class).values()); + List<CommandLineRunner> runners = new ArrayList<CommandLineRunner>( + context.getBeansOfType(CommandLineRunner.class).values()); AnnotationAwareOrderComparator.sort(runners); for (CommandLineRunner runner : runners) { try { runner.run(args); } catch (Exception ex) { - throw new IllegalStateException("Failed to execute CommandLineRunner", ex); + throw new IllegalStateException("Failed to execute CommandLineRunner", + ex); } } } @@ -1001,8 +1003,8 @@ public class SpringApplication { try { List<ExitCodeGenerator> generators = new ArrayList<ExitCodeGenerator>(); 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/StartupInfoLogger.java b/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java index a7c2fb02bc..9be3a112e6 100644 --- a/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java +++ b/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java @@ -139,7 +139,8 @@ class StartupInfoLogger { } }); ApplicationHome home = new ApplicationHome(this.sourceClass); - String path = (home.getSource() == null ? "" : home.getSource().getAbsolutePath()); + String path = (home.getSource() == null ? "" + : home.getSource().getAbsolutePath()); if (startedBy == null && path == null) { return ""; } 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 a14c62ad76..81df079d7d 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 @@ -59,7 +59,8 @@ class DefaultPropertyNamePatternsMatcher implements PropertyNamePatternsMatcher for (int nameIndex = 0; nameIndex < this.names.length; nameIndex++) { if (match[nameIndex]) { if (charIndex < this.names[nameIndex].length()) { - if (this.names[nameIndex].charAt(charIndex) == propertNameChars[charIndex]) { + if (this.names[nameIndex] + .charAt(charIndex) == propertNameChars[charIndex]) { match[nameIndex] = true; noneMatched = false; } 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 c671e54c7b..4f26f01371 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 @@ -48,8 +48,8 @@ import org.springframework.validation.Validator; * @param <T> The target type * @author Dave Syer */ -public class PropertiesConfigurationFactory<T> implements FactoryBean<T>, - MessageSourceAware, InitializingBean { +public class PropertiesConfigurationFactory<T> + implements FactoryBean<T>, MessageSourceAware, InitializingBean { private final Log logger = LogFactory.getLog(getClass()); @@ -236,8 +236,9 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>, } private void doBindPropertiesToTarget() throws BindException { - RelaxedDataBinder dataBinder = (this.targetName != null ? new RelaxedDataBinder( - this.target, this.targetName) : new RelaxedDataBinder(this.target)); + RelaxedDataBinder dataBinder = (this.targetName != null + ? new RelaxedDataBinder(this.target, this.targetName) + : new RelaxedDataBinder(this.target)); if (this.validator != null) { dataBinder.setValidator(this.validator); } @@ -288,9 +289,11 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>, if (errors.hasErrors()) { this.logger.error("Properties configuration failed validation"); for (ObjectError error : errors.getAllErrors()) { - this.logger.error(this.messageSource != null ? this.messageSource - .getMessage(error, Locale.getDefault()) + " (" + error + ")" - : error); + this.logger + .error(this.messageSource != null + ? this.messageSource.getMessage(error, + Locale.getDefault()) + " (" + error + ")" + : error); } if (this.exceptionIfInvalid) { throw new BindException(errors); 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 51f66a675e..ec514cdd58 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 @@ -121,7 +121,8 @@ public class PropertySourcesPropertyValues implements PropertyValues { } private void processEnumerablePropertySource(EnumerablePropertySource<?> source, - PropertySourcesPropertyResolver resolver, PropertyNamePatternsMatcher includes) { + PropertySourcesPropertyResolver resolver, + PropertyNamePatternsMatcher includes) { if (source.getPropertyNames().length > 0) { for (String propertyName : source.getPropertyNames()) { if (PropertySourcesPropertyValues.PATTERN_MATCHED_PROPERTY_SOURCES diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java index ff189199fb..b3d423a762 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java @@ -54,15 +54,15 @@ class RelaxedConversionService implements ConversionService { @Override public boolean canConvert(Class<?> sourceType, Class<?> targetType) { - return (this.conversionService != null && this.conversionService.canConvert( - sourceType, targetType)) + return (this.conversionService != null + && this.conversionService.canConvert(sourceType, targetType)) || this.additionalConverters.canConvert(sourceType, targetType); } @Override public boolean canConvert(TypeDescriptor sourceType, TypeDescriptor targetType) { - return (this.conversionService != null && this.conversionService.canConvert( - sourceType, targetType)) + return (this.conversionService != null + && this.conversionService.canConvert(sourceType, targetType)) || this.additionalConverters.canConvert(sourceType, targetType); } @@ -93,8 +93,8 @@ class RelaxedConversionService implements ConversionService { * case of the source. */ @SuppressWarnings({ "unchecked", "rawtypes" }) - private static class StringToEnumIgnoringCaseConverterFactory implements - ConverterFactory<String, Enum> { + private static class StringToEnumIgnoringCaseConverterFactory + implements ConverterFactory<String, Enum> { @Override public <T extends Enum> Converter<String, T> getConverter(Class<T> targetType) { @@ -123,8 +123,8 @@ class RelaxedConversionService implements ConversionService { } source = source.trim(); for (T candidate : (Set<T>) EnumSet.allOf(this.enumType)) { - RelaxedNames names = new RelaxedNames(candidate.name() - .replace("_", "-").toLowerCase()); + RelaxedNames names = new RelaxedNames( + candidate.name().replace("_", "-").toLowerCase()); for (String name : names) { if (name.equals(source)) { return candidate; 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 612e8ee02f..3c00667f5b 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 @@ -71,8 +71,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 = (StringUtils.hasLength(namePrefix) ? namePrefix + "." : null); } @@ -111,8 +111,8 @@ public class RelaxedDataBinder extends DataBinder { public void initBeanPropertyAccess() { super.initBeanPropertyAccess(); // Hook in the RelaxedConversionService - getInternalBindingResult().initConversion( - new RelaxedConversionService(getConversionService())); + getInternalBindingResult() + .initConversion(new RelaxedConversionService(getConversionService())); } @Override @@ -138,7 +138,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<PropertyValue> sortedValues = new ArrayList<PropertyValue>(); Set<String> modifiedNames = new HashSet<String>(); @@ -203,8 +204,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("."))) { @@ -224,7 +225,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)) { @@ -300,8 +302,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; @@ -310,7 +312,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(); diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java index 444acfc367..55c7c697c7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java @@ -171,12 +171,13 @@ public final class RelaxedNames implements Iterable<String> { public abstract String apply(String value); - private static String separatedToCamelCase(String value, boolean caseInsensitive) { + private static String separatedToCamelCase(String value, + boolean caseInsensitive) { StringBuilder builder = new StringBuilder(); for (String field : value.split("[_\\-.]")) { field = (caseInsensitive ? field.toLowerCase() : field); - builder.append(builder.length() == 0 ? field : StringUtils - .capitalize(field)); + builder.append( + builder.length() == 0 ? field : StringUtils.capitalize(field)); } for (String suffix : new String[] { "_", "-", "." }) { if (value.endsWith(suffix)) { diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java index 1894f70847..08b0259812 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java @@ -144,8 +144,8 @@ public class RelaxedPropertyResolver implements PropertyResolver { Assert.isInstanceOf(ConfigurableEnvironment.class, this.resolver, "SubProperties not available."); ConfigurableEnvironment env = (ConfigurableEnvironment) this.resolver; - return PropertySourceUtils.getSubProperties(env.getPropertySources(), - this.prefix, keyPrefix); + return PropertySourceUtils.getSubProperties(env.getPropertySources(), this.prefix, + keyPrefix); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/SimplePropertyNamePatternsMatcher.java b/spring-boot/src/main/java/org/springframework/boot/bind/SimplePropertyNamePatternsMatcher.java index b7fd6380e2..19bdfa7588 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/SimplePropertyNamePatternsMatcher.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/SimplePropertyNamePatternsMatcher.java @@ -32,8 +32,8 @@ class SimplePropertyNamePatternsMatcher implements PropertyNamePatternsMatcher { private final String[] patterns; public SimplePropertyNamePatternsMatcher(Collection<String> 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/YamlConfigurationFactory.java b/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java index f1f1efaea3..5e30ce7057 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java @@ -48,8 +48,8 @@ import org.yaml.snakeyaml.error.YAMLException; * @author Luke Taylor * @author Dave Syer */ -public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourceAware, - InitializingBean { +public class YamlConfigurationFactory<T> + implements FactoryBean<T>, MessageSourceAware, InitializingBean { private final Log logger = LogFactory.getLog(getClass()); @@ -91,7 +91,8 @@ public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourc * @param propertyAliases the propertyAliases to set */ public void setPropertyAliases(Map<Class<?>, Map<String, String>> propertyAliases) { - this.propertyAliases = new HashMap<Class<?>, Map<String, String>>(propertyAliases); + this.propertyAliases = new HashMap<Class<?>, Map<String, String>>( + propertyAliases); } /** @@ -156,9 +157,11 @@ public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourc if (errors.hasErrors()) { this.logger.error("YAML configuration failed validation"); for (ObjectError error : errors.getAllErrors()) { - this.logger.error(this.messageSource != null ? this.messageSource - .getMessage(error, Locale.getDefault()) + " (" + error + ")" - : error); + this.logger + .error(this.messageSource != null + ? this.messageSource.getMessage(error, + Locale.getDefault()) + " (" + error + ")" + : error); } if (this.exceptionIfInvalid) { BindException summary = new BindException(errors); diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java index 860c1de62d..c020d7d3fa 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java @@ -59,8 +59,8 @@ public class ParentContextApplicationContextInitializer implements } } - private static class EventPublisher implements - ApplicationListener<ContextRefreshedEvent>, Ordered { + private static class EventPublisher + implements ApplicationListener<ContextRefreshedEvent>, Ordered { private static EventPublisher INSTANCE = new EventPublisher(); diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java index 503dc00ce1..49d401aa72 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java @@ -36,9 +36,9 @@ import org.springframework.util.ObjectUtils; * @author Dave Syer * @author Eric Bottard */ -public class ParentContextCloserApplicationListener implements - ApplicationListener<ParentContextAvailableEvent>, ApplicationContextAware, - Ordered { +public class ParentContextCloserApplicationListener + implements ApplicationListener<ParentContextAvailableEvent>, + ApplicationContextAware, Ordered { private int order = Ordered.LOWEST_PRECEDENCE - 10; @@ -83,8 +83,8 @@ public class ParentContextCloserApplicationListener implements /** * {@link ApplicationListener} to close the context. */ - protected static class ContextCloserListener implements - ApplicationListener<ContextClosedEvent> { + protected static class ContextCloserListener + implements ApplicationListener<ContextClosedEvent> { private WeakReference<ConfigurableApplicationContext> childContext; diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java index 5f8f425749..59b7ecfa23 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java @@ -445,7 +445,8 @@ public class SpringApplicationBuilder { * @param beanNameGenerator the generator to set. * @return the current builder */ - public SpringApplicationBuilder beanNameGenerator(BeanNameGenerator beanNameGenerator) { + public SpringApplicationBuilder beanNameGenerator( + BeanNameGenerator beanNameGenerator) { this.application.setBeanNameGenerator(beanNameGenerator); return this; } diff --git a/spring-boot/src/main/java/org/springframework/boot/cloudfoundry/VcapApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/cloudfoundry/VcapApplicationListener.java index 3ab6b27e33..72c914e9ad 100644 --- a/spring-boot/src/main/java/org/springframework/boot/cloudfoundry/VcapApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/cloudfoundry/VcapApplicationListener.java @@ -87,8 +87,8 @@ import org.springframework.util.StringUtils; * * @author Dave Syer */ -public class VcapApplicationListener implements - ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { +public class VcapApplicationListener + implements ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { private static final Log logger = LogFactory.getLog(VcapApplicationListener.class); @@ -144,8 +144,8 @@ public class VcapApplicationListener implements private Properties getPropertiesFromApplication(Environment environment) { Properties properties = new Properties(); try { - Map<String, Object> map = this.parser.parseMap(environment.getProperty( - VCAP_APPLICATION, "{}")); + Map<String, Object> map = this.parser + .parseMap(environment.getProperty(VCAP_APPLICATION, "{}")); extractPropertiesFromApplication(properties, map); } catch (Exception ex) { @@ -157,8 +157,8 @@ public class VcapApplicationListener implements private Properties getPropertiesFromServices(Environment environment) { Properties properties = new Properties(); try { - Map<String, Object> map = this.parser.parseMap(environment.getProperty( - VCAP_SERVICES, "{}")); + Map<String, Object> map = this.parser + .parseMap(environment.getProperty(VCAP_SERVICES, "{}")); extractPropertiesFromServices(properties, map); } catch (Exception ex) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java index cf121ca72c..6bde13a4bb 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java @@ -42,16 +42,16 @@ import org.springframework.util.StringUtils; * @author Phillip Webb * @since 1.2.0 */ -public class ConfigurationWarningsApplicationContextInitializer implements - ApplicationContextInitializer<ConfigurableApplicationContext> { +public class ConfigurationWarningsApplicationContextInitializer + implements ApplicationContextInitializer<ConfigurableApplicationContext> { private static Log logger = LogFactory .getLog(ConfigurationWarningsApplicationContextInitializer.class); @Override public void initialize(ConfigurableApplicationContext context) { - context.addBeanFactoryPostProcessor(new ConfigurationWarningsPostProcessor( - getChecks())); + context.addBeanFactoryPostProcessor( + new ConfigurationWarningsPostProcessor(getChecks())); } /** @@ -65,8 +65,8 @@ public class ConfigurationWarningsApplicationContextInitializer implements /** * {@link BeanDefinitionRegistryPostProcessor} to report warnings. */ - protected final static class ConfigurationWarningsPostProcessor implements - PriorityOrdered, BeanDefinitionRegistryPostProcessor { + protected final static class ConfigurationWarningsPostProcessor + implements PriorityOrdered, BeanDefinitionRegistryPostProcessor { private Check[] checks; @@ -132,7 +132,8 @@ public class ConfigurationWarningsApplicationContextInitializer implements return null; } - private boolean isComponentScanningDefaultPackage(BeanDefinitionRegistry registry) { + private boolean isComponentScanningDefaultPackage( + BeanDefinitionRegistry registry) { String[] names = registry.getBeanDefinitionNames(); for (String name : names) { BeanDefinition definition = registry.getBeanDefinition(name); 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 319d990499..8e2a66da58 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 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/FileEncodingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java index 1f35462b56..08b084a681 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java @@ -42,8 +42,8 @@ import org.springframework.core.Ordered; * * @author Dave Syer */ -public class FileEncodingApplicationListener implements - ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { +public class FileEncodingApplicationListener + implements ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { private static Log logger = LogFactory.getLog(FileEncodingApplicationListener.class); @@ -71,7 +71,8 @@ public class FileEncodingApplicationListener implements + desired + "'."); throw new IllegalStateException( "The Java Virtual Machine has not been configured to use the " - + "desired default character encoding (" + desired + ")."); + + "desired default character encoding (" + desired + + ")."); } } } 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 be7ede154c..2a72801ddf 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 @@ -31,8 +31,8 @@ import org.springframework.core.Ordered; * @author Raphael von der Grün * @since 1.2.0 */ -public class AnsiOutputApplicationListener implements - ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { +public class AnsiOutputApplicationListener + implements ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { @Override public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index c655c1015e..48f2a2f9ba 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -89,8 +89,8 @@ import org.springframework.validation.BindException; * @author Dave Syer * @author Phillip Webb */ -public class ConfigFileApplicationListener implements - ApplicationListener<ApplicationEvent>, Ordered { +public class ConfigFileApplicationListener + implements ApplicationListener<ApplicationEvent>, Ordered { private static Log logger = LogFactory.getLog(ConfigFileApplicationListener.class); @@ -124,7 +124,8 @@ public class ConfigFileApplicationListener implements @Override public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ApplicationEnvironmentPreparedEvent) { - onApplicationEnvironmentPreparedEvent((ApplicationEnvironmentPreparedEvent) event); + onApplicationEnvironmentPreparedEvent( + (ApplicationEnvironmentPreparedEvent) event); } if (event instanceof ApplicationPreparedEvent) { onApplicationPreparedEvent((ApplicationPreparedEvent) event); @@ -204,8 +205,8 @@ public class ConfigFileApplicationListener implements * @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) { @@ -245,12 +246,13 @@ public class ConfigFileApplicationListener implements * {@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; - public PropertySourceOrderingPostProcessor(ConfigurableApplicationContext context) { + public PropertySourceOrderingPostProcessor( + ConfigurableApplicationContext context) { this.context = context; } @@ -266,8 +268,8 @@ public class ConfigFileApplicationListener implements } private void reorderSources(ConfigurableEnvironment environment) { - ConfigurationPropertySources.finishAndRelocate(environment - .getPropertySources()); + ConfigurationPropertySources + .finishAndRelocate(environment.getPropertySources()); PropertySource<?> defaultProperties = environment.getPropertySources() .remove(DEFAULT_PROPERTIES); if (defaultProperties != null) { @@ -294,7 +296,8 @@ public class ConfigFileApplicationListener implements private final List<Object> debug = ConfigFileApplicationListener.this.debug; - public Loader(ConfigurableEnvironment environment, ResourceLoader resourceLoader) { + public Loader(ConfigurableEnvironment environment, + ResourceLoader resourceLoader) { this.environment = environment; this.resourceLoader = resourceLoader == null ? new DefaultResourceLoader() : resourceLoader; @@ -307,15 +310,15 @@ public class ConfigFileApplicationListener implements 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<String> list = new ArrayList<String>(Arrays.asList(this.environment - .getActiveProfiles())); + List<String> list = new ArrayList<String>( + 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); @@ -382,10 +385,10 @@ public class ConfigFileApplicationListener implements propertySource = this.propertiesLoader.load(resource, group, name, profile); if (propertySource != null) { - maybeActivateProfiles(propertySource - .getProperty(ACTIVE_PROFILES_PROPERTY)); - addIncludeProfiles(propertySource - .getProperty(INCLUDE_PROFILES_PROPERTY)); + maybeActivateProfiles( + propertySource.getProperty(ACTIVE_PROFILES_PROPERTY)); + addIncludeProfiles( + propertySource.getProperty(INCLUDE_PROFILES_PROPERTY)); } } StringBuilder msg = new StringBuilder(); @@ -464,9 +467,9 @@ public class ConfigFileApplicationListener implements locations.add(path); } } - locations.addAll(asResolvedSet( - ConfigFileApplicationListener.this.searchLocations, - DEFAULT_SEARCH_LOCATIONS)); + locations.addAll( + asResolvedSet(ConfigFileApplicationListener.this.searchLocations, + DEFAULT_SEARCH_LOCATIONS)); return locations; } @@ -479,9 +482,9 @@ public class ConfigFileApplicationListener implements } private Set<String> asResolvedSet(String value, String fallback) { - List<String> list = Arrays.asList(StringUtils - .commaDelimitedListToStringArray(value != null ? this.environment - .resolvePlaceholders(value) : fallback)); + List<String> list = Arrays + .asList(StringUtils.commaDelimitedListToStringArray(value != null + ? this.environment.resolvePlaceholders(value) : fallback)); Collections.reverse(list); return new LinkedHashSet<String>(list); } @@ -492,8 +495,8 @@ public class ConfigFileApplicationListener implements 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)); } } @@ -502,8 +505,8 @@ public class ConfigFileApplicationListener implements * Holds the configuration {@link PropertySource}s as they are loaded can relocate * them once configuration classes have been processed. */ - static class ConfigurationPropertySources extends - EnumerablePropertySource<Collection<PropertySource<?>>> { + static class ConfigurationPropertySources + extends EnumerablePropertySource<Collection<PropertySource<?>>> { private static final String NAME = "applicationConfigurationProperties"; @@ -517,8 +520,8 @@ public class ConfigFileApplicationListener implements List<String> names = new ArrayList<String>(); 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/config/DelegatingApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java index dc2caa5472..8047bca8e9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java @@ -91,16 +91,18 @@ public class DelegatingApplicationContextInitializer implements applyInitializers(context, initializers); } - private ApplicationContextInitializer<?> instantiateInitializer( - Class<?> contextClass, Class<?> initializerClass) { + private ApplicationContextInitializer<?> instantiateInitializer(Class<?> contextClass, + Class<?> initializerClass) { Class<?> requireContextClass = GenericTypeResolver.resolveTypeArgument( initializerClass, ApplicationContextInitializer.class); - Assert.isAssignable(requireContextClass, contextClass, String.format( - "Could not add context initializer [%s]" - + " as its generic parameter [%s] is not assignable " - + "from the type of application context used by this " - + "context loader [%s]: ", initializerClass.getName(), - requireContextClass.getName(), contextClass.getName())); + Assert.isAssignable(requireContextClass, contextClass, + String.format( + "Could not add context initializer [%s]" + + " as its generic parameter [%s] is not assignable " + + "from the type of application context used by this " + + "context loader [%s]: ", + initializerClass.getName(), requireContextClass.getName(), + contextClass.getName())); return (ApplicationContextInitializer<?>) BeanUtils .instantiateClass(initializerClass); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java index 531f0ba81c..b218d84068 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java @@ -39,8 +39,8 @@ import org.springframework.util.StringUtils; * @author Dave Syer * @author Phillip Webb */ -public class DelegatingApplicationListener implements - ApplicationListener<ApplicationEvent>, Ordered { +public class DelegatingApplicationListener + implements ApplicationListener<ApplicationEvent>, Ordered { // NOTE: Similar to org.springframework.web.context.ContextLoader @@ -53,8 +53,8 @@ public class DelegatingApplicationListener implements @Override public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ApplicationEnvironmentPreparedEvent) { - List<ApplicationListener<ApplicationEvent>> delegates = getListeners(((ApplicationEnvironmentPreparedEvent) event) - .getEnvironment()); + List<ApplicationListener<ApplicationEvent>> delegates = getListeners( + ((ApplicationEnvironmentPreparedEvent) event).getEnvironment()); if (delegates.isEmpty()) { return; } 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 22f4fc4a2d..64c9da6384 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 @@ -34,8 +34,8 @@ import org.springframework.util.Assert; * @author Dave Syer * @see AbstractEmbeddedServletContainerFactory */ -public abstract class AbstractConfigurableEmbeddedServletContainer implements - ConfigurableEmbeddedServletContainer { +public abstract class AbstractConfigurableEmbeddedServletContainer + implements ConfigurableEmbeddedServletContainer { private static final int DEFAULT_SESSION_TIMEOUT = (int) TimeUnit.MINUTES .toSeconds(30); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java index ecfdfca5d1..8a51bdc4c1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java @@ -33,9 +33,9 @@ import org.apache.commons.logging.LogFactory; * @author Phillip Webb * @author Dave Syer */ -public abstract class AbstractEmbeddedServletContainerFactory extends - AbstractConfigurableEmbeddedServletContainer implements - EmbeddedServletContainerFactory { +public abstract class AbstractEmbeddedServletContainerFactory + extends AbstractConfigurableEmbeddedServletContainer + implements EmbeddedServletContainerFactory { protected final Log logger = LogFactory.getLog(getClass()); @@ -68,9 +68,9 @@ public abstract class AbstractEmbeddedServletContainerFactory extends // Or maybe there is a document root in a well-known location file = file != null ? file : getCommonDocumentRoot(); if (file == null && this.logger.isDebugEnabled()) { - this.logger.debug("None of the document roots " - + Arrays.asList(COMMON_DOC_ROOTS) - + " point to a directory and will be ignored."); + this.logger + .debug("None of the document roots " + Arrays.asList(COMMON_DOC_ROOTS) + + " point to a directory and will be ignored."); } else if (this.logger.isDebugEnabled()) { this.logger.debug("Document root: " + file); @@ -83,7 +83,8 @@ public abstract class AbstractEmbeddedServletContainerFactory extends if (this.logger.isDebugEnabled()) { this.logger.debug("Code archive: " + file); } - if (file != null && file.exists() && file.getAbsolutePath().contains("/WEB-INF/")) { + if (file != null && file.exists() + && file.getAbsolutePath().contains("/WEB-INF/")) { String path = file.getAbsolutePath(); path = path.substring(0, path.indexOf("/WEB-INF/")); return new File(path); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java index 9f465b9b04..cae1c11633 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java @@ -47,8 +47,8 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon * @see EmbeddedWebApplicationContext * @see AnnotationConfigWebApplicationContext */ -public class AnnotationConfigEmbeddedWebApplicationContext extends - EmbeddedWebApplicationContext { +public class AnnotationConfigEmbeddedWebApplicationContext + extends EmbeddedWebApplicationContext { private final AnnotatedBeanDefinitionReader reader; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java index 170c1dd1d5..cd68406a37 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java @@ -34,8 +34,8 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator; * @author Dave Syer * @author Phillip Webb */ -public class EmbeddedServletContainerCustomizerBeanPostProcessor implements - BeanPostProcessor, ApplicationContextAware { +public class EmbeddedServletContainerCustomizerBeanPostProcessor + implements BeanPostProcessor, ApplicationContextAware { private ApplicationContext applicationContext; @@ -62,7 +62,8 @@ public class EmbeddedServletContainerCustomizerBeanPostProcessor implements return bean; } - private void postProcessBeforeInitialization(ConfigurableEmbeddedServletContainer bean) { + private void postProcessBeforeInitialization( + ConfigurableEmbeddedServletContainer bean) { for (EmbeddedServletContainerCustomizer customizer : getCustomizers()) { customizer.customize(bean); } @@ -72,8 +73,9 @@ public class EmbeddedServletContainerCustomizerBeanPostProcessor implements if (this.customizers == null) { // Look up does not include the parent context this.customizers = new ArrayList<EmbeddedServletContainerCustomizer>( - this.applicationContext.getBeansOfType( - EmbeddedServletContainerCustomizer.class, false, false) + this.applicationContext + .getBeansOfType(EmbeddedServletContainerCustomizer.class, + false, false) .values()); Collections.sort(this.customizers, AnnotationAwareOrderComparator.INSTANCE); this.customizers = Collections.unmodifiableList(this.customizers); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java index 4e5f0b9292..02568a0140 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java @@ -106,9 +106,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext */ @Override protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { - beanFactory - .addBeanPostProcessor(new WebApplicationContextServletContextAwareProcessor( - this)); + beanFactory.addBeanPostProcessor( + new WebApplicationContextServletContextAwareProcessor(this)); beanFactory.ignoreDependencyInterface(ServletContextAware.class); } @@ -162,8 +161,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext getSelfInitializer().onStartup(getServletContext()); } catch (ServletException ex) { - throw new ApplicationContextException( - "Cannot initialize servlet context", ex); + throw new ApplicationContextException("Cannot initialize servlet context", + ex); } } initPropertySources(); @@ -177,8 +176,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext */ protected EmbeddedServletContainerFactory getEmbeddedServletContainerFactory() { // Use bean names so that we don't consider the hierarchy - String[] beanNames = getBeanFactory().getBeanNamesForType( - EmbeddedServletContainerFactory.class); + String[] beanNames = getBeanFactory() + .getBeanNamesForType(EmbeddedServletContainerFactory.class); if (beanNames.length == 0) { throw new ApplicationContextException( "Unable to start EmbeddedWebApplicationContext due to missing " @@ -242,8 +241,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext * @param servletContext the operational servlet context */ protected void prepareEmbeddedWebApplicationContext(ServletContext servletContext) { - Object rootContext = servletContext - .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); + Object rootContext = servletContext.getAttribute( + WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (rootContext != null) { if (rootContext == this) { throw new IllegalStateException( @@ -258,9 +257,10 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext servletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this); if (logger.isDebugEnabled()) { - logger.debug("Published root WebApplicationContext as ServletContext attribute with name [" - + WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE - + "]"); + logger.debug( + "Published root WebApplicationContext as ServletContext attribute with name [" + + WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE + + "]"); } setServletContext(servletContext); if (logger.isInfoEnabled()) { @@ -346,6 +346,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext public static class ExistingWebApplicationScopes { private static final Set<String> SCOPES; + static { Set<String> scopes = new LinkedHashSet<String>(); scopes.add(WebApplicationContext.SCOPE_REQUEST); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/FilterRegistrationBean.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/FilterRegistrationBean.java index a713ec8ef3..386424d698 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/FilterRegistrationBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/FilterRegistrationBean.java @@ -40,10 +40,10 @@ import org.springframework.util.Assert; * <p> * The {@link #setFilter(Filter) Filter} must be specified before calling * {@link #onStartup(ServletContext)}. Registrations can be associated with - * {@link #setUrlPatterns URL patterns} and/or servlets (either by - * {@link #setServletNames name} or via a {@link #setServletRegistrationBeans - * ServletRegistrationBean}s. When no URL pattern or servlets are specified the filter - * will be associated to '/*'. The filter name will be deduced if not specified. + * {@link #setUrlPatterns URL patterns} and/or servlets (either by {@link #setServletNames + * name} or via a {@link #setServletRegistrationBeans ServletRegistrationBean}s. When no + * URL pattern or servlets are specified the filter will be associated to '/*'. The filter + * name will be deduced if not specified. * * @author Phillip Webb * @see ServletContextInitializer @@ -57,8 +57,8 @@ public class FilterRegistrationBean extends RegistrationBean { DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST, DispatcherType.ASYNC); - static final EnumSet<DispatcherType> NON_ASYNC_DISPATCHER_TYPES = EnumSet.of( - DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST); + static final EnumSet<DispatcherType> NON_ASYNC_DISPATCHER_TYPES = EnumSet + .of(DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST); private static final String[] DEFAULT_URL_MAPPINGS = { "/*" }; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/InitParameterConfiguringServletContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/InitParameterConfiguringServletContextInitializer.java index 617384209a..6a0ce625b6 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/InitParameterConfiguringServletContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/InitParameterConfiguringServletContextInitializer.java @@ -30,8 +30,8 @@ import javax.servlet.ServletException; * @since 1.2.0 * @see ServletContext#setInitParameter(String, String) */ -public class InitParameterConfiguringServletContextInitializer implements - ServletContextInitializer { +public class InitParameterConfiguringServletContextInitializer + implements ServletContextInitializer { private final Map<String, String> parameters; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java index 93da4b5949..bd30748615 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java @@ -37,6 +37,7 @@ public final class MimeMappings implements Iterable<Mapping> { * Default mime mapping commonly used. */ public static final MimeMappings DEFAULT; + static { MimeMappings mappings = new MimeMappings(); mappings.add("abs", "audio/x-mpeg"); @@ -248,8 +249,9 @@ public final class MimeMappings implements Iterable<Mapping> { */ private MimeMappings(MimeMappings mappings, boolean mutable) { Assert.notNull(mappings, "Mappings must not be null"); - this.map = (mutable ? new LinkedHashMap<String, MimeMappings.Mapping>( - mappings.map) : Collections.unmodifiableMap(mappings.map)); + this.map = (mutable + ? new LinkedHashMap<String, MimeMappings.Mapping>(mappings.map) + : Collections.unmodifiableMap(mappings.map)); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletContextInitializerBeans.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletContextInitializerBeans.java index a9e1ffe785..063449523b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletContextInitializerBeans.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletContextInitializerBeans.java @@ -55,8 +55,8 @@ import org.springframework.util.MultiValueMap; * @author Dave Syer * @author Phillip Webb */ -class ServletContextInitializerBeans extends - AbstractCollection<ServletContextInitializer> { +class ServletContextInitializerBeans + extends AbstractCollection<ServletContextInitializer> { static final String DISPATCHER_SERVLET_NAME = "dispatcherServlet"; @@ -127,7 +127,8 @@ class ServletContextInitializerBeans extends } } - private String getResourceDescription(String beanName, ListableBeanFactory beanFactory) { + private String getResourceDescription(String beanName, + ListableBeanFactory beanFactory) { if (beanFactory instanceof BeanDefinitionRegistry) { BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; return registry.getBeanDefinition(beanName).getResourceDescription(); @@ -142,7 +143,8 @@ class ServletContextInitializerBeans extends new ServletRegistrationBeanAdapter(multipartConfig)); addAsRegistrationBean(beanFactory, Filter.class, new FilterRegistrationBeanAdapter()); - for (Class<?> listenerType : ServletListenerRegistrationBean.getSupportedTypes()) { + for (Class<?> listenerType : ServletListenerRegistrationBean + .getSupportedTypes()) { addAsRegistrationBean(beanFactory, EventListener.class, (Class<EventListener>) listenerType, new ServletListenerRegistrationBeanAdapter()); @@ -155,8 +157,8 @@ class ServletContextInitializerBeans extends return (beans.isEmpty() ? null : beans.get(0).getValue()); } - private <T> void addAsRegistrationBean(ListableBeanFactory beanFactory, - Class<T> type, RegistrationBeanAdapter<T> adapter) { + private <T> void addAsRegistrationBean(ListableBeanFactory beanFactory, Class<T> type, + RegistrationBeanAdapter<T> adapter) { addAsRegistrationBean(beanFactory, type, type, adapter); } @@ -175,10 +177,10 @@ class ServletContextInitializerBeans extends this.initializers.add(type, registration); if (this.log.isDebugEnabled()) { - this.log.debug("Created " + type.getSimpleName() - + " initializer for bean '" + beanName + "'; order=" + order - + ", resource=" - + getResourceDescription(beanName, beanFactory)); + this.log.debug( + "Created " + type.getSimpleName() + " initializer for bean '" + + beanName + "'; order=" + order + ", resource=" + + getResourceDescription(beanName, beanFactory)); } } } @@ -237,8 +239,8 @@ class ServletContextInitializerBeans extends /** * {@link RegistrationBeanAdapter} for {@link Servlet} beans. */ - private static class ServletRegistrationBeanAdapter implements - RegistrationBeanAdapter<Servlet> { + private static class ServletRegistrationBeanAdapter + implements RegistrationBeanAdapter<Servlet> { private final MultipartConfigElement multipartConfig; @@ -263,8 +265,8 @@ class ServletContextInitializerBeans extends /** * {@link RegistrationBeanAdapter} for {@link Filter} beans. */ - private static class FilterRegistrationBeanAdapter implements - RegistrationBeanAdapter<Filter> { + private static class FilterRegistrationBeanAdapter + implements RegistrationBeanAdapter<Filter> { @Override public RegistrationBean createRegistrationBean(String name, Filter source, @@ -277,8 +279,8 @@ class ServletContextInitializerBeans extends /** * {@link RegistrationBeanAdapter} for certain {@link EventListener} beans. */ - private static class ServletListenerRegistrationBeanAdapter implements - RegistrationBeanAdapter<EventListener> { + private static class ServletListenerRegistrationBeanAdapter + implements RegistrationBeanAdapter<EventListener> { @Override public RegistrationBean createRegistrationBean(String name, EventListener source, diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java index b0f31731e3..e86d4bb4e7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java @@ -54,12 +54,13 @@ import org.springframework.util.ClassUtils; * @author Phillip Webb * @param <T> the type of listener */ -public class ServletListenerRegistrationBean<T extends EventListener> extends - RegistrationBean { +public class ServletListenerRegistrationBean<T extends EventListener> + extends RegistrationBean { private static Log logger = LogFactory.getLog(ServletListenerRegistrationBean.class); private static final Set<Class<?>> SUPPORTED_TYPES; + static { Set<Class<?>> types = new HashSet<Class<?>>(); types.add(ServletContextAttributeListener.class); @@ -109,8 +110,9 @@ public class ServletListenerRegistrationBean<T extends EventListener> extends servletContext.addListener(this.listener); } catch (RuntimeException ex) { - throw new IllegalStateException("Failed to add listener '" + this.listener - + "' to servlet context", ex); + throw new IllegalStateException( + "Failed to add listener '" + this.listener + "' to servlet context", + ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/WebApplicationContextServletContextAwareProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/WebApplicationContextServletContextAwareProcessor.java index 9c9c453fb8..c3d2608e5b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/WebApplicationContextServletContextAwareProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/WebApplicationContextServletContextAwareProcessor.java @@ -31,8 +31,8 @@ import org.springframework.web.context.support.ServletContextAwareProcessor; * * @author Phillip Webb */ -public class WebApplicationContextServletContextAwareProcessor extends - ServletContextAwareProcessor { +public class WebApplicationContextServletContextAwareProcessor + extends ServletContextAwareProcessor { private final ConfigurableWebApplicationContext webApplicationContext; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java index 7643b3b5a8..dcdd5fc189 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java @@ -113,8 +113,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { for (Connector connector : connectors) { connector.start(); } - JettyEmbeddedServletContainer.logger.info("Jetty started on port(s) " - + getActualPortsDescription()); + JettyEmbeddedServletContainer.logger + .info("Jetty started on port(s) " + getActualPortsDescription()); } catch (Exception ex) { throw new EmbeddedServletContainerException( @@ -139,8 +139,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { connector); } catch (Exception ex) { - JettyEmbeddedServletContainer.logger.info("could not determine port ( " - + ex.getMessage() + ")"); + JettyEmbeddedServletContainer.logger + .info("could not determine port ( " + ex.getMessage() + ")"); return 0; } } 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 4aa6ebc2e5..c26cd994ee 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 @@ -78,8 +78,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 List<Configuration> configurations = new ArrayList<Configuration>(); @@ -125,8 +125,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()) { @@ -136,7 +136,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(); @@ -184,8 +185,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()); @@ -235,9 +236,8 @@ public class JettyEmbeddedServletContainerFactory extends if (isRegisterDefaultServlet()) { addDefaultServlet(context); } - if (isRegisterJspServlet() - && ClassUtils.isPresent(getJspServletClassName(), getClass() - .getClassLoader())) { + if (isRegisterJspServlet() && ClassUtils.isPresent(getJspServletClassName(), + getClass().getClassLoader())) { addJspServlet(context); } ServletContextInitializer[] initializersToUse = mergeInitializers(initializers); @@ -260,12 +260,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) { @@ -316,8 +317,8 @@ public class JettyEmbeddedServletContainerFactory extends protected Configuration[] getWebAppContextConfigurations(WebAppContext webAppContext, ServletContextInitializer... initializers) { List<Configuration> configurations = new ArrayList<Configuration>(); - configurations.add(getServletContextInitializerConfiguration(webAppContext, - initializers)); + configurations.add( + getServletContextInitializerConfiguration(webAppContext, initializers)); configurations.addAll(getConfigurations()); configurations.add(getErrorPageConfiguration()); configurations.add(getMimeTypeConfiguration()); @@ -385,7 +386,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); } @@ -482,16 +484,16 @@ public class JettyEmbeddedServletContainerFactory extends */ private static 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, @@ -511,8 +513,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, @@ -521,10 +523,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) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java index 8eed21fe8b..b383b77a59 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java @@ -65,9 +65,9 @@ class SkipPatternJarScanner extends StandardJarScanner { // For Tomcat 7 compatibility public void scan(ServletContext context, ClassLoader classloader, JarScannerCallback callback, Set<String> jarsToSkip) { - Method scanMethod = ReflectionUtils.findMethod(this.jarScanner.getClass(), - "scan", ServletContext.class, ClassLoader.class, - JarScannerCallback.class, Set.class); + Method scanMethod = ReflectionUtils.findMethod(this.jarScanner.getClass(), "scan", + ServletContext.class, ClassLoader.class, JarScannerCallback.class, + Set.class); Assert.notNull(scanMethod, "Unable to find scan method"); try { scanMethod.invoke(this.jarScanner, context, classloader, callback, @@ -84,8 +84,8 @@ class SkipPatternJarScanner extends StandardJarScanner { * @param pattern the jar skip pattern or {@code null} for defaults */ public static void apply(TomcatEmbeddedContext context, String pattern) { - SkipPatternJarScanner scanner = new SkipPatternJarScanner( - context.getJarScanner(), pattern); + SkipPatternJarScanner scanner = new SkipPatternJarScanner(context.getJarScanner(), + pattern); context.setJarScanner(scanner); } 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 f09261c7ab..30a81e33f7 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; public 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/TomcatEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java index 5807d3a554..dc4e757bc7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java @@ -76,8 +76,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer } private synchronized void initialize() throws EmbeddedServletContainerException { - TomcatEmbeddedServletContainer.logger.info("Tomcat initialized with port(s): " - + getPortsDescription(false)); + TomcatEmbeddedServletContainer.logger + .info("Tomcat initialized with port(s): " + getPortsDescription(false)); try { addInstanceIdToEngineName(); @@ -95,8 +95,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer startDaemonAwaitThread(); } catch (Exception ex) { - throw new EmbeddedServletContainerException( - "Unable to start embedded Tomcat", ex); + throw new EmbeddedServletContainerException("Unable to start embedded Tomcat", + ex); } } @@ -156,8 +156,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer stopSilently(); throw new IllegalStateException("Tomcat connector in failed state"); } - TomcatEmbeddedServletContainer.logger.info("Tomcat started on port(s): " - + getPortsDescription(true)); + TomcatEmbeddedServletContainer.logger + .info("Tomcat started on port(s): " + getPortsDescription(true)); } private boolean connectorsHaveFailedToStart() { 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 6dfa8838be..329e5a6fbc 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 @@ -82,8 +82,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 Set<Class<?>> NO_CLASSES = Collections.emptySet(); @@ -163,8 +163,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()); @@ -173,9 +174,8 @@ public class TomcatEmbeddedServletContainerFactory extends if (isRegisterDefaultServlet()) { addDefaultServlet(context); } - if (isRegisterJspServlet() - && ClassUtils.isPresent(getJspServletClassName(), getClass() - .getClassLoader())) { + if (isRegisterJspServlet() && ClassUtils.isPresent(getJspServletClassName(), + getClass().getClassLoader())) { addJspServlet(context); addJasperInitializer(context); context.addLifecycleListener(new StoreMergedWebXmlListener()); @@ -289,8 +289,8 @@ public class TomcatEmbeddedServletContainerFactory extends protocol.setKeystoreFile(file.getAbsolutePath()); } catch (FileNotFoundException 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) { protocol.setKeystoreType(ssl.getKeyStoreType()); @@ -307,8 +307,8 @@ public class TomcatEmbeddedServletContainerFactory extends protocol.setTruststoreFile(file.getAbsolutePath()); } catch (FileNotFoundException ex) { - throw new EmbeddedServletContainerException("Could not find trust store " - + ssl.getTrustStore(), ex); + throw new EmbeddedServletContainerException( + "Could not find trust store " + ssl.getTrustStore(), ex); } } protocol.setTruststorePass(ssl.getTrustStorePassword()); @@ -389,7 +389,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); } } @@ -514,7 +515,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)); @@ -615,8 +617,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/tomcat/TomcatEmbeddedWebappClassLoader.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java index 20ae60b630..f96337d63a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java @@ -116,8 +116,8 @@ public class TomcatEmbeddedWebappClassLoader extends WebappClassLoader { private void checkPackageAccess(String name) throws ClassNotFoundException { if (this.securityManager != null && name.lastIndexOf('.') >= 0) { try { - this.securityManager.checkPackageAccess(name.substring(0, - name.lastIndexOf('.'))); + this.securityManager + .checkPackageAccess(name.substring(0, name.lastIndexOf('.'))); } catch (SecurityException ex) { throw new ClassNotFoundException("Security Violation, attempt to use " diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java index 0c7fe8aa75..56794f1689 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java @@ -142,8 +142,8 @@ abstract class TomcatResources { try { Class<?> fileDirContextClass = Class .forName("org.apache.naming.resources.FileDirContext"); - Method setDocBaseMethod = ReflectionUtils.findMethod( - fileDirContextClass, "setDocBase", String.class); + Method setDocBaseMethod = ReflectionUtils + .findMethod(fileDirContextClass, "setDocBase", String.class); Object fileDirContext = fileDirContextClass.newInstance(); setDocBaseMethod.invoke(fileDirContext, dir); Method addResourcesDirContextMethod = ReflectionUtils.findMethod( 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 fad7032375..f4adc1c891 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 @@ -81,8 +81,8 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine } this.undertow.start(); this.started = true; - UndertowEmbeddedServletContainer.logger.info("Undertow started on port(s) " - + getPortsDescription()); + UndertowEmbeddedServletContainer.logger + .info("Undertow started on port(s) " + getPortsDescription()); } private Undertow createUndertowServer() { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java index adb81d2f19..3683c59649 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java @@ -84,8 +84,8 @@ import io.undertow.servlet.util.ImmediateInstanceFactory; * @since 1.2.0 * @see UndertowEmbeddedServletContainer */ -public class UndertowEmbeddedServletContainerFactory extends - AbstractEmbeddedServletContainerFactory implements ResourceLoaderAware { +public class UndertowEmbeddedServletContainerFactory + extends AbstractEmbeddedServletContainerFactory implements ResourceLoaderAware { private static final Set<Class<?>> NO_CLASSES = Collections.emptySet(); @@ -283,8 +283,9 @@ public class UndertowEmbeddedServletContainerFactory extends // Get key manager to provide client credentials. KeyManagerFactory keyManagerFactory = KeyManagerFactory .getInstance(KeyManagerFactory.getDefaultAlgorithm()); - char[] keyPassword = ssl.getKeyPassword() != null ? ssl.getKeyPassword() - .toCharArray() : ssl.getKeyStorePassword().toCharArray(); + char[] keyPassword = ssl.getKeyPassword() != null + ? ssl.getKeyPassword().toCharArray() + : ssl.getKeyStorePassword().toCharArray(); keyManagerFactory.init(keyStore, keyPassword); return keyManagerFactory.getKeyManagers(); } @@ -306,8 +307,8 @@ public class UndertowEmbeddedServletContainerFactory extends } KeyStore trustedKeyStore = KeyStore.getInstance(trustStoreType); URL url = ResourceUtils.getURL(trustStore); - trustedKeyStore.load(url.openStream(), ssl.getTrustStorePassword() - .toCharArray()); + trustedKeyStore.load(url.openStream(), + ssl.getTrustStorePassword().toCharArray()); TrustManagerFactory trustManagerFactory = TrustManagerFactory .getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(trustedKeyStore); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java index 4566ce57db..736c216f02 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java @@ -68,7 +68,8 @@ public class ConfigurationBeanFactoryMetaData implements BeanFactoryPostProcesso return result; } - public <A extends Annotation> A findFactoryAnnotation(String beanName, Class<A> type) { + public <A extends Annotation> A findFactoryAnnotation(String beanName, + Class<A> type) { Method method = findFactoryMethod(beanName); return (method == null ? null : AnnotationUtils.findAnnotation(method, type)); } @@ -83,8 +84,8 @@ public class ConfigurationBeanFactoryMetaData implements BeanFactoryPostProcesso Class<?> type = this.beanFactory.getType(meta.getBean()); ReflectionUtils.doWithMethods(type, new MethodCallback() { @Override - public void doWith(Method method) throws IllegalArgumentException, - IllegalAccessException { + public void doWith(Method method) + throws IllegalArgumentException, IllegalAccessException { if (method.getName().equals(factory)) { found.compareAndSet(null, method); } 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 5c9a2a2bc5..0d26c20cc7 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 @@ -245,8 +245,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); } @@ -266,13 +266,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<Object> factory = new PropertiesConfigurationFactory<Object>( 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); @@ -280,15 +280,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); } @@ -311,19 +311,18 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc return ""; } StringBuilder details = new StringBuilder(); - details.append("target=").append( - (StringUtils.hasLength(annotation.value()) ? annotation.value() - : annotation.prefix())); + details.append("target=").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; @@ -338,8 +337,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/ConfigurationPropertiesBindingPostProcessorRegistrar.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java index e3a6cef92c..5d67e9b304 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java @@ -28,8 +28,8 @@ import org.springframework.core.type.AnnotationMetadata; * @author Dave Syer * @author Phillip Webb */ -public class ConfigurationPropertiesBindingPostProcessorRegistrar implements - ImportBeanDefinitionRegistrar { +public class ConfigurationPropertiesBindingPostProcessorRegistrar + implements ImportBeanDefinitionRegistrar { public static final String BINDER_BEAN_NAME = ConfigurationPropertiesBindingPostProcessor.class .getName(); @@ -42,8 +42,8 @@ public class ConfigurationPropertiesBindingPostProcessorRegistrar implements if (!registry.containsBeanDefinition(BINDER_BEAN_NAME)) { BeanDefinitionBuilder meta = BeanDefinitionBuilder .genericBeanDefinition(ConfigurationBeanFactoryMetaData.class); - BeanDefinitionBuilder bean = BeanDefinitionBuilder - .genericBeanDefinition(ConfigurationPropertiesBindingPostProcessor.class); + BeanDefinitionBuilder bean = BeanDefinitionBuilder.genericBeanDefinition( + ConfigurationPropertiesBindingPostProcessor.class); bean.addPropertyReference("beanMetaDataStore", METADATA_BEAN_NAME); registry.registerBeanDefinition(BINDER_BEAN_NAME, bean.getBeanDefinition()); registry.registerBeanDefinition(METADATA_BEAN_NAME, meta.getBeanDefinition()); 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 bdece5b171..5eab2112f5 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,18 +48,19 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { public String[] selectImports(AnnotationMetadata metadata) { MultiValueMap<String, Object> 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() }; } - public static class ConfigurationPropertiesBeanRegistrar implements - ImportBeanDefinitionRegistrar { + public static class ConfigurationPropertiesBeanRegistrar + implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata metadata, @@ -70,8 +71,8 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { List<Class<?>> 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); } @@ -114,11 +115,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/ErrorPageFilter.java b/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java index 2c247507c6..d50bd780c1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java @@ -86,8 +86,8 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine @Override protected void doFilterInternal(HttpServletRequest request, - HttpServletResponse response, FilterChain chain) throws ServletException, - IOException { + HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { ErrorPageFilter.this.doFilter(request, response, chain); } @@ -135,7 +135,7 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine private void handleErrorStatus(HttpServletRequest request, HttpServletResponse response, int status, String message) - throws ServletException, IOException { + throws ServletException, IOException { if (response.isCommitted()) { handleCommittedResponse(request, null); return; @@ -150,9 +150,9 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine request.getRequestDispatcher(errorPath).forward(request, response); } - private void handleException(HttpServletRequest request, - HttpServletResponse response, ErrorWrapperResponse wrapped, Throwable ex) - throws IOException, ServletException { + private void handleException(HttpServletRequest request, HttpServletResponse response, + ErrorWrapperResponse wrapped, Throwable ex) + throws IOException, ServletException { Class<?> type = ex.getClass(); String errorPath = getErrorPath(type); if (errorPath == null) { @@ -168,8 +168,8 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine } private void forwardToErrorPage(String path, HttpServletRequest request, - HttpServletResponse response, Throwable ex) throws ServletException, - IOException { + HttpServletResponse response, Throwable ex) + throws ServletException, IOException { if (logger.isErrorEnabled()) { String message = "Forwarding to error page from request " + getDescription(request) + " due to exception [" + ex.getMessage() @@ -231,7 +231,8 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine return this.global; } - private void setErrorAttributes(HttpServletRequest request, int status, String message) { + private void setErrorAttributes(HttpServletRequest request, int status, + String message) { request.setAttribute(ERROR_STATUS_CODE, status); request.setAttribute(ERROR_MESSAGE, message); request.setAttribute(ERROR_REQUEST_URI, request.getRequestURI()); @@ -310,8 +311,8 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine @Override public void flushBuffer() throws IOException { if (this.hasErrorToSend && !isCommitted()) { - ((HttpServletResponse) getResponse()) - .sendError(this.status, this.message); + ((HttpServletResponse) getResponse()).sendError(this.status, + this.message); } super.flushBuffer(); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedCharacterEncodingFilter.java b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedCharacterEncodingFilter.java index a328134302..a220e8846e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedCharacterEncodingFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/OrderedCharacterEncodingFilter.java @@ -25,8 +25,8 @@ import org.springframework.web.filter.CharacterEncodingFilter; * @author Phillip Webb * @since 1.2.1 */ -public class OrderedCharacterEncodingFilter extends CharacterEncodingFilter implements - Ordered { +public class OrderedCharacterEncodingFilter extends CharacterEncodingFilter + implements Ordered { private int order = Ordered.HIGHEST_PRECEDENCE; 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 550ea1e748..bb9ffe125e 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 @@ -25,8 +25,8 @@ import org.springframework.web.filter.HiddenHttpMethodFilter; * @author Phillip Webb * @since 1.2.4 */ -public class OrderedHiddenHttpMethodFilter extends HiddenHttpMethodFilter implements - Ordered { +public class OrderedHiddenHttpMethodFilter extends HiddenHttpMethodFilter + implements Ordered { /** * The default order is high to ensure the filter is applied before Spring Security. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java index f30897780e..8c25ddbcf5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java @@ -78,7 +78,8 @@ public abstract class SpringBootServletInitializer implements WebApplicationInit @Override public void onStartup(ServletContext servletContext) throws ServletException { - WebApplicationContext rootAppContext = createRootApplicationContext(servletContext); + WebApplicationContext rootAppContext = createRootApplicationContext( + servletContext); if (rootAppContext != null) { servletContext.addListener(new ContextLoaderListener(rootAppContext) { @Override @@ -105,13 +106,13 @@ public abstract class SpringBootServletInitializer implements WebApplicationInit WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, null); builder.initializers(new ParentContextApplicationContextInitializer(parent)); } - builder.initializers(new ServletContextApplicationContextInitializer( - servletContext)); + builder.initializers( + new ServletContextApplicationContextInitializer(servletContext)); builder.contextClass(AnnotationConfigEmbeddedWebApplicationContext.class); builder = configure(builder); SpringApplication application = builder.build(); - if (application.getSources().isEmpty() - && AnnotationUtils.findAnnotation(getClass(), Configuration.class) != null) { + if (application.getSources().isEmpty() && AnnotationUtils + .findAnnotation(getClass(), Configuration.class) != null) { application.getSources().add(getClass()); } Assert.state(application.getSources().size() > 0, @@ -135,8 +136,8 @@ public abstract class SpringBootServletInitializer implements WebApplicationInit private ApplicationContext getExistingRootWebApplicationContext( ServletContext servletContext) { - Object context = servletContext - .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); + Object context = servletContext.getAttribute( + WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (context instanceof ApplicationContext) { return (ApplicationContext) context; } diff --git a/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java b/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java index e899ba5929..96e629f8bf 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java @@ -34,8 +34,8 @@ import org.springframework.core.env.PropertySource; * * @author Dave Syer */ -public class EnumerableCompositePropertySource extends - EnumerablePropertySource<Collection<PropertySource<?>>> { +public class EnumerableCompositePropertySource + extends EnumerablePropertySource<Collection<PropertySource<?>>> { private volatile String[] names; @@ -59,10 +59,11 @@ public class EnumerableCompositePropertySource extends String[] result = this.names; if (result == null) { List<String> names = new ArrayList<String>(); - for (PropertySource<?> source : new ArrayList<PropertySource<?>>(getSource())) { + for (PropertySource<?> source : new ArrayList<PropertySource<?>>( + getSource())) { if (source instanceof EnumerablePropertySource) { - names.addAll(Arrays.asList(((EnumerablePropertySource<?>) source) - .getPropertyNames())); + names.addAll(Arrays.asList( + ((EnumerablePropertySource<?>) source).getPropertyNames())); } } this.names = names.toArray(new String[0]); diff --git a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java index 0de36c6685..f3d51484e2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java @@ -134,10 +134,8 @@ public class PropertySourcesLoader { } private boolean isFile(Resource resource) { - return resource != null - && resource.exists() - && StringUtils.hasText(StringUtils.getFilenameExtension(resource - .getFilename())); + return resource != null && resource.exists() && StringUtils + .hasText(StringUtils.getFilenameExtension(resource.getFilename())); } private String generatePropertySourceName(String name, String profile) { diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBean.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBean.java index fb2115cb2d..293e3ec0d1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBean.java @@ -31,9 +31,9 @@ import org.springframework.util.StringUtils; */ @SuppressWarnings("serial") @ConfigurationProperties(prefix = "spring.jta.atomikos.connectionfactory") -public class AtomikosConnectionFactoryBean extends - com.atomikos.jms.AtomikosConnectionFactoryBean implements BeanNameAware, - InitializingBean, DisposableBean { +public class AtomikosConnectionFactoryBean + extends com.atomikos.jms.AtomikosConnectionFactoryBean + implements BeanNameAware, InitializingBean, DisposableBean { private String beanName; diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java index f96c3309cc..a7ebd0f3f4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java @@ -32,15 +32,15 @@ import com.atomikos.icatch.jta.UserTransactionManager; /** * {@link BeanFactoryPostProcessor} to automatically setup the recommended - * {@link BeanDefinition#setDependsOn(String[]) dependsOn} settings for <a - * href="http://www.atomikos.com/Documentation/SpringIntegration">correct Atomikos + * {@link BeanDefinition#setDependsOn(String[]) dependsOn} settings for + * <a href="http://www.atomikos.com/Documentation/SpringIntegration">correct Atomikos * ordering</a>. * * @author Phillip Webb * @since 1.2.0 */ -public class AtomikosDependsOnBeanFactoryPostProcessor implements - BeanFactoryPostProcessor, Ordered { +public class AtomikosDependsOnBeanFactoryPostProcessor + implements BeanFactoryPostProcessor, Ordered { private static final String[] NO_BEANS = {}; @@ -49,8 +49,8 @@ public class AtomikosDependsOnBeanFactoryPostProcessor implements @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - String[] transactionManagers = beanFactory.getBeanNamesForType( - UserTransactionManager.class, true, false); + String[] transactionManagers = beanFactory + .getBeanNamesForType(UserTransactionManager.class, true, false); for (String transactionManager : transactionManagers) { addTransactionManagerDependencies(beanFactory, transactionManager); } @@ -75,14 +75,15 @@ public class AtomikosDependsOnBeanFactoryPostProcessor implements "com.atomikos.jms.extra.MessageDrivenContainer"); for (String messageDrivenContainer : messageDrivenContainers) { BeanDefinition bean = beanFactory.getBeanDefinition(messageDrivenContainer); - Set<String> dependsOn = new LinkedHashSet<String>(asList(bean.getDependsOn())); + Set<String> dependsOn = new LinkedHashSet<String>( + asList(bean.getDependsOn())); dependsOn.addAll(asList(transactionManagers)); bean.setDependsOn(dependsOn.toArray(new String[dependsOn.size()])); } } - private void addDependencies(ConfigurableListableBeanFactory beanFactory, - String type, Set<String> dependsOn) { + private void addDependencies(ConfigurableListableBeanFactory beanFactory, String type, + Set<String> dependsOn) { dependsOn.addAll(asList(getBeanNamesForType(beanFactory, type))); } diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java index 5222846035..f2197855be 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java @@ -21,8 +21,8 @@ import java.util.Properties; import java.util.TreeMap; /** - * Bean friendly variant of <a - * href="http://www.atomikos.com/Documentation/JtaProperties">Atomikos configuration + * Bean friendly variant of + * <a href="http://www.atomikos.com/Documentation/JtaProperties">Atomikos configuration * properties</a>. Allows for setter based configuration and is amiable to relaxed data * binding. * diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosXAConnectionFactoryWrapper.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosXAConnectionFactoryWrapper.java index c370bb945b..af5cae55c2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosXAConnectionFactoryWrapper.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosXAConnectionFactoryWrapper.java @@ -31,7 +31,8 @@ import org.springframework.boot.jta.XAConnectionFactoryWrapper; public class AtomikosXAConnectionFactoryWrapper implements XAConnectionFactoryWrapper { @Override - public ConnectionFactory wrapConnectionFactory(XAConnectionFactory connectionFactory) { + public ConnectionFactory wrapConnectionFactory( + XAConnectionFactory connectionFactory) { AtomikosConnectionFactoryBean bean = new AtomikosConnectionFactoryBean(); bean.setXaConnectionFactory(connectionFactory); return bean; diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java index 2ce3b8a229..d2b097e324 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java @@ -33,8 +33,8 @@ import org.springframework.core.Ordered; * @author Phillip Webb * @since 1.2.0 */ -public class BitronixDependentBeanFactoryPostProcessor implements - BeanFactoryPostProcessor, Ordered { +public class BitronixDependentBeanFactoryPostProcessor + implements BeanFactoryPostProcessor, Ordered { private static final String[] NO_BEANS = {}; @@ -43,8 +43,8 @@ public class BitronixDependentBeanFactoryPostProcessor implements @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - String[] transactionManagers = beanFactory.getBeanNamesForType( - TransactionManager.class, true, false); + String[] transactionManagers = beanFactory + .getBeanNamesForType(TransactionManager.class, true, false); for (String transactionManager : transactionManagers) { addTransactionManagerDependencies(beanFactory, transactionManager); } diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java index 6a539c9a0c..1811de0857 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java @@ -31,7 +31,8 @@ import org.springframework.boot.jta.XAConnectionFactoryWrapper; public class BitronixXAConnectionFactoryWrapper implements XAConnectionFactoryWrapper { @Override - public ConnectionFactory wrapConnectionFactory(XAConnectionFactory connectionFactory) { + public ConnectionFactory wrapConnectionFactory( + XAConnectionFactory connectionFactory) { PoolingConnectionFactoryBean pool = new PoolingConnectionFactoryBean(); pool.setConnectionFactory(connectionFactory); return pool; diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java index 2edd1a07bf..507ed77509 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java @@ -30,7 +30,8 @@ import org.springframework.boot.jta.XADataSourceWrapper; public class BitronixXADataSourceWrapper implements XADataSourceWrapper { @Override - public PoolingDataSourceBean wrapDataSource(XADataSource dataSource) throws Exception { + public PoolingDataSourceBean wrapDataSource(XADataSource dataSource) + throws Exception { PoolingDataSourceBean pool = new PoolingDataSourceBean(); pool.setDataSource(dataSource); return pool; diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java index 50f7a853f2..d377cb2f16 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java @@ -43,8 +43,8 @@ import bitronix.tm.resource.jms.PoolingConnectionFactory; */ @SuppressWarnings("serial") @ConfigurationProperties(prefix = "spring.jta.bitronix.connectionfactory") -public class PoolingConnectionFactoryBean extends PoolingConnectionFactory implements - BeanNameAware, InitializingBean, DisposableBean { +public class PoolingConnectionFactoryBean extends PoolingConnectionFactory + implements BeanNameAware, InitializingBean, DisposableBean { private static ThreadLocal<PoolingConnectionFactoryBean> source = new ThreadLocal<PoolingConnectionFactoryBean>(); diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java index 5ae82b4dc8..31a83784ce 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java @@ -46,8 +46,8 @@ import bitronix.tm.resource.jdbc.PoolingDataSource; */ @SuppressWarnings("serial") @ConfigurationProperties(prefix = "spring.jta.bitronix.datasource") -public class PoolingDataSourceBean extends PoolingDataSource implements BeanNameAware, - InitializingBean { +public class PoolingDataSourceBean extends PoolingDataSource + implements BeanNameAware, InitializingBean { private static ThreadLocal<PoolingDataSourceBean> source = new ThreadLocal<PoolingDataSourceBean>(); diff --git a/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java index 613bc1cf3d..c3c8f7db20 100644 --- a/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java @@ -32,8 +32,8 @@ import liquibase.servicelocator.ServiceLocator; * @author Phillip Webb * @author Dave Syer */ -public class LiquibaseServiceLocatorApplicationListener implements - ApplicationListener<ApplicationStartedEvent> { +public class LiquibaseServiceLocatorApplicationListener + implements ApplicationListener<ApplicationStartedEvent> { static final Log logger = LogFactory .getLog(LiquibaseServiceLocatorApplicationListener.class); diff --git a/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java b/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java index f66a5f2c59..27b358863c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java +++ b/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java @@ -64,7 +64,8 @@ public class SpringPackageScanClassResolver extends DefaultPackageScanClassResol } private Resource[] scan(ClassLoader loader, String packageName) throws IOException { - ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(loader); + ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver( + loader); String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + ClassUtils.convertClassNameToResourcePath(packageName) + "/**/*.class"; Resource[] resources = resolver.getResources(pattern); @@ -87,8 +88,8 @@ public class SpringPackageScanClassResolver extends DefaultPackageScanClassResol } catch (Throwable ex) { if (this.logger.isWarnEnabled()) { - this.logger.warn("Unexpected failure when loading class resource " - + resource, ex); + this.logger.warn( + "Unexpected failure when loading class resource " + resource, ex); } return null; } @@ -96,8 +97,8 @@ public class SpringPackageScanClassResolver extends DefaultPackageScanClassResol private void handleFailure(Resource resource, Throwable ex) { if (this.logger.isDebugEnabled()) { - this.logger.debug("Ignoring candidate class resource " + resource - + " due to " + ex); + this.logger.debug( + "Ignoring candidate class resource " + resource + " due to " + ex); } } 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 7729e02826..436e56b244 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 @@ -70,7 +70,8 @@ public abstract class AbstractLoggingSystem extends LoggingSystem { */ protected String getSelfInitializationConfig() { for (String location : getStandardConfigLocations()) { - ClassPathResource resource = new ClassPathResource(location, this.classLoader); + ClassPathResource resource = new ClassPathResource(location, + this.classLoader); if (resource.exists()) { return "classpath:" + location; } 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 a6d0908be4..a758cd93d0 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 @@ -35,8 +35,8 @@ import org.springframework.core.Ordered; * * @author Andy Wilkinson */ -public final class ClasspathLoggingApplicationListener implements - SmartApplicationListener { +public final class ClasspathLoggingApplicationListener + implements SmartApplicationListener { private static final int ORDER = Ordered.HIGHEST_PRECEDENCE + 12; @@ -52,8 +52,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/LoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java index 958a553e65..317ed313af 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java @@ -53,7 +53,8 @@ import org.springframework.util.StringUtils; * <ul> * <li>{@code LOG_FILE} is set to the value of path of the log file that should be written * (if any).</li> - * <li>{@code PID} is set to the value of the current process ID if it can be determined.</li> + * <li>{@code PID} is set to the value of the current process ID if it can be determined. + * </li> * </ul> * * @author Dave Syer @@ -87,6 +88,7 @@ public class LoggingApplicationListener implements SmartApplicationListener { public static final String PID_KEY = "PID"; private static MultiValueMap<LogLevel, String> LOG_LEVEL_LOGGERS; + static { LOG_LEVEL_LOGGERS = new LinkedMultiValueMap<LogLevel, String>(); LOG_LEVEL_LOGGERS.add(LogLevel.DEBUG, "org.springframework.boot"); @@ -139,7 +141,8 @@ public class LoggingApplicationListener implements SmartApplicationListener { onApplicationStartedEvent((ApplicationStartedEvent) event); } else if (event instanceof ApplicationEnvironmentPreparedEvent) { - onApplicationEnvironmentPreparedEvent((ApplicationEnvironmentPreparedEvent) event); + onApplicationEnvironmentPreparedEvent( + (ApplicationEnvironmentPreparedEvent) event); } else if (event instanceof ContextClosedEvent) { onContextClosedEvent(); @@ -147,16 +150,16 @@ public class LoggingApplicationListener implements SmartApplicationListener { } private void onApplicationStartedEvent(ApplicationStartedEvent event) { - this.loggingSystem = LoggingSystem.get(event.getSpringApplication() - .getClassLoader()); + this.loggingSystem = LoggingSystem + .get(event.getSpringApplication().getClassLoader()); this.loggingSystem.beforeInitialize(); } private void onApplicationEnvironmentPreparedEvent( ApplicationEnvironmentPreparedEvent event) { if (this.loggingSystem == null) { - this.loggingSystem = LoggingSystem.get(event.getSpringApplication() - .getClassLoader()); + this.loggingSystem = LoggingSystem + .get(event.getSpringApplication().getClassLoader()); } initialize(event.getEnvironment(), event.getSpringApplication().getClassLoader()); } @@ -173,7 +176,8 @@ public class LoggingApplicationListener implements SmartApplicationListener { * @param environment the environment * @param classLoader the classloader */ - protected void initialize(ConfigurableEnvironment environment, ClassLoader classLoader) { + protected void initialize(ConfigurableEnvironment environment, + ClassLoader classLoader) { if (System.getProperty(PID_KEY) == null) { System.setProperty(PID_KEY, new ApplicationPid().toString()); } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java index 1210f151da..6dc6bea7fe 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java @@ -38,6 +38,7 @@ public abstract class LoggingSystem { public static final String SYSTEM_PROPERTY = LoggingSystem.class.getName(); private static final Map<String, String> SYSTEMS; + static { Map<String, String> systems = new LinkedHashMap<String, String>(); systems.put("ch.qos.logback.core.Appender", diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java index 6bd3ba8e0d..e94b41ea60 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java @@ -43,6 +43,7 @@ import org.springframework.util.StringUtils; public class JavaLoggingSystem extends AbstractLoggingSystem { private static final Map<LogLevel, Level> LEVELS; + static { Map<LogLevel, Level> levels = new HashMap<LogLevel, Level>(); levels.put(LogLevel.TRACE, Level.FINEST); @@ -84,8 +85,8 @@ public class JavaLoggingSystem extends AbstractLoggingSystem { protected void loadConfiguration(String location, LogFile logFile) { Assert.notNull(location, "Location must not be null"); try { - String configuration = FileCopyUtils.copyToString(new InputStreamReader( - ResourceUtils.getURL(location).openStream())); + String configuration = FileCopyUtils.copyToString( + new InputStreamReader(ResourceUtils.getURL(location).openStream())); if (logFile != null) { configuration = configuration.replace("${LOG_FILE}", StringUtils.cleanPath(logFile.toString())); @@ -94,8 +95,8 @@ public class JavaLoggingSystem extends AbstractLoggingSystem { new ByteArrayInputStream(configuration.getBytes())); } catch (Exception ex) { - throw new IllegalStateException("Could not initialize Java logging from " - + location, ex); + throw new IllegalStateException( + "Could not initialize Java logging from " + location, ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/log4j/Log4JLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/log4j/Log4JLoggingSystem.java index 2820fe96dd..29fc3161ac 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/log4j/Log4JLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/log4j/Log4JLoggingSystem.java @@ -41,6 +41,7 @@ import org.springframework.util.StringUtils; public class Log4JLoggingSystem extends Slf4JLoggingSystem { private static final Map<LogLevel, Level> LEVELS; + static { Map<LogLevel, Level> levels = new HashMap<LogLevel, Level>(); levels.put(LogLevel.TRACE, Level.TRACE); @@ -88,8 +89,8 @@ public class Log4JLoggingSystem extends Slf4JLoggingSystem { Log4jConfigurer.initLogging(location); } catch (Exception ex) { - throw new IllegalStateException("Could not initialize Log4J logging from " - + location, ex); + throw new IllegalStateException( + "Could not initialize Log4J logging from " + location, ex); } } @@ -100,8 +101,8 @@ public class Log4JLoggingSystem extends Slf4JLoggingSystem { @Override public void setLogLevel(String loggerName, LogLevel level) { - Logger logger = (StringUtils.hasLength(loggerName) ? LogManager - .getLogger(loggerName) : LogManager.getRootLogger()); + Logger logger = (StringUtils.hasLength(loggerName) + ? LogManager.getLogger(loggerName) : LogManager.getRootLogger()); logger.setLevel(LEVELS.get(level)); } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java index 56b16710df..1a2d9f3d78 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java @@ -53,6 +53,7 @@ import org.springframework.util.ResourceUtils; public class Log4J2LoggingSystem extends Slf4JLoggingSystem { private static final Map<LogLevel, Level> LEVELS; + static { Map<LogLevel, Level> levels = new HashMap<LogLevel, Level>(); levels.put(LogLevel.TRACE, Level.TRACE); @@ -110,8 +111,8 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem { Collections.addAll(supportedConfigLocations, "log4j2.json", "log4j2.jsn"); } supportedConfigLocations.add("log4j2.xml"); - return supportedConfigLocations.toArray(new String[supportedConfigLocations - .size()]); + return supportedConfigLocations + .toArray(new String[supportedConfigLocations.size()]); } protected boolean isClassAvailable(String className) { @@ -153,8 +154,8 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem { ctx.start(ConfigurationFactory.getInstance().getConfiguration(source)); } catch (Exception ex) { - throw new IllegalStateException("Could not initialize Log4J2 logging from " - + location, ex); + throw new IllegalStateException( + "Could not initialize Log4J2 logging from " + location, ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java index 49817701da..e8fe2958d3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java @@ -37,6 +37,7 @@ import ch.qos.logback.core.pattern.CompositeConverter; public class ColorConverter extends CompositeConverter<ILoggingEvent> { private static final Map<String, AnsiElement> ELEMENTS; + static { Map<String, AnsiElement> elements = new HashMap<String, AnsiElement>(); elements.put("faint", AnsiElement.FAINT); @@ -50,6 +51,7 @@ public class ColorConverter extends CompositeConverter<ILoggingEvent> { } private static final Map<Integer, AnsiElement> LEVELS; + static { Map<Integer, AnsiElement> levels = new HashMap<Integer, AnsiElement>(); levels.put(Level.ERROR_INTEGER, AnsiElement.RED); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java index 24aeb38908..37118d5a10 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java @@ -99,8 +99,8 @@ class DefaultLogbackConfiguration { private Appender<ILoggingEvent> consoleAppender(LogbackConfigurator config) { ConsoleAppender<ILoggingEvent> appender = new ConsoleAppender<ILoggingEvent>(); PatternLayoutEncoder encoder = new PatternLayoutEncoder(); - encoder.setPattern(OptionHelper.substVars(CONSOLE_LOG_PATTERN, - config.getContext())); + encoder.setPattern( + OptionHelper.substVars(CONSOLE_LOG_PATTERN, config.getContext())); encoder.setCharset(UTF8); config.start(encoder); appender.setEncoder(encoder); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java index 122fad4215..d5fc9e87c2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java @@ -43,8 +43,8 @@ import ch.qos.logback.core.AppenderBase; */ public class LevelRemappingAppender extends AppenderBase<ILoggingEvent> { - private static final Map<Level, Level> DEFAULT_REMAPS = Collections.singletonMap( - Level.INFO, Level.DEBUG); + private static final Map<Level, Level> DEFAULT_REMAPS = Collections + .singletonMap(Level.INFO, Level.DEBUG); private String destinationLogger = Logger.ROOT_LOGGER_NAME; @@ -137,8 +137,8 @@ public class LevelRemappingAppender extends AppenderBase<ILoggingEvent> { @Override public Level getLevel() { - Level remappedLevel = LevelRemappingAppender.this.remapLevels.get(this.event - .getLevel()); + Level remappedLevel = LevelRemappingAppender.this.remapLevels + .get(this.event.getLevel()); return (remappedLevel == null ? this.event.getLevel() : remappedLevel); } 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 6f7369e382..2ce6ff87b1 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 @@ -52,6 +52,7 @@ import ch.qos.logback.core.spi.FilterReply; public class LogbackLoggingSystem extends Slf4JLoggingSystem { private static final Map<LogLevel, Level> LEVELS; + static { Map<LogLevel, Level> levels = new HashMap<LogLevel, Level>(); levels.put(LogLevel.TRACE, Level.TRACE); @@ -80,8 +81,8 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { @Override protected String[] getStandardConfigLocations() { - return new String[] { "logback-test.groovy", "logback-test.xml", - "logback.groovy", "logback.xml" }; + return new String[] { "logback-test.groovy", "logback-test.xml", "logback.groovy", + "logback.xml" }; } @Override @@ -118,8 +119,8 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { new ContextInitializer(context).configureByResource(url); } catch (Exception ex) { - throw new IllegalStateException("Could not initialize Logback logging from " - + location, ex); + throw new IllegalStateException( + "Could not initialize Logback logging from " + location, ex); } } @@ -155,20 +156,21 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { private ch.qos.logback.classic.Logger getLogger(String name) { LoggerContext factory = getLoggerContext(); - return factory.getLogger(StringUtils.isEmpty(name) ? Logger.ROOT_LOGGER_NAME - : name); + return factory + .getLogger(StringUtils.isEmpty(name) ? Logger.ROOT_LOGGER_NAME : name); } private LoggerContext getLoggerContext() { ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory(); - Assert.isInstanceOf(LoggerContext.class, factory, String.format( - "LoggerFactory is not a Logback LoggerContext but Logback is on " - + "the classpath. Either remove Logback or the competing " - + "implementation (%s loaded from %s). If you are using " - + "Weblogic you will need to add 'org.slf4j' to " - + "prefer-application-packages in WEB-INF/weblogic.xml", - factory.getClass(), getLocation(factory))); + Assert.isInstanceOf(LoggerContext.class, factory, + String.format( + "LoggerFactory is not a Logback LoggerContext but Logback is on " + + "the classpath. Either remove Logback or the competing " + + "implementation (%s loaded from %s). If you are using " + + "Weblogic you will need to add 'org.slf4j' to " + + "prefer-application-packages in WEB-INF/weblogic.xml", + factory.getClass(), getLocation(factory))); return (LoggerContext) factory; } diff --git a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityScanRegistrar.java b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityScanRegistrar.java index 1113cdd6bc..aa7aa1e853 100644 --- a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityScanRegistrar.java +++ b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityScanRegistrar.java @@ -60,8 +60,8 @@ class EntityScanRegistrar implements ImportBeanDefinitionRegistrar { } private Set<String> getPackagesToScan(AnnotationMetadata metadata) { - AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(EntityScan.class.getName())); + AnnotationAttributes attributes = AnnotationAttributes + .fromMap(metadata.getAnnotationAttributes(EntityScan.class.getName())); String[] value = attributes.getStringArray("value"); String[] basePackages = attributes.getStringArray("basePackages"); Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses"); @@ -76,8 +76,8 @@ class EntityScanRegistrar 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; } @@ -86,8 +86,8 @@ class EntityScanRegistrar implements ImportBeanDefinitionRegistrar { Set<String> packagesToScan) { GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(EntityScanBeanPostProcessor.class); - beanDefinition.getConstructorArgumentValues().addGenericArgumentValue( - toArray(packagesToScan)); + beanDefinition.getConstructorArgumentValues() + .addGenericArgumentValue(toArray(packagesToScan)); beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); // We don't need this one to be post processed otherwise it can cause a // cascade of bean instantiation that we would rather avoid. @@ -115,8 +115,8 @@ class EntityScanRegistrar implements ImportBeanDefinitionRegistrar { * {@link LocalContainerEntityManagerFactoryBean#setPackagesToScan(String...)} based * on an {@link EntityScan} annotation. */ - static class EntityScanBeanPostProcessor implements BeanPostProcessor, - SmartInitializingSingleton, Ordered { + static class EntityScanBeanPostProcessor + implements BeanPostProcessor, SmartInitializingSingleton, Ordered { private final String[] packagesToScan; @@ -145,9 +145,10 @@ class EntityScanRegistrar implements ImportBeanDefinitionRegistrar { @Override public void afterSingletonsInstantiated() { - Assert.state(this.processed, "Unable to configure " - + "LocalContainerEntityManagerFactoryBean from @EntityScan, " - + "ensure an appropriate bean is registered."); + Assert.state(this.processed, + "Unable to configure " + + "LocalContainerEntityManagerFactoryBean from @EntityScan, " + + "ensure an appropriate bean is registered."); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/SpringNamingStrategy.java b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/SpringNamingStrategy.java index ec0b9a6d7b..b39724bf4b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/SpringNamingStrategy.java +++ b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/SpringNamingStrategy.java @@ -27,7 +27,7 @@ import org.hibernate.cfg.NamingStrategy; */ @Deprecated @SuppressWarnings("serial") -public class SpringNamingStrategy extends - org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy { +public class SpringNamingStrategy + extends org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy { } diff --git a/spring-boot/src/main/java/org/springframework/boot/test/Base64.java b/spring-boot/src/main/java/org/springframework/boot/test/Base64.java index eb332d5c16..dab4e3950a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/Base64.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/Base64.java @@ -37,8 +37,8 @@ final class Base64 { /** * Encode using Base64-like encoding that is URL- and Filename-safe as described in - * Section 4 of RFC3548: <a - * href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs + * Section 4 of RFC3548: + * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs * .org/rfcs/rfc3548.html</a>. It is important to note that data encoded this way is * <em>not</em> officially valid Base64, or at the very least should not be called * Base64 without also specifying that is was encoded using the URL- and Filename-safe @@ -47,9 +47,9 @@ final class Base64 { public static final int URL_SAFE = 16; /** - * Encode using the special "ordered" dialect of Base64 described here: <a - * href="http://www.faqs.org/qa/rfcc-1940.html" - * >http://www.faqs.org/qa/rfcc-1940.html</a>. + * Encode using the special "ordered" dialect of Base64 described here: + * <a href="http://www.faqs.org/qa/rfcc-1940.html" >http://www.faqs.org/qa/rfcc-1940. + * html</a>. */ public static final int ORDERED = 32; @@ -69,18 +69,18 @@ final class Base64 { /** The 64 valid Base64 values. */ /* Host platform me be something funny like EBCDIC, so we hardcode these values. */ - private static final byte[] _STANDARD_ALPHABET = { (byte) 'A', (byte) 'B', - (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', - (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', - (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', - (byte) 'U', (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', - (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', - (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k', (byte) 'l', - (byte) 'm', (byte) 'n', (byte) 'o', (byte) 'p', (byte) 'q', (byte) 'r', - (byte) 's', (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', - (byte) 'y', (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', - (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', - (byte) '+', (byte) '/' }; + private static final byte[] _STANDARD_ALPHABET = { (byte) 'A', (byte) 'B', (byte) 'C', + (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', + (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', + (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', + (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', + (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', (byte) 'g', + (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k', (byte) 'l', (byte) 'm', + (byte) 'n', (byte) 'o', (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', + (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y', + (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', + (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) '+', + (byte) '/' }; /** * Translates a Base64 value to either its 6-bit reconstruction value or a negative @@ -123,24 +123,23 @@ final class Base64 { /* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */ /** - * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548: <a - * href - * ="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>. - * Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" - * and "slash." + * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548: + * <a href ="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548. + * html</a>. Notice that the last two bytes become "hyphen" and "underscore" instead + * of "plus" and "slash." */ - private static final byte[] _URL_SAFE_ALPHABET = { (byte) 'A', (byte) 'B', - (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', - (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', - (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', - (byte) 'U', (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', - (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', - (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k', (byte) 'l', - (byte) 'm', (byte) 'n', (byte) 'o', (byte) 'p', (byte) 'q', (byte) 'r', - (byte) 's', (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', - (byte) 'y', (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', - (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', - (byte) '-', (byte) '_' }; + private static final byte[] _URL_SAFE_ALPHABET = { (byte) 'A', (byte) 'B', (byte) 'C', + (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', + (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', + (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', + (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', + (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', (byte) 'g', + (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k', (byte) 'l', (byte) 'm', + (byte) 'n', (byte) 'o', (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', + (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y', + (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', + (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) '-', + (byte) '_' }; /** * Used in decoding URL- and Filename-safe dialects of Base64. @@ -187,8 +186,8 @@ final class Base64 { /** * I don't get the point of this technique, but someone requested it, and it is - * described here: <a - * href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/ + * described here: + * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/ * qa/rfcc-1940.html</a>. */ private static final byte[] _ORDERED_ALPHABET = { (byte) '-', (byte) '0', (byte) '1', @@ -207,8 +206,10 @@ final class Base64 { /** * Used in decoding the "ordered" dialect of Base64. */ - private static final byte[] _ORDERED_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, - -9, // Decimal 0 - 8 + private static final byte[] _ORDERED_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal + // 0 + // - + // 8 -5, -5, // Whitespace: Tab and Linefeed -9, -9, // Decimal 11 - 12 -5, // Whitespace: Carriage Return @@ -383,7 +384,8 @@ final class Base64 { * @throws IllegalArgumentException if source array, offset, or length are invalid * @since 2.3.1 */ - private static byte[] encodeBytesToBytes(byte[] source, int off, int len, int options) { + private static byte[] encodeBytesToBytes(byte[] source, int off, int len, + int options) { if (source == null) { throw new NullPointerException("Cannot serialize a null array."); @@ -490,16 +492,14 @@ final class Base64 { throw new NullPointerException("Destination array was null."); } // end if if (srcOffset < 0 || srcOffset + 3 >= source.length) { - throw new IllegalArgumentException( - String.format( - "Source array with length %d cannot have offset of %d and still process four bytes.", - source.length, srcOffset)); + throw new IllegalArgumentException(String.format( + "Source array with length %d cannot have offset of %d and still process four bytes.", + source.length, srcOffset)); } // end if if (destOffset < 0 || destOffset + 2 >= destination.length) { - throw new IllegalArgumentException( - String.format( - "Destination array with length %d cannot have offset of %d and still store three bytes.", - destination.length, destOffset)); + throw new IllegalArgumentException(String.format( + "Destination array with length %d cannot have offset of %d and still store three bytes.", + destination.length, destOffset)); } // end if byte[] DECODABET = getDecodabet(options); @@ -573,10 +573,9 @@ final class Base64 { throw new NullPointerException("Cannot decode null source array."); } // end if if (off < 0 || off + len > source.length) { - throw new IllegalArgumentException( - String.format( - "Source array with length %d cannot have offset of %d and process %d bytes.", - source.length, off, len)); + throw new IllegalArgumentException(String.format( + "Source array with length %d cannot have offset of %d and process %d bytes.", + source.length, off, len)); } // end if if (len == 0) { diff --git a/spring-boot/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java index 78f1ebfa3b..5c0e3fdc08 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java @@ -29,8 +29,8 @@ import org.springframework.test.context.ContextConfiguration; * @author Phillip Webb * @see ConfigFileApplicationListener */ -public class ConfigFileApplicationContextInitializer implements - ApplicationContextInitializer<ConfigurableApplicationContext> { +public class ConfigFileApplicationContextInitializer + implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(final ConfigurableApplicationContext applicationContext) { 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 e067a3100e..cd3cfbed97 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 @@ -44,7 +44,8 @@ public class IntegrationTestPropertiesListener extends AbstractTestExecutionList } } - private void addPropertySourceProperties(TestContext testContext, String[] properties) { + private void addPropertySourceProperties(TestContext testContext, + String[] properties) { try { MergedContextConfiguration configuration = (MergedContextConfiguration) ReflectionTestUtils .getField(testContext, "mergedContextConfiguration"); 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 6a7475e870..3ebc151850 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 @@ -33,13 +33,14 @@ class MergedContextConfigurationProperties { private final MergedContextConfiguration configuration; - public MergedContextConfigurationProperties(MergedContextConfiguration configuration) { + public MergedContextConfigurationProperties( + MergedContextConfiguration configuration) { this.configuration = configuration; } public void add(String[] properties, String... additional) { - Set<String> merged = new LinkedHashSet<String>((Arrays.asList(this.configuration - .getPropertySourceProperties()))); + Set<String> merged = new LinkedHashSet<String>( + (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/ServerPortInfoApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/test/ServerPortInfoApplicationContextInitializer.java index 4359ad43ab..5974bd8aee 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/ServerPortInfoApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/ServerPortInfoApplicationContextInitializer.java @@ -43,13 +43,13 @@ import org.springframework.util.StringUtils; * @author Dave Syer * @author Phillip Webb */ -public class ServerPortInfoApplicationContextInitializer implements - ApplicationContextInitializer<ConfigurableApplicationContext> { +public class ServerPortInfoApplicationContextInitializer + implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext applicationContext) { - applicationContext - .addApplicationListener(new ApplicationListener<EmbeddedServletContainerInitializedEvent>() { + applicationContext.addApplicationListener( + new ApplicationListener<EmbeddedServletContainerInitializedEvent>() { @Override public void onApplicationEvent( EmbeddedServletContainerInitializedEvent event) { @@ -61,8 +61,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) { @@ -73,7 +73,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) { EnvironmentTestUtils.addEnvironment((ConfigurableApplicationContext) context, propertyName + ":" + port); 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 3d7560a315..024d5dabce 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<String, Object> properties = new LinkedHashMap<String, Object>(); // 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 (!isIntegrationTest(config.getTestClass())) { 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<ApplicationContextInitializer<?>> getInitializers( MergedContextConfiguration mergedConfig, SpringApplication application) { List<ApplicationContextInitializer<?>> initializers = new ArrayList<ApplicationContextInitializer<?>>(); - initializers.add(new PropertySourceLocationsInitializer(mergedConfig - .getPropertySourceLocations())); + initializers.add(new PropertySourceLocationsInitializer( + mergedConfig.getPropertySourceLocations())); initializers.add(new ServerPortInfoApplicationContextInitializer()); initializers.addAll(application.getInitializers()); for (Class<? extends ApplicationContextInitializer<?>> initializerClass : mergedConfig @@ -213,8 +214,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { public void processContextConfiguration( ContextConfigurationAttributes configAttributes) { if (!configAttributes.hasLocations() && !configAttributes.hasClasses()) { - Class<?>[] defaultConfigClasses = detectDefaultConfigurationClasses(configAttributes - .getDeclaringClass()); + Class<?>[] defaultConfigClasses = detectDefaultConfigurationClasses( + configAttributes.getDeclaringClass()); configAttributes.setClasses(defaultConfigClasses); } } @@ -267,22 +268,23 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { MockServletContext servletContext = new MockServletContext( webConfiguration.getResourceBasePath(), new FileSystemResourceLoader()); - initializers.add(0, new ServletContextApplicationContextInitializer( - servletContext)); + initializers.add(0, + new ServletContextApplicationContextInitializer(servletContext)); } } private static boolean isIntegrationTest(Class<?> testClass) { - return ((AnnotationUtils.findAnnotation(testClass, IntegrationTest.class) != null) || (AnnotationUtils - .findAnnotation(testClass, WebIntegrationTest.class) != null)); + return ((AnnotationUtils.findAnnotation(testClass, IntegrationTest.class) != null) + || (AnnotationUtils.findAnnotation(testClass, + WebIntegrationTest.class) != null)); } /** * {@link ApplicationContextInitializer} to setup test property source locations. */ - private static class PropertySourceLocationsInitializer implements - ApplicationContextInitializer<ConfigurableApplicationContext> { + private static class PropertySourceLocationsInitializer + implements ApplicationContextInitializer<ConfigurableApplicationContext> { private final String[] propertySourceLocations; 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 e9117ca4d2..e3a4fe5a51 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<ClientHttpRequestInterceptor> interceptors = Collections - .<ClientHttpRequestInterceptor>singletonList(new BasicAuthorizationInterceptor( - username, password)); + .<ClientHttpRequestInterceptor>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; @@ -131,8 +131,8 @@ public class TestRestTemplate extends RestTemplate { } - protected static class CustomHttpComponentsClientHttpRequestFactory extends - HttpComponentsClientHttpRequestFactory { + protected static class CustomHttpComponentsClientHttpRequestFactory + extends HttpComponentsClientHttpRequestFactory { private final String cookieSpec; @@ -142,8 +142,8 @@ public class TestRestTemplate extends RestTemplate { HttpClientOption[] httpClientOptions) { Set<HttpClientOption> options = new HashSet<TestRestTemplate.HttpClientOption>( 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/test/WebAppIntegrationTestContextBootstrapper.java b/spring-boot/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java index 73db30947d..e68842baac 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java @@ -44,8 +44,8 @@ class WebAppIntegrationTestContextBootstrapper extends DefaultTestContextBootstr @Override protected MergedContextConfiguration processMergedContextConfiguration( MergedContextConfiguration mergedConfig) { - WebIntegrationTest annotation = AnnotationUtils.findAnnotation( - mergedConfig.getTestClass(), WebIntegrationTest.class); + WebIntegrationTest annotation = AnnotationUtils + .findAnnotation(mergedConfig.getTestClass(), WebIntegrationTest.class); if (annotation != null) { mergedConfig = new WebMergedContextConfiguration(mergedConfig, null); MergedContextConfigurationProperties properties = new MergedContextConfigurationProperties( diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxView.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxView.java index a32ac85cae..4e69ee9bbc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxView.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxView.java @@ -93,9 +93,9 @@ public class EmbeddedVelocityToolboxView extends VelocityToolboxView { InputStream inputStream = (InputStream) invocation.proceed(); if (inputStream == null) { try { - inputStream = new ClassPathResource(this.toolboxFile, Thread - .currentThread().getContextClassLoader()) - .getInputStream(); + inputStream = new ClassPathResource(this.toolboxFile, + Thread.currentThread().getContextClassLoader()) + .getInputStream(); } catch (Exception ex) { // Ignore 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 295f9be0d4..38c73f2112 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 @@ -47,8 +47,8 @@ public class ArrayDocumentMatcher implements DocumentMatcher { if (!properties.containsKey(this.key)) { return MatchStatus.ABSTAIN; } - Set<String> values = StringUtils.commaDelimitedListToSet(properties - .getProperty(this.key)); + Set<String> values = StringUtils + .commaDelimitedListToSet(properties.getProperty(this.key)); for (String pattern : this.patterns) { for (String value : values) { if (value.matches(pattern)) { diff --git a/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java index 965dc025a2..3ef57b769c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java @@ -51,7 +51,8 @@ public class BeanDefinitionLoaderTests { @Test public void loadXmlResource() throws Exception { - ClassPathResource resource = new ClassPathResource("sample-beans.xml", getClass()); + ClassPathResource resource = new ClassPathResource("sample-beans.xml", + getClass()); BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, resource); int loaded = loader.load(); assertThat(loaded, equalTo(1)); 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 e9e9e91f15..d94b4fad1f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java @@ -43,10 +43,10 @@ public class OverrideSourcesTests { @Test public void primaryBeanInjectedProvingSourcesNotOverridden() { - ApplicationContext context = SpringApplication - .run(new Object[] { MainConfiguration.class, TestConfiguration.class }, - new String[] { "--spring.main.web_environment=false", - "--spring.main.sources=org.springframework.boot.OverrideSourcesTests.MainConfiguration" }); + ApplicationContext 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", context.getBean(Service.class).bean.name); } diff --git a/spring-boot/src/test/java/org/springframework/boot/ReproTests.java b/spring-boot/src/test/java/org/springframework/boot/ReproTests.java index 97a05fe707..b1d23c1abe 100644 --- a/spring-boot/src/test/java/org/springframework/boot/ReproTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/ReproTests.java @@ -88,9 +88,8 @@ public class ReproTests { SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); String configName = "--spring.config.name=activeprofilerepro"; - assertVersionProperty( - application.run(configName, "--spring.profiles.active=A,C"), "C", "A", - "C"); + assertVersionProperty(application.run(configName, "--spring.profiles.active=A,C"), + "C", "A", "C"); } @Test @@ -99,9 +98,8 @@ public class ReproTests { SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); String configName = "--spring.config.name=activeprofilerepro"; - assertVersionProperty( - application.run(configName, "--spring.profiles.active=C,A"), "A", "C", - "A"); + assertVersionProperty(application.run(configName, "--spring.profiles.active=C,A"), + "A", "C", "A"); } @Test @@ -139,9 +137,8 @@ public class ReproTests { SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); String configName = "--spring.config.name=activeprofilerepro-without-override"; - assertVersionProperty( - application.run(configName, "--spring.profiles.active=A,C"), "C", "A", - "C"); + assertVersionProperty(application.run(configName, "--spring.profiles.active=A,C"), + "C", "A", "C"); } @Test @@ -150,9 +147,8 @@ public class ReproTests { SpringApplication application = new SpringApplication(Config.class); application.setWebEnvironment(false); String configName = "--spring.config.name=activeprofilerepro-without-override"; - assertVersionProperty( - application.run(configName, "--spring.profiles.active=C,A"), "A", "C", - "A"); + assertVersionProperty(application.run(configName, "--spring.profiles.active=C,A"), + "A", "C", "A"); } private void assertVersionProperty(ConfigurableApplicationContext context, diff --git a/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java b/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java index 27f3966eb7..17b50fc1af 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java @@ -50,8 +50,8 @@ public class SimpleMainTests { @Test public void basePackageScan() throws Exception { - SpringApplication.main(getArgs(ClassUtils.getPackageName(getClass()) - + ".sampleconfig")); + SpringApplication + .main(getArgs(ClassUtils.getPackageName(getClass()) + ".sampleconfig")); assertTrue(getOutput().contains(SPRING_STARTUP)); } 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 9373f8816c..97d121f71c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -204,14 +204,13 @@ public class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebEnvironment(false); final AtomicReference<ApplicationContext> reference = new AtomicReference<ApplicationContext>(); - application - .setInitializers(Arrays - .asList(new ApplicationContextInitializer<ConfigurableApplicationContext>() { - @Override - public void initialize(ConfigurableApplicationContext context) { - reference.set(context); - } - })); + application.setInitializers(Arrays.asList( + new ApplicationContextInitializer<ConfigurableApplicationContext>() { + @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 @@ -255,7 +254,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); @@ -265,7 +265,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); @@ -312,9 +313,8 @@ public class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebEnvironment(false); ConfigurableEnvironment environment = new StandardEnvironment(); - environment.getPropertySources().addFirst( - new MapPropertySource("commandLineArgs", Collections - .<String, Object>singletonMap("foo", "original"))); + environment.getPropertySources().addFirst(new MapPropertySource("commandLineArgs", + Collections.<String, Object>singletonMap("foo", "original"))); application.setEnvironment(environment); application.run("--foo=bar", "--bar=foo"); assertTrue(hasPropertySource(environment, CompositePropertySource.class, @@ -388,8 +388,8 @@ public class SpringApplicationTests { ConfigurableEnvironment environment = new StandardEnvironment(); application.setEnvironment(environment); application.run("--foo=bar"); - assertFalse(hasPropertySource(environment, PropertySource.class, - "commandLineArgs")); + assertFalse( + hasPropertySource(environment, PropertySource.class, "commandLineArgs")); } @Test @@ -414,7 +414,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); application.run(); @@ -428,8 +429,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); } @@ -470,7 +471,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); application.run("--spring.main.show_banner=false"); assertThat(application.getShowBanner(), is(false)); @@ -531,7 +533,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); application.run(); assertThat(System.getProperty("java.awt.headless"), equalTo("true")); @@ -539,7 +542,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); application.run(); @@ -549,7 +553,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); application.run(); assertThat(System.getProperty("java.awt.headless"), equalTo("false")); @@ -576,7 +581,8 @@ public class SpringApplicationTests { public static class SpyApplicationContext extends AnnotationConfigApplicationContext { - ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext()); + ConfigurableApplicationContext applicationContext = spy( + new AnnotationConfigApplicationContext()); @Override public void registerShutdownHook() { @@ -676,8 +682,8 @@ public class SpringApplicationTests { } } - static class TestCommandLineRunner implements CommandLineRunner, - ApplicationContextAware, Ordered { + static class TestCommandLineRunner + implements CommandLineRunner, ApplicationContextAware, Ordered { private final String[] expectedBefore; diff --git a/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java b/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java index 7a612db449..1af849dfea 100644 --- a/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/StartUpLoggerTests.java @@ -41,8 +41,8 @@ public class StartUpLoggerTests { @Test public void sourceClassIncluded() { new StartupInfoLogger(getClass()).logStarting(this.log); - assertTrue("Wrong output: " + this.output, - this.output.toString().contains("Starting " + getClass().getSimpleName())); + assertTrue("Wrong output: " + this.output, this.output.toString() + .contains("Starting " + getClass().getSimpleName())); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiOutputTests.java b/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiOutputTests.java index f50ed2c9f5..a84690db4d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiOutputTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiOutputTests.java @@ -48,8 +48,8 @@ public class AnsiOutputTests { @Test public void encoding() throws Exception { - String encoded = AnsiOutput.toString("A", RED, BOLD, "B", NORMAL, "D", GREEN, - "E", FAINT, "F"); + String encoded = AnsiOutput.toString("A", RED, BOLD, "B", NORMAL, "D", GREEN, "E", + FAINT, "F"); assertThat(encoded, equalTo("ABDEF")); } 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 869c3a7906..176412ad3a 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 @@ -30,8 +30,8 @@ public class DefaultPropertyNamePatternsMatcherTests { @Test public void namesShorter() { - assertFalse(new DefaultPropertyNamePatternsMatcher("aaaa", "bbbb") - .matches("zzzzz")); + assertFalse( + new DefaultPropertyNamePatternsMatcher("aaaa", "bbbb").matches("zzzzz")); } diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java index 530c969d0a..25e6a84ea5 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java @@ -66,8 +66,8 @@ public class PropertiesConfigurationFactoryMapTests { this.targetName = "foo"; setupFactory(); MutablePropertySources sources = new MutablePropertySources(); - sources.addFirst(new MapPropertySource("map", Collections.singletonMap( - "foo.map.name", (Object) "blah"))); + sources.addFirst(new MapPropertySource("map", + Collections.singletonMap("foo.map.name", (Object) "blah"))); this.factory.setPropertySources(sources); this.factory.afterPropertiesSet(); Foo foo = this.factory.getObject(); @@ -80,8 +80,8 @@ public class PropertiesConfigurationFactoryMapTests { setupFactory(); MutablePropertySources sources = new MutablePropertySources(); CompositePropertySource composite = new CompositePropertySource("composite"); - composite.addPropertySource(new MapPropertySource("map", Collections - .singletonMap("foo.map.name", (Object) "blah"))); + composite.addPropertySource(new MapPropertySource("map", + Collections.singletonMap("foo.map.name", (Object) "blah"))); sources.addFirst(composite); this.factory.setPropertySources(sources); this.factory.afterPropertiesSet(); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java index ebf73b6b61..451fc0a609 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java @@ -93,15 +93,15 @@ public class PropertiesConfigurationFactoryTests { @Test(expected = BindException.class) public void testMissingPropertyCausesValidationError() throws Exception { - this.validator = new SpringValidatorAdapter(Validation - .buildDefaultValidatorFactory().getValidator()); + this.validator = new SpringValidatorAdapter( + Validation.buildDefaultValidatorFactory().getValidator()); createFoo("bar: blah"); } @Test public void testValidationErrorCanBeSuppressed() throws Exception { - this.validator = new SpringValidatorAdapter(Validation - .buildDefaultValidatorFactory().getValidator()); + this.validator = new SpringValidatorAdapter( + Validation.buildDefaultValidatorFactory().getValidator()); setupFactory(); this.factory.setExceptionIfInvalid(false); bindFoo("bar: blah"); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java index b480c97486..5d7fb8fafd 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java @@ -60,8 +60,8 @@ public class PropertySourcesPropertyValuesTests { } }); - this.propertySources.addFirst(new MapPropertySource("map", Collections - .<String, Object>singletonMap("name", "${foo}"))); + this.propertySources.addFirst(new MapPropertySource("map", + Collections.<String, Object>singletonMap("name", "${foo}"))); } @Test @@ -146,8 +146,8 @@ public class PropertySourcesPropertyValuesTests { @Test public void testOverriddenValue() { - this.propertySources.addFirst(new MapPropertySource("new", Collections - .<String, Object>singletonMap("name", "spam"))); + this.propertySources.addFirst(new MapPropertySource("new", + Collections.<String, Object>singletonMap("name", "spam"))); PropertySourcesPropertyValues propertyValues = new PropertySourcesPropertyValues( this.propertySources); assertEquals("spam", propertyValues.getPropertyValue("name").getValue()); @@ -174,8 +174,8 @@ public class PropertySourcesPropertyValuesTests { public void testPlaceholdersBindingWithError() { TestBean target = new TestBean(); DataBinder binder = new DataBinder(target); - this.propertySources.addFirst(new MapPropertySource("another", Collections - .<String, Object>singletonMap("something", "${nonexistent}"))); + this.propertySources.addFirst(new MapPropertySource("another", + Collections.<String, Object>singletonMap("something", "${nonexistent}"))); binder.bind(new PropertySourcesPropertyValues(this.propertySources)); assertEquals("bar", target.getName()); } 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 484043e273..29e467f6e4 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 @@ -162,8 +162,8 @@ public class RelaxedDataBinderTests { BindingResult result = bind(target, "info[foo]: bar"); assertEquals(2, result.getErrorCount()); for (FieldError error : result.getFieldErrors()) { - System.err.println(new StaticMessageSource().getMessage(error, - Locale.getDefault())); + System.err.println( + new StaticMessageSource().getMessage(error, Locale.getDefault())); } } @@ -173,8 +173,8 @@ public class RelaxedDataBinderTests { RelaxedDataBinder binder = getBinder(target, null); binder.setAllowedFields("foo"); binder.setIgnoreUnknownFields(false); - BindingResult result = bind(binder, target, "foo: bar\n" + "value: 123\n" - + "bar: spam"); + BindingResult result = bind(binder, target, + "foo: bar\n" + "value: 123\n" + "bar: spam"); assertEquals(0, target.getValue()); assertEquals("bar", target.getFoo()); assertEquals(0, result.getErrorCount()); @@ -187,8 +187,8 @@ public class RelaxedDataBinderTests { // Disallowed fields are not unknown... binder.setDisallowedFields("foo", "bar"); binder.setIgnoreUnknownFields(false); - BindingResult result = bind(binder, target, "foo: bar\n" + "value: 123\n" - + "bar: spam"); + BindingResult result = bind(binder, target, + "foo: bar\n" + "value: 123\n" + "bar: spam"); assertEquals(123, target.getValue()); assertNull(target.getFoo()); assertEquals(0, result.getErrorCount()); @@ -392,8 +392,8 @@ public class RelaxedDataBinderTests { RelaxedDataBinder binder = getBinder(target, null); binder.setIgnoreUnknownFields(false); binder.setIgnoreNestedProperties(true); - BindingResult result = bind(binder, target, "foo: bar\n" + "value: 123\n" - + "nested.bar: spam"); + BindingResult result = bind(binder, target, + "foo: bar\n" + "value: 123\n" + "nested.bar: spam"); assertEquals(123, target.getValue()); assertEquals("bar", target.getFoo()); assertEquals(0, result.getErrorCount()); @@ -405,8 +405,8 @@ public class RelaxedDataBinderTests { RelaxedDataBinder binder = getBinder(target, "foo"); binder.setIgnoreUnknownFields(false); binder.setIgnoreNestedProperties(true); - BindingResult result = bind(binder, target, "foo.foo: bar\n" + "foo.value: 123\n" - + "foo.nested.bar: spam"); + BindingResult result = bind(binder, target, + "foo.foo: bar\n" + "foo.value: 123\n" + "foo.nested.bar: spam"); assertEquals(123, target.getValue()); assertEquals("bar", target.getFoo()); assertEquals(0, result.getErrorCount()); @@ -424,8 +424,8 @@ public class RelaxedDataBinderTests { @Test public void testBindMapWithClashInProperties() throws Exception { Map<String, Object> target = new LinkedHashMap<String, Object>(); - BindingResult result = bind(target, "vanilla.spam: bar\n" - + "vanilla.spam.value: 123", "vanilla"); + BindingResult result = bind(target, + "vanilla.spam: bar\n" + "vanilla.spam.value: 123", "vanilla"); assertEquals(0, result.getErrorCount()); assertEquals(2, target.size()); assertEquals("bar", target.get("spam")); @@ -435,8 +435,8 @@ public class RelaxedDataBinderTests { @Test public void testBindMapWithDeepClashInProperties() throws Exception { Map<String, Object> target = new LinkedHashMap<String, Object>(); - BindingResult result = bind(target, "vanilla.spam.foo: bar\n" - + "vanilla.spam.foo.value: 123", "vanilla"); + BindingResult result = bind(target, + "vanilla.spam.foo: bar\n" + "vanilla.spam.foo.value: 123", "vanilla"); assertEquals(0, result.getErrorCount()); @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) target.get("spam"); @@ -446,8 +446,8 @@ public class RelaxedDataBinderTests { @Test public void testBindMapWithDifferentDeepClashInProperties() throws Exception { Map<String, Object> target = new LinkedHashMap<String, Object>(); - BindingResult result = bind(target, "vanilla.spam.bar: bar\n" - + "vanilla.spam.bar.value: 123", "vanilla"); + BindingResult result = bind(target, + "vanilla.spam.bar: bar\n" + "vanilla.spam.bar.value: 123", "vanilla"); assertEquals(0, result.getErrorCount()); @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) target.get("spam"); @@ -608,8 +608,8 @@ public class RelaxedDataBinderTests { } - public static class RequiredKeysValidator implements - ConstraintValidator<RequiredKeys, Map<String, Object>> { + public static class RequiredKeysValidator + implements ConstraintValidator<RequiredKeys, Map<String, Object>> { private String[] fields; diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java index d4271e67a3..924cfc1400 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java @@ -58,8 +58,8 @@ public class RelaxedPropertyResolverTests { this.source.put("myobject", "object"); this.source.put("myInteger", 123); this.source.put("myClass", "java.lang.String"); - this.environment.getPropertySources().addFirst( - new MapPropertySource("test", this.source)); + this.environment.getPropertySources() + .addFirst(new MapPropertySource("test", this.source)); this.resolver = new RelaxedPropertyResolver(this.environment); } diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java index f9cc871364..c7540eaaf1 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java @@ -87,8 +87,8 @@ public class YamlConfigurationFactoryTests { @Test(expected = BindException.class) public void missingPropertyCausesValidationError() throws Exception { - this.validator = new SpringValidatorAdapter(Validation - .buildDefaultValidatorFactory().getValidator()); + this.validator = new SpringValidatorAdapter( + Validation.buildDefaultValidatorFactory().getValidator()); createFoo("bar: blah"); } diff --git a/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java b/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java index 98e400aa7b..7d91196bc4 100644 --- a/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java @@ -60,9 +60,8 @@ public class SpringApplicationBuilderTests { @Test public void profileAndProperties() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder() - .sources(ExampleConfig.class) - .contextClass(StaticApplicationContext.class).profiles("foo") - .properties("foo=bar"); + .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) + .profiles("foo").properties("foo=bar"); this.context = application.run(); assertThat(this.context, is(instanceOf(StaticApplicationContext.class))); assertThat(this.context.getEnvironment().getProperty("foo"), @@ -73,8 +72,7 @@ public class SpringApplicationBuilderTests { @Test public void propertiesAsMap() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder() - .sources(ExampleConfig.class) - .contextClass(StaticApplicationContext.class) + .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) .properties(Collections.<String, Object>singletonMap("bar", "foo")); this.context = application.run(); assertThat(this.context.getEnvironment().getProperty("bar"), is(equalTo("foo"))); @@ -83,19 +81,18 @@ public class SpringApplicationBuilderTests { @Test public void propertiesAsProperties() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder() - .sources(ExampleConfig.class) - .contextClass(StaticApplicationContext.class) - .properties( - StringUtils.splitArrayElementsIntoProperties( - new String[] { "bar=foo" }, "=")); + .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) + .properties(StringUtils.splitArrayElementsIntoProperties( + new String[] { "bar=foo" }, "=")); this.context = application.run(); assertThat(this.context.getEnvironment().getProperty("bar"), is(equalTo("foo"))); } @Test public void specificApplicationContextClass() throws Exception { - SpringApplicationBuilder application = new SpringApplicationBuilder().sources( - ExampleConfig.class).contextClass(StaticApplicationContext.class); + SpringApplicationBuilder application = new SpringApplicationBuilder() + .sources(ExampleConfig.class) + .contextClass(StaticApplicationContext.class); this.context = application.run(); assertThat(this.context, is(instanceOf(StaticApplicationContext.class))); } @@ -106,8 +103,8 @@ public class SpringApplicationBuilderTests { ChildConfig.class).contextClass(SpyApplicationContext.class); application.parent(ExampleConfig.class); this.context = application.run(); - verify(((SpyApplicationContext) this.context).getApplicationContext()).setParent( - any(ApplicationContext.class)); + verify(((SpyApplicationContext) this.context).getApplicationContext()) + .setParent(any(ApplicationContext.class)); assertThat(((SpyApplicationContext) this.context).getRegisteredShutdownHook(), equalTo(false)); } @@ -116,11 +113,11 @@ public class SpringApplicationBuilderTests { public void parentContextCreationWithChildShutdown() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ChildConfig.class).contextClass(SpyApplicationContext.class) - .registerShutdownHook(true); + .registerShutdownHook(true); application.parent(ExampleConfig.class); this.context = application.run(); - verify(((SpyApplicationContext) this.context).getApplicationContext()).setParent( - any(ApplicationContext.class)); + verify(((SpyApplicationContext) this.context).getApplicationContext()) + .setParent(any(ApplicationContext.class)); assertThat(((SpyApplicationContext) this.context).getRegisteredShutdownHook(), equalTo(true)); } @@ -129,8 +126,8 @@ public class SpringApplicationBuilderTests { public void contextWithClassLoader() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).contextClass(SpyApplicationContext.class); - ClassLoader classLoader = new URLClassLoader(new URL[0], getClass() - .getClassLoader()); + ClassLoader classLoader = new URLClassLoader(new URL[0], + getClass().getClassLoader()); application.resourceLoader(new DefaultResourceLoader(classLoader)); this.context = application.run(); assertThat(((SpyApplicationContext) this.context).getClassLoader(), @@ -141,8 +138,8 @@ public class SpringApplicationBuilderTests { public void parentContextWithClassLoader() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ChildConfig.class).contextClass(SpyApplicationContext.class); - ClassLoader classLoader = new URLClassLoader(new URL[0], getClass() - .getClassLoader()); + ClassLoader classLoader = new URLClassLoader(new URL[0], + getClass().getClassLoader()); application.resourceLoader(new DefaultResourceLoader(classLoader)); application.parent(ExampleConfig.class); this.context = application.run(); @@ -156,8 +153,8 @@ public class SpringApplicationBuilderTests { ExampleConfig.class).child(ChildConfig.class); application.contextClass(SpyApplicationContext.class); this.context = application.run(); - verify(((SpyApplicationContext) this.context).getApplicationContext()).setParent( - any(ApplicationContext.class)); + verify(((SpyApplicationContext) this.context).getApplicationContext()) + .setParent(any(ApplicationContext.class)); assertThat(((SpyApplicationContext) this.context).getRegisteredShutdownHook(), equalTo(false)); } @@ -166,7 +163,7 @@ public class SpringApplicationBuilderTests { public void parentFirstCreationWithProfileAndDefaultArgs() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).profiles("node").properties("transport=redis") - .child(ChildConfig.class).web(false); + .child(ChildConfig.class).web(false); this.context = application.run(); assertThat(this.context.getEnvironment().acceptsProfiles("node"), is(true)); assertThat(this.context.getEnvironment().getProperty("transport"), @@ -183,7 +180,7 @@ public class SpringApplicationBuilderTests { public void parentFirstWithDifferentProfile() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).profiles("node").properties("transport=redis") - .child(ChildConfig.class).profiles("admin").web(false); + .child(ChildConfig.class).profiles("admin").web(false); this.context = application.run(); assertThat(this.context.getEnvironment().acceptsProfiles("node", "admin"), is(true)); @@ -201,9 +198,8 @@ public class SpringApplicationBuilderTests { this.context = application.run(); assertThat(this.context.getEnvironment().acceptsProfiles("node", "admin"), is(true)); - assertThat( - this.context.getParent().getEnvironment() - .acceptsProfiles("node", "parent"), is(true)); + assertThat(this.context.getParent().getEnvironment().acceptsProfiles("node", + "parent"), is(true)); assertThat(this.context.getParent().getEnvironment().acceptsProfiles("admin"), is(false)); } @@ -212,8 +208,8 @@ public class SpringApplicationBuilderTests { public void parentFirstWithDifferentProfileAndExplicitEnvironment() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).environment(new StandardEnvironment()) - .profiles("node").properties("transport=redis").child(ChildConfig.class) - .profiles("admin").web(false); + .profiles("node").properties("transport=redis") + .child(ChildConfig.class).profiles("admin").web(false); this.context = application.run(); assertThat(this.context.getEnvironment().acceptsProfiles("node", "admin"), is(true)); @@ -230,8 +226,8 @@ public class SpringApplicationBuilderTests { application.parent(ExampleConfig.class); application.contextClass(SpyApplicationContext.class); this.context = application.run(); - verify(((SpyApplicationContext) this.context).getApplicationContext()).setParent( - any(ApplicationContext.class)); + verify(((SpyApplicationContext) this.context).getApplicationContext()) + .setParent(any(ApplicationContext.class)); } @Test @@ -254,12 +250,12 @@ public class SpringApplicationBuilderTests { public void initializersIncludeDefaults() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).web(false).initializers( - new ApplicationContextInitializer<ConfigurableApplicationContext>() { - @Override - public void initialize( - ConfigurableApplicationContext applicationContext) { - } - }); + new ApplicationContextInitializer<ConfigurableApplicationContext>() { + @Override + public void initialize( + ConfigurableApplicationContext applicationContext) { + } + }); this.context = application.run(); assertEquals(4, application.application().getInitializers().size()); } @@ -276,7 +272,8 @@ public class SpringApplicationBuilderTests { public static class SpyApplicationContext extends AnnotationConfigApplicationContext { - private final ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext()); + private final ConfigurableApplicationContext applicationContext = spy( + new AnnotationConfigApplicationContext()); private ResourceLoader resourceLoader; diff --git a/spring-boot/src/test/java/org/springframework/boot/cloudfoundry/VcapApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/cloudfoundry/VcapApplicationListenerTests.java index 74b9a75c2f..c002f56af2 100644 --- a/spring-boot/src/test/java/org/springframework/boot/cloudfoundry/VcapApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/cloudfoundry/VcapApplicationListenerTests.java @@ -42,21 +42,19 @@ public class VcapApplicationListenerTests { @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.onApplicationEvent(this.event); assertEquals("bb7935245adf3e650dfb7c58a06e9ece", this.context.getEnvironment() .getProperty("vcap.application.instance_id")); @@ -64,10 +62,8 @@ public class VcapApplicationListenerTests { @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.onApplicationEvent(this.event); assertEquals("foo.cfapps.io", this.context.getEnvironment().getProperty("vcap.application.uris[0]")); @@ -82,39 +78,35 @@ public class VcapApplicationListenerTests { @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.onApplicationEvent(this.event); 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.onApplicationEvent(this.event); assertEquals("mysql", getProperty("vcap.services.mysql.name")); assertEquals("3306", getProperty("vcap.services.mysql.credentials.port")); @@ -124,17 +116,15 @@ public class VcapApplicationListenerTests { @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.onApplicationEvent(this.event); 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/ConfigurationWarningsApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java index 2ec5ee5e53..a1e26f7558 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java @@ -106,8 +106,8 @@ public class ConfigurationWarningsApplicationContextInitializerTests { /** * Testable version of {@link ConfigurationWarningsApplicationContextInitializer}. */ - public static class TestConfigurationWarningsApplicationContextInitializer extends - ConfigurationWarningsApplicationContextInitializer { + public static class TestConfigurationWarningsApplicationContextInitializer + extends ConfigurationWarningsApplicationContextInitializer { @Override protected Check[] getChecks() { @@ -120,8 +120,8 @@ public class ConfigurationWarningsApplicationContextInitializerTests { * Testable ComponentScanDefaultPackageCheck that doesn't need to use the default * package. */ - static class TestComponentScanDefaultPackageCheck extends - ComponentScanDefaultPackageCheck { + static class TestComponentScanDefaultPackageCheck + extends ComponentScanDefaultPackageCheck { @Override protected boolean isInDefaultPackage(String className) { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java index 23ac04f323..b508ae0090 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java @@ -137,21 +137,20 @@ public class ConfigFileApplicationListenerTests { EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:" + "classpath:enableprofile.properties,classpath:enableother.properties"); this.initializer.onApplicationEvent(this.event); - 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.onApplicationEvent(this.event); - 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) @@ -165,9 +164,8 @@ public class ConfigFileApplicationListenerTests { "spring.config.name:enabletwoprofiles", "spring.config.location:classpath:enableprofile.properties"); this.initializer.onApplicationEvent(this.event); - 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) @@ -208,10 +206,10 @@ public class ConfigFileApplicationListenerTests { @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.onApplicationEvent(this.event); String property = this.environment.getProperty("the.property"); assertThat(property, equalTo("frompropertiesfile")); @@ -264,12 +262,9 @@ public class ConfigFileApplicationListenerTests { @Test public void defaultPropertyAsFallback() throws Exception { - this.event - .getEnvironment() - .getPropertySources() - .addLast( - new MapPropertySource("defaultProperties", Collections - .singletonMap("my.fallback", (Object) "foo"))); + this.event.getEnvironment().getPropertySources() + .addLast(new MapPropertySource("defaultProperties", + Collections.singletonMap("my.fallback", (Object) "foo"))); this.initializer.onApplicationEvent(this.event); String property = this.environment.getProperty("my.fallback"); assertThat(property, equalTo("foo")); @@ -277,13 +272,9 @@ public class ConfigFileApplicationListenerTests { @Test public void defaultPropertyAsFallbackDuringFileParsing() throws Exception { - this.event - .getEnvironment() - .getPropertySources() - .addLast( - new MapPropertySource("defaultProperties", Collections - .singletonMap("spring.config.name", - (Object) "testproperties"))); + this.event.getEnvironment().getPropertySources() + .addLast(new MapPropertySource("defaultProperties", Collections + .singletonMap("spring.config.name", (Object) "testproperties"))); this.initializer.onApplicationEvent(this.event); String property = this.environment.getProperty("the.property"); assertThat(property, equalTo("frompropertiesfile")); @@ -375,8 +366,8 @@ public class ConfigFileApplicationListenerTests { public void yamlSetsProfiles() throws Exception { this.initializer.setSearchNames("testsetprofiles"); this.initializer.onApplicationEvent(this.event); - 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")); @@ -397,8 +388,7 @@ public class ConfigFileApplicationListenerTests { names.add(source.getName()); } } - assertThat( - names, + assertThat(names, contains("applicationConfig: [classpath:/testsetprofiles.yml]#dev", "applicationConfig: [classpath:/testsetprofiles.yml]")); } @@ -409,7 +399,8 @@ public class ConfigFileApplicationListenerTests { "spring.profiles.active:prod"); this.initializer.setSearchNames("testsetprofiles"); this.initializer.onApplicationEvent(this.event); - assertThat(this.environment.getActiveProfiles(), equalTo(new String[] { "prod" })); + assertThat(this.environment.getActiveProfiles(), + equalTo(new String[] { "prod" })); } @Test @@ -425,45 +416,45 @@ public class ConfigFileApplicationListenerTests { @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.onApplicationEvent(this.event); 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.onApplicationEvent(this.event); - 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.onApplicationEvent(this.event); - 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.onApplicationEvent(this.event); assertThat(this.environment, containsPropertySource("applicationConfig: [file:" + location.replace(File.separatorChar, '/') + "]")); @@ -476,9 +467,8 @@ public class ConfigFileApplicationListenerTests { 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(); } @@ -493,9 +483,8 @@ public class ConfigFileApplicationListenerTests { 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(); } @@ -520,11 +509,10 @@ public class ConfigFileApplicationListenerTests { .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(); } @@ -536,8 +524,8 @@ public class ConfigFileApplicationListenerTests { 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(); } @@ -549,9 +537,8 @@ public class ConfigFileApplicationListenerTests { 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(); } @@ -628,8 +615,8 @@ public class ConfigFileApplicationListenerTests { 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); } }; @@ -640,15 +627,15 @@ public class ConfigFileApplicationListenerTests { return new TypeSafeDiagnosingMatcher<ConfigurableEnvironment>() { @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/config/DelegatingApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java index fd32bb6122..481b92e4c8 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java @@ -78,8 +78,8 @@ public class DelegatingApplicationContextInitializerTests { @Test public void notAnInitializerClass() throws Exception { StaticApplicationContext context = new StaticApplicationContext(); - EnvironmentTestUtils.addEnvironment(context, "context.initializer.classes:" - + Object.class.getName()); + EnvironmentTestUtils.addEnvironment(context, + "context.initializer.classes:" + Object.class.getName()); this.thrown.expect(IllegalArgumentException.class); this.initializer.initialize(context); } @@ -87,16 +87,16 @@ public class DelegatingApplicationContextInitializerTests { @Test public void genericNotSuitable() throws Exception { StaticApplicationContext context = new StaticApplicationContext(); - EnvironmentTestUtils.addEnvironment(context, "context.initializer.classes:" - + NotSuitableInit.class.getName()); + EnvironmentTestUtils.addEnvironment(context, + "context.initializer.classes:" + NotSuitableInit.class.getName()); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("generic parameter"); this.initializer.initialize(context); } @Order(Ordered.HIGHEST_PRECEDENCE) - private static class MockInitA implements - ApplicationContextInitializer<ConfigurableApplicationContext> { + private static class MockInitA + implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext applicationContext) { applicationContext.getBeanFactory().registerSingleton("a", "a"); @@ -104,8 +104,8 @@ public class DelegatingApplicationContextInitializerTests { } @Order(Ordered.LOWEST_PRECEDENCE) - private static class MockInitB implements - ApplicationContextInitializer<ConfigurableApplicationContext> { + private static class MockInitB + implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext applicationContext) { assertThat(applicationContext.getBeanFactory().getSingleton("a"), @@ -114,8 +114,8 @@ public class DelegatingApplicationContextInitializerTests { } } - private static class NotSuitableInit implements - ApplicationContextInitializer<ConfigurableWebApplicationContext> { + private static class NotSuitableInit + implements ApplicationContextInitializer<ConfigurableWebApplicationContext> { @Override public void initialize(ConfigurableWebApplicationContext applicationContext) { } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java index 4480ec5eb7..d0fd06f1b6 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java @@ -62,8 +62,10 @@ public class DelegatingApplicationListenerTests { new SpringApplication(), new String[0], this.context.getEnvironment())); this.context.getBeanFactory().registerSingleton("testListener", this.listener); this.context.refresh(); - assertThat(this.context.getBeanFactory().getSingleton("a"), equalTo((Object) "a")); - assertThat(this.context.getBeanFactory().getSingleton("b"), equalTo((Object) "b")); + assertThat(this.context.getBeanFactory().getSingleton("a"), + equalTo((Object) "a")); + assertThat(this.context.getBeanFactory().getSingleton("b"), + equalTo((Object) "b")); } @Test 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 fd6bd4d54c..db955bbd59 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 @@ -125,8 +125,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 @@ -155,9 +155,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]")); } @@ -241,8 +240,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("/"); } @@ -295,7 +294,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(); } @@ -303,8 +303,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")); @@ -321,12 +321,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( @@ -339,12 +339,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( @@ -360,8 +360,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( @@ -422,12 +422,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( @@ -440,7 +441,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()); @@ -463,12 +465,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( @@ -540,8 +543,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { } protected String getResponse(String url, - HttpComponentsClientHttpRequestFactory requestFactory) throws IOException, - URISyntaxException { + HttpComponentsClientHttpRequestFactory requestFactory) + throws IOException, URISyntaxException { ClientHttpResponse response = getClientResponse(url, requestFactory); try { return StreamUtils.copyToString(response.getBody(), Charset.forName("UTF-8")); @@ -551,14 +554,14 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { } } - protected ClientHttpResponse getClientResponse(String url) throws IOException, - URISyntaxException { + protected ClientHttpResponse getClientResponse(String url) + throws IOException, URISyntaxException { return getClientResponse(url, new HttpComponentsClientHttpRequestFactory()); } protected ClientHttpResponse getClientResponse(String url, - HttpComponentsClientHttpRequestFactory requestFactory) throws IOException, - URISyntaxException { + HttpComponentsClientHttpRequestFactory requestFactory) + throws IOException, URISyntaxException { ClientHttpRequest request = requestFactory.createRequest(new URI(url), HttpMethod.GET); ClientHttpResponse response = request.execute(); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java index 48d7ab2fea..9a66b626bf 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java @@ -91,8 +91,8 @@ public class AnnotationConfigEmbeddedWebApplicationContextTests { @Test public void scanAndRefresh() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext(); - this.context.scan(ExampleEmbeddedWebApplicationConfiguration.class.getPackage() - .getName()); + this.context.scan( + ExampleEmbeddedWebApplicationConfiguration.class.getPackage().getName()); this.context.refresh(); verifyContext(); } @@ -152,8 +152,8 @@ public class AnnotationConfigEmbeddedWebApplicationContextTests { @Configuration @EnableWebMvc - public static class ServletContextAwareEmbeddedConfiguration implements - ServletContextAware { + public static class ServletContextAwareEmbeddedConfiguration + implements ServletContextAware { private ServletContext servletContext; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java index 1a7be91bf4..09e927cb74 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java @@ -95,9 +95,10 @@ public class EmbeddedServletContainerMvcIntegrationTests { private void doTest(AnnotationConfigEmbeddedWebApplicationContext context, String resourcePath) throws Exception { SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory(); - ClientHttpRequest request = clientHttpRequestFactory.createRequest(new URI( - "http://localhost:" + context.getEmbeddedServletContainer().getPort() - + resourcePath), HttpMethod.GET); + ClientHttpRequest request = clientHttpRequestFactory.createRequest( + new URI("http://localhost:" + + context.getEmbeddedServletContainer().getPort() + resourcePath), + HttpMethod.GET); ClientHttpResponse response = request.execute(); try { String actual = StreamUtils.copyToString(response.getBody(), diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java index 68b7e4c39e..9f79be5b76 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java @@ -106,15 +106,13 @@ public class EmbeddedWebApplicationContextTests { // Ensure WebApplicationContextUtils.registerWebApplicationScopes was called assertThat( - this.context.getBeanFactory().getRegisteredScope( - WebApplicationContext.SCOPE_SESSION), + this.context.getBeanFactory() + .getRegisteredScope(WebApplicationContext.SCOPE_SESSION), instanceOf(SessionScope.class)); // Ensure WebApplicationContextUtils.registerEnvironmentBeans was called - assertThat( - this.context - .containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME), - equalTo(true)); + assertThat(this.context.containsBean( + WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME), equalTo(true)); } @Test @@ -134,11 +132,11 @@ public class EmbeddedWebApplicationContextTests { @Test public void containerEventPublished() throws Exception { addEmbeddedServletContainerFactoryBean(); - this.context.registerBeanDefinition("listener", new RootBeanDefinition( - MockListener.class)); + this.context.registerBeanDefinition("listener", + new RootBeanDefinition(MockListener.class)); this.context.refresh(); - EmbeddedServletContainerInitializedEvent event = this.context.getBean( - MockListener.class).getEvent(); + EmbeddedServletContainerInitializedEvent event = this.context + .getBean(MockListener.class).getEvent(); assertNotNull(event); assertTrue(event.getSource().getPort() >= 0); assertEquals(this.context, event.getApplicationContext()); @@ -236,10 +234,10 @@ public class EmbeddedWebApplicationContextTests { InOrder ordered = inOrder(servletContext); ordered.verify(servletContext).addServlet("servletBean1", servlet1); ordered.verify(servletContext).addServlet("servletBean2", servlet2); - verify(escf.getRegisteredServlet(0).getRegistration()).addMapping( - "/servletBean1/"); - verify(escf.getRegisteredServlet(1).getRegistration()).addMapping( - "/servletBean2/"); + verify(escf.getRegisteredServlet(0).getRegistration()) + .addMapping("/servletBean1/"); + verify(escf.getRegisteredServlet(1).getRegistration()) + .addMapping("/servletBean2/"); } @Test @@ -252,8 +250,8 @@ public class EmbeddedWebApplicationContextTests { withSettings().extraInterfaces(Ordered.class)); given(((Ordered) servlet2).getOrder()).willReturn(2); this.context.registerBeanDefinition("servletBean2", beanDefinition(servlet2)); - this.context - .registerBeanDefinition("dispatcherServlet", beanDefinition(servlet1)); + this.context.registerBeanDefinition("dispatcherServlet", + beanDefinition(servlet1)); this.context.refresh(); MockEmbeddedServletContainerFactory escf = getEmbeddedServletContainerFactory(); ServletContext servletContext = escf.getServletContext(); @@ -261,17 +259,19 @@ public class EmbeddedWebApplicationContextTests { ordered.verify(servletContext).addServlet("dispatcherServlet", servlet1); ordered.verify(servletContext).addServlet("servletBean2", servlet2); verify(escf.getRegisteredServlet(0).getRegistration()).addMapping("/"); - verify(escf.getRegisteredServlet(1).getRegistration()).addMapping( - "/servletBean2/"); + verify(escf.getRegisteredServlet(1).getRegistration()) + .addMapping("/servletBean2/"); } @Test public void servletAndFilterBeans() throws Exception { addEmbeddedServletContainerFactoryBean(); Servlet servlet = mock(Servlet.class); - Filter filter1 = mock(Filter.class, withSettings().extraInterfaces(Ordered.class)); + Filter filter1 = mock(Filter.class, + withSettings().extraInterfaces(Ordered.class)); given(((Ordered) filter1).getOrder()).willReturn(1); - Filter filter2 = mock(Filter.class, withSettings().extraInterfaces(Ordered.class)); + Filter filter2 = mock(Filter.class, + withSettings().extraInterfaces(Ordered.class)); given(((Ordered) filter2).getOrder()).willReturn(2); this.context.registerBeanDefinition("servletBean", beanDefinition(servlet)); this.context.registerBeanDefinition("filterBean2", beanDefinition(filter2)); @@ -364,7 +364,8 @@ public class EmbeddedWebApplicationContextTests { addEmbeddedServletContainerFactoryBean(); Servlet servlet = mock(Servlet.class); Filter filter = mock(Filter.class); - ServletRegistrationBean initializer = new ServletRegistrationBean(servlet, "/foo"); + ServletRegistrationBean initializer = new ServletRegistrationBean(servlet, + "/foo"); this.context.registerBeanDefinition("initializerBean", beanDefinition(initializer)); this.context.registerBeanDefinition("servletBean", beanDefinition(servlet)); @@ -424,8 +425,7 @@ public class EmbeddedWebApplicationContextTests { sameInstance(scope)); assertThat(factory.getRegisteredScope(WebApplicationContext.SCOPE_SESSION), sameInstance(scope)); - assertThat( - factory.getRegisteredScope(WebApplicationContext.SCOPE_GLOBAL_SESSION), + assertThat(factory.getRegisteredScope(WebApplicationContext.SCOPE_GLOBAL_SESSION), sameInstance(scope)); } @@ -452,8 +452,8 @@ public class EmbeddedWebApplicationContextTests { return object; } - public static class MockListener implements - ApplicationListener<EmbeddedServletContainerInitializedEvent> { + public static class MockListener + implements ApplicationListener<EmbeddedServletContainerInitializedEvent> { private EmbeddedServletContainerInitializedEvent event; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/FilterRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/FilterRegistrationBeanTests.java index 3522082d02..2dc234fa3b 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/FilterRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/FilterRegistrationBeanTests.java @@ -88,8 +88,8 @@ public class FilterRegistrationBeanTests { bean.addUrlPatterns("/c"); bean.setServletNames(new LinkedHashSet<String>(Arrays.asList("s1", "s2"))); bean.addServletNames("s3"); - bean.setServletRegistrationBeans(Collections - .singleton(mockServletRegistation("s4"))); + bean.setServletRegistrationBeans( + Collections.singleton(mockServletRegistation("s4"))); bean.addServletRegistrationBeans(mockServletRegistation("s5")); bean.setMatchAfter(true); bean.onStartup(this.servletContext); @@ -99,13 +99,12 @@ public class FilterRegistrationBeanTests { expectedInitParameters.put("a", "b"); expectedInitParameters.put("c", "d"); verify(this.registration).setInitParameters(expectedInitParameters); - verify(this.registration) - .addMappingForUrlPatterns( - FilterRegistrationBean.NON_ASYNC_DISPATCHER_TYPES, true, "/a", - "/b", "/c"); + verify(this.registration).addMappingForUrlPatterns( + FilterRegistrationBean.NON_ASYNC_DISPATCHER_TYPES, true, "/a", "/b", + "/c"); verify(this.registration).addMappingForServletNames( - FilterRegistrationBean.NON_ASYNC_DISPATCHER_TYPES, true, "s4", "s5", - "s1", "s2", "s3"); + FilterRegistrationBean.NON_ASYNC_DISPATCHER_TYPES, true, "s4", "s5", "s1", + "s2", "s3"); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java index 3309e7a1c1..6debacdb9f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java @@ -47,8 +47,8 @@ import static org.mockito.Mockito.spy; * @author Phillip Webb * @author Andy Wilkinson */ -public class MockEmbeddedServletContainerFactory extends - AbstractEmbeddedServletContainerFactory { +public class MockEmbeddedServletContainerFactory + extends AbstractEmbeddedServletContainerFactory { private MockEmbeddedServletContainer container; @@ -69,13 +69,13 @@ public class MockEmbeddedServletContainerFactory extends } public RegisteredServlet getRegisteredServlet(int index) { - return getContainer() == null ? null : getContainer().getRegisteredServlets() - .get(index); + return getContainer() == null ? null + : getContainer().getRegisteredServlets().get(index); } public RegisteredFilter getRegisteredFilter(int index) { - return getContainer() == null ? null : getContainer().getRegisteredFilters().get( - index); + return getContainer() == null ? null + : getContainer().getRegisteredFilters().get(index); } public static class MockEmbeddedServletContainer implements EmbeddedServletContainer { @@ -137,21 +137,21 @@ public class MockEmbeddedServletContainerFactory extends } }); - given(this.servletContext.getInitParameterNames()).willReturn( - Collections.enumeration(initParameters.keySet())); - given(this.servletContext.getInitParameter(anyString())).willAnswer( - new Answer<String>() { + given(this.servletContext.getInitParameterNames()) + .willReturn(Collections.enumeration(initParameters.keySet())); + given(this.servletContext.getInitParameter(anyString())) + .willAnswer(new Answer<String>() { @Override public String answer(InvocationOnMock invocation) throws Throwable { - return initParameters.get(invocation.getArgumentAt(0, - String.class)); + return initParameters + .get(invocation.getArgumentAt(0, String.class)); } }); given(this.servletContext.getAttributeNames()).willReturn( MockEmbeddedServletContainer.<String>emptyEnumeration()); - given(this.servletContext.getNamedDispatcher("default")).willReturn( - mock(RequestDispatcher.class)); + given(this.servletContext.getNamedDispatcher("default")) + .willReturn(mock(RequestDispatcher.class)); for (ServletContextInitializer initializer : this.initializers) { initializer.onStartup(this.servletContext); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockServlet.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockServlet.java index 43fce88d1c..941255cbce 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockServlet.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockServlet.java @@ -32,8 +32,8 @@ import javax.servlet.ServletResponse; public class MockServlet extends GenericServlet { @Override - public void service(ServletRequest req, ServletResponse res) throws ServletException, - IOException { + public void service(ServletRequest req, ServletResponse res) + throws ServletException, IOException { } } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java index 359d6bf7ed..24c58351fb 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java @@ -67,8 +67,8 @@ public class ServletListenerRegistrationBeanTests { this.listener); bean.setEnabled(false); bean.onStartup(this.servletContext); - verify(this.servletContext, times(0)).addListener( - any(ServletContextListener.class)); + verify(this.servletContext, times(0)) + .addListener(any(ServletContextListener.class)); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/XmlEmbeddedWebApplicationContextTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/XmlEmbeddedWebApplicationContextTests.java index 52e8e9a219..3267f182b5 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/XmlEmbeddedWebApplicationContextTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/XmlEmbeddedWebApplicationContextTests.java @@ -31,8 +31,7 @@ import static org.mockito.Mockito.verify; public class XmlEmbeddedWebApplicationContextTests { private static final String PATH = XmlEmbeddedWebApplicationContextTests.class - .getPackage().getName().replace(".", "/") - + "/"; + .getPackage().getName().replace(".", "/") + "/"; private static final String FILE = "exampleEmbeddedWebApplicationConfiguration.xml"; @@ -40,8 +39,8 @@ public class XmlEmbeddedWebApplicationContextTests { @Test public void createFromResource() throws Exception { - this.context = new XmlEmbeddedWebApplicationContext(new ClassPathResource(FILE, - getClass())); + this.context = new XmlEmbeddedWebApplicationContext( + new ClassPathResource(FILE, getClass())); verifyContext(); } 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 79d74a8a04..b271df9caf 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 @@ -46,8 +46,8 @@ import static org.mockito.Mockito.mock; * @author Dave Syer * @author Andy Wilkinson */ -public class JettyEmbeddedServletContainerFactoryTests extends - AbstractEmbeddedServletContainerFactoryTests { +public class JettyEmbeddedServletContainerFactoryTests + extends AbstractEmbeddedServletContainerFactoryTests { @Override protected JettyEmbeddedServletContainerFactory getFactory() { @@ -123,11 +123,12 @@ public class JettyEmbeddedServletContainerFactoryTests extends equalTo(new String[] { "ALPHA", "BRAVO", "CHARLIE" })); } - private void assertTimeout(JettyEmbeddedServletContainerFactory factory, int expected) { + private void assertTimeout(JettyEmbeddedServletContainerFactory factory, + int expected) { this.container = factory.getEmbeddedServletContainer(); JettyEmbeddedServletContainer jettyContainer = (JettyEmbeddedServletContainer) this.container; - Handler[] handlers = jettyContainer.getServer().getChildHandlersByClass( - WebAppContext.class); + Handler[] handlers = jettyContainer.getServer() + .getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) handlers[0]; int actual = webAppContext.getSessionHandler().getSessionManager() .getMaxInactiveInterval(); 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 b2bbcb4e11..d53555c862 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 @@ -59,8 +59,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() { @@ -310,7 +310,8 @@ public class TomcatEmbeddedServletContainerFactoryTests extends } - 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/UndertowEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java index ba5fc6d5c4..5bb5b2ebf7 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java @@ -45,8 +45,8 @@ import static org.mockito.Mockito.mock; * @author Ivan Sopov * @author Andy Wilkinson */ -public class UndertowEmbeddedServletContainerFactoryTests extends - AbstractEmbeddedServletContainerFactoryTests { +public class UndertowEmbeddedServletContainerFactoryTests + extends AbstractEmbeddedServletContainerFactoryTests { @Override protected UndertowEmbeddedServletContainerFactory getFactory() { @@ -57,8 +57,8 @@ public class UndertowEmbeddedServletContainerFactoryTests extends public void errorPage404() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/hello")); - this.container = factory.getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean(new ExampleServlet(), "/hello")); this.container.start(); assertThat(getResponse(getLocalUrl("/hello")), equalTo("Hello World")); assertThat(getResponse(getLocalUrl("/not-found")), equalTo("Hello World")); @@ -119,8 +119,8 @@ public class UndertowEmbeddedServletContainerFactoryTests extends for (int i = 0; i < customizers.length; i++) { customizers[i] = mock(UndertowDeploymentInfoCustomizer.class); } - factory.setDeploymentInfoCustomizers(Arrays - .asList(customizers[0], customizers[1])); + factory.setDeploymentInfoCustomizers( + Arrays.asList(customizers[0], customizers[1])); factory.addDeploymentInfoCustomizers(customizers[2], customizers[3]); this.container = factory.getEmbeddedServletContainer(); InOrder ordered = inOrder((Object[]) customizers); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java index f53d16cd8c..fc98331774 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java @@ -216,8 +216,9 @@ public class ConfigurationPropertiesBindingPostProcessorTests { EnvironmentTestUtils.addEnvironment(this.context, "fooValue:bar"); this.context.register(UnmergedCustomConfigurationLocation.class); this.context.refresh(); - assertThat(this.context.getBean(UnmergedCustomConfigurationLocation.class) - .getFoo(), equalTo("${fooValue}")); + assertThat( + this.context.getBean(UnmergedCustomConfigurationLocation.class).getFoo(), + equalTo("${fooValue}")); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java index a7e2f7ab79..8eaa186719 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java @@ -148,8 +148,8 @@ public class EnableConfigurationPropertiesTests { this.context.register(IgnoreNestedTestConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "name:foo", "nested.name:bar"); this.context.refresh(); - assertEquals(1, - this.context.getBeanNamesForType(IgnoreNestedTestProperties.class).length); + assertEquals(1, this.context + .getBeanNamesForType(IgnoreNestedTestProperties.class).length); assertEquals("foo", this.context.getBean(TestProperties.class).name); } @@ -166,10 +166,8 @@ public class EnableConfigurationPropertiesTests { this.context.register(NoExceptionIfInvalidTestConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "name:foo"); this.context.refresh(); - assertEquals( - 1, - this.context - .getBeanNamesForType(NoExceptionIfInvalidTestProperties.class).length); + assertEquals(1, this.context + .getBeanNamesForType(NoExceptionIfInvalidTestProperties.class).length); assertEquals("foo", this.context.getBean(TestProperties.class).name); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterIntegrationTests.java index 66a9a3bfdb..c7c1bb9777 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterIntegrationTests.java @@ -92,8 +92,8 @@ public class ErrorPageFilterIntegrationTests { String resourcePath, HttpStatus status) throws Exception { int port = context.getEmbeddedServletContainer().getPort(); TestRestTemplate template = new TestRestTemplate(); - ResponseEntity<String> entity = template.getForEntity(new URI("http://localhost:" - + port + resourcePath), String.class); + ResponseEntity<String> entity = template.getForEntity( + new URI("http://localhost:" + port + resourcePath), String.class); assertThat(entity.getBody(), equalTo("Hello World")); assertThat(entity.getStatusCode(), equalTo(status)); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java b/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java index 393889fa5e..67e43bc0f8 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java @@ -97,9 +97,8 @@ public class ErrorPageFilterTests { this.filter.doFilter(this.request, this.response, this.chain); assertThat(((HttpServletResponse) this.chain.getResponse()).getStatus(), equalTo(201)); - assertThat( - ((HttpServletResponse) ((HttpServletResponseWrapper) this.chain.getResponse()) - .getResponse()).getStatus(), equalTo(201)); + assertThat(((HttpServletResponse) ((HttpServletResponseWrapper) this.chain + .getResponse()).getResponse()).getStatus(), equalTo(201)); assertTrue(this.response.isCommitted()); } @@ -364,7 +363,8 @@ public class ErrorPageFilterTests { } @Test - public void responseIsCommitedWhenRequestIsAsyncAndStatusIs400Plus() throws Exception { + public void responseIsCommitedWhenRequestIsAsyncAndStatusIs400Plus() + throws Exception { this.filter.addErrorPages(new ErrorPage("/error")); this.request.setAsyncStarted(true); this.chain = new MockFilterChain() { @@ -443,8 +443,8 @@ public class ErrorPageFilterTests { } @Test - public void errorMessageForRequestWithoutPathInfo() throws IOException, - ServletException { + public void errorMessageForRequestWithoutPathInfo() + throws IOException, ServletException { this.request.setServletPath("/test"); this.filter.addErrorPages(new ErrorPage("/error")); this.chain = new MockFilterChain() { @@ -460,7 +460,8 @@ public class ErrorPageFilterTests { } @Test - public void errorMessageForRequestWithPathInfo() throws IOException, ServletException { + public void errorMessageForRequestWithPathInfo() + throws IOException, ServletException { this.request.setServletPath("/test"); this.request.setPathInfo("/alpha"); this.filter.addErrorPages(new ErrorPage("/error")); @@ -507,8 +508,8 @@ public class ErrorPageFilterTests { this.request.setAsyncStarted(true); DeferredResult<String> result = new DeferredResult<String>(); WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.request); - asyncManager.setAsyncWebRequest(new StandardServletAsyncWebRequest(this.request, - this.response)); + asyncManager.setAsyncWebRequest( + new StandardServletAsyncWebRequest(this.request, this.response)); asyncManager.startDeferredResultProcessing(result); } 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 643f970eb3..e0fa507a08 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,15 +117,16 @@ public class SpringBootServletInitializerTests { public class WithConfiguredSource extends MockSpringBootServletInitializer { @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + protected SpringApplicationBuilder configure( + SpringApplicationBuilder application) { return application.sources(Config.class); } } @Configuration - public class WithErrorPageFilterNotRegistered extends - MockSpringBootServletInitializer { + public class WithErrorPageFilterNotRegistered + extends MockSpringBootServletInitializer { public WithErrorPageFilterNotRegistered() { setRegisterErrorPageFilter(false); diff --git a/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java index 2f0287c110..10a502dfb5 100644 --- a/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java @@ -34,8 +34,8 @@ public class PropertiesPropertySourceLoaderTests { @Test public void getFileExtensions() throws Exception { - assertThat(this.loader.getFileExtensions(), equalTo(new String[] { "properties", - "xml" })); + assertThat(this.loader.getFileExtensions(), + equalTo(new String[] { "properties", "xml" })); } @Test @@ -47,8 +47,8 @@ public class PropertiesPropertySourceLoaderTests { @Test public void loadXml() throws Exception { - PropertySource<?> source = this.loader.load("test.xml", new ClassPathResource( - "test-xml.xml", getClass()), null); + PropertySource<?> source = this.loader.load("test.xml", + new ClassPathResource("test-xml.xml", getClass()), null); assertThat(source.getProperty("test"), equalTo((Object) "xml")); } diff --git a/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java index d8af41fefc..30552cb636 100644 --- a/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java @@ -42,7 +42,8 @@ public class YamlPropertySourceLoaderTests { @Test public void load() throws Exception { - ByteArrayResource resource = new ByteArrayResource("foo:\n bar: spam".getBytes()); + ByteArrayResource resource = new ByteArrayResource( + "foo:\n bar: spam".getBytes()); PropertySource<?> source = this.loader.load("resource", resource, null); assertNotNull(source); assertEquals("spam", source.getProperty("foo.bar")); diff --git a/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java b/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java index dba5286b2f..7c72d12247 100644 --- a/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java @@ -81,8 +81,8 @@ public abstract class AbstractJsonParserTests { @SuppressWarnings("unchecked") @Test public void testMapOfLists() { - Map<String, Object> map = this.parser - .parseMap("{\"foo\":[{\"foo\":\"bar\",\"spam\":1},{\"foo\":\"baz\",\"spam\":2}]}"); + Map<String, Object> map = this.parser.parseMap( + "{\"foo\":[{\"foo\":\"bar\",\"spam\":1},{\"foo\":\"baz\",\"spam\":2}]}"); assertEquals(1, map.size()); assertEquals(2, ((List<Object>) map.get("foo")).size()); } diff --git a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java index 61c35b15b2..a6325b2d0c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java @@ -35,7 +35,8 @@ public class AtomikosConnectionFactoryBeanTests { @Test public void beanMethods() throws Exception { - MockAtomikosConnectionFactoryBean bean = spy(new MockAtomikosConnectionFactoryBean()); + MockAtomikosConnectionFactoryBean bean = spy( + new MockAtomikosConnectionFactoryBean()); bean.setBeanName("bean"); bean.afterPropertiesSet(); assertThat(bean.getUniqueResourceName(), equalTo("bean")); @@ -46,8 +47,8 @@ public class AtomikosConnectionFactoryBeanTests { } @SuppressWarnings("serial") - private static class MockAtomikosConnectionFactoryBean extends - AtomikosConnectionFactoryBean { + private static class MockAtomikosConnectionFactoryBean + extends AtomikosConnectionFactoryBean { @Override public synchronized void init() throws JMSException { diff --git a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java index 485f46d953..750f0b0e30 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java @@ -61,8 +61,8 @@ public class AtomikosDependsOnBeanFactoryPostProcessorTests { assertTrue("No dependsOn expected for " + bean, expected.length == 0); return; } - HashSet<String> dependsOn = new HashSet<String>(Arrays.asList(definition - .getDependsOn())); + HashSet<String> dependsOn = new HashSet<String>( + Arrays.asList(definition.getDependsOn())); assertThat(dependsOn, equalTo(new HashSet<String>(Arrays.asList(expected)))); } diff --git a/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java b/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java index 8add298a7e..5f0b3deee9 100644 --- a/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java @@ -143,7 +143,8 @@ public class CommonsLoggingLiquibaseLoggerTests { verify(this.delegate, never()).error("severe"); } - private class MockCommonsLoggingLiquibaseLogger extends CommonsLoggingLiquibaseLogger { + private class MockCommonsLoggingLiquibaseLogger + extends CommonsLoggingLiquibaseLogger { @Override protected Log createLogger(String name) { diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java index bb52c7a2df..cd9add0001 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java @@ -82,7 +82,8 @@ public class LogFileTests { Map<String, Object> properties = new LinkedHashMap<String, Object>(); properties.put("logging.file", file); properties.put("logging.path", path); - PropertySource<?> propertySource = new MapPropertySource("properties", properties); + PropertySource<?> propertySource = new MapPropertySource("properties", + properties); MutablePropertySources propertySources = new MutablePropertySources(); propertySources.addFirst(propertySource); return new PropertySourcesPropertyResolver(propertySources); 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 e413306793..3fe23490fb 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 @@ -74,8 +74,8 @@ public class LoggingApplicationListenerTests { public void init() throws SecurityException, IOException { LogManager.getLogManager().readConfiguration( JavaLoggingSystem.class.getResourceAsStream("logging.properties")); - this.initializer.onApplicationEvent(new ApplicationStartedEvent( - new SpringApplication(), NO_ARGS)); + this.initializer.onApplicationEvent( + new ApplicationStartedEvent(new SpringApplication(), NO_ARGS)); new File("target/foo.log").delete(); new File(tmpDir() + "/spring.log").delete(); } @@ -91,8 +91,8 @@ public class LoggingApplicationListenerTests { } private String tmpDir() { - String path = this.context.getEnvironment().resolvePlaceholders( - "${java.io.tmpdir}"); + String path = this.context.getEnvironment() + .resolvePlaceholders("${java.io.tmpdir}"); path = path.replace("\\", "/"); if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); @@ -121,7 +121,8 @@ public class LoggingApplicationListenerTests { String output = this.outputCapture.toString().trim(); assertTrue("Wrong output:\n" + output, output.contains("Hello world")); assertFalse("Wrong output:\n" + output, output.contains("???")); - assertTrue("Wrong output:\n" + output, output.startsWith("LOG_FILE_IS_UNDEFINED")); + assertTrue("Wrong output:\n" + output, + output.startsWith("LOG_FILE_IS_UNDEFINED")); assertTrue("Wrong output:\n" + output, output.endsWith("BOOTBOOT")); } @@ -173,7 +174,8 @@ public class LoggingApplicationListenerTests { Log logger = LogFactory.getLog(LoggingApplicationListenerTests.class); logger.info("Hello world"); String output = this.outputCapture.toString().trim(); - assertTrue("Wrong output:\n" + output, output.startsWith("target/foo/spring.log")); + assertTrue("Wrong output:\n" + output, + output.startsWith("target/foo/spring.log")); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java index 280cc13b2f..6294ff1d28 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java @@ -55,8 +55,8 @@ public class JavaLoggerSystemTests 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,10 +120,8 @@ public class JavaLoggerSystemTests extends AbstractLoggingSystemTests { public void testSystemPropertyInitializesFormat() throws Exception { System.setProperty("PID", "1234"); this.loggingSystem.beforeInitialize(); - this.loggingSystem.initialize( - "classpath:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "logging.properties"), null); + this.loggingSystem.initialize("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/log4j/Log4JLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java index af39dca37d..e6e0359a30 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java @@ -48,8 +48,8 @@ public class Log4JLoggingSystemTests extends AbstractLoggingSystemTests { @Rule public OutputCapture output = new OutputCapture(); - private final Log4JLoggingSystem loggingSystem = new Log4JLoggingSystem(getClass() - .getClassLoader()); + private final Log4JLoggingSystem loggingSystem = new Log4JLoggingSystem( + getClass().getClassLoader()); private Log4JLogger logger; 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 cac50ae690..fc06f5350a 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 @@ -166,8 +166,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { this.loggingSystem.availableClasses( "com.fasterxml.jackson.dataformat.yaml.YAMLParser", ObjectMapper.class.getName()); - assertThat( - this.loggingSystem.getStandardConfigLocations(), + assertThat(this.loggingSystem.getStandardConfigLocations(), is(arrayContaining("log4j2.yaml", "log4j2.yml", "log4j2.json", "log4j2.jsn", "log4j2.xml"))); } diff --git a/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityScanTests.java b/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityScanTests.java index c2773c7dd8..40699c83e8 100644 --- a/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityScanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/orm/jpa/EntityScanTests.java @@ -117,8 +117,9 @@ public class EntityScanTests { } private void assertSetPackagesToScan(String... expected) { - String[] actual = this.context.getBean( - TestLocalContainerEntityManagerFactoryBean.class).getPackagesToScan(); + String[] actual = this.context + .getBean(TestLocalContainerEntityManagerFactoryBean.class) + .getPackagesToScan(); assertThat(actual, equalTo(expected)); } @@ -177,8 +178,8 @@ public class EntityScanTests { return new BeanPostProcessor() { @Override - public Object postProcessBeforeInitialization(Object bean, String beanName) - throws BeansException { + public Object postProcessBeforeInitialization(Object bean, + String beanName) throws BeansException { return bean; } @@ -202,8 +203,8 @@ public class EntityScanTests { } - private static class TestLocalContainerEntityManagerFactoryBean extends - LocalContainerEntityManagerFactoryBean { + private static class TestLocalContainerEntityManagerFactoryBean + extends LocalContainerEntityManagerFactoryBean { private String[] packagesToScan; diff --git a/spring-boot/src/test/java/org/springframework/boot/test/AbstractConfigurationClassTests.java b/spring-boot/src/test/java/org/springframework/boot/test/AbstractConfigurationClassTests.java index 7ab38c8e71..bb63aada8d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/AbstractConfigurationClassTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/AbstractConfigurationClassTests.java @@ -72,8 +72,8 @@ public abstract class AbstractConfigurationClassTests { .getMetadataReader(resource); AnnotationMetadata annotationMetadata = metadataReader .getAnnotationMetadata(); - if (annotationMetadata.getAnnotationTypes().contains( - Configuration.class.getName())) { + if (annotationMetadata.getAnnotationTypes() + .contains(Configuration.class.getName())) { configurationClasses.add(annotationMetadata); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/test/ApplicationContextTestUtilsTests.java b/spring-boot/src/test/java/org/springframework/boot/test/ApplicationContextTestUtilsTests.java index 3b2f22e5fc..4a795fb8dc 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/ApplicationContextTestUtilsTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/ApplicationContextTestUtilsTests.java @@ -45,7 +45,8 @@ public class ApplicationContextTestUtilsTests { @Test public void closeContextAndParent() { ConfigurableApplicationContext mock = mock(ConfigurableApplicationContext.class); - ConfigurableApplicationContext parent = mock(ConfigurableApplicationContext.class); + ConfigurableApplicationContext parent = mock( + ConfigurableApplicationContext.class); given(mock.getParent()).willReturn(parent); given(parent.getParent()).willReturn(null); ApplicationContextTestUtils.closeAll(mock); diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoaderTests.java index 8812e12a29..cbd32fd4c6 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoaderTests.java @@ -65,7 +65,8 @@ public class SpringApplicationContextLoaderTests { @Test public void environmentPropertiesAnotherSeparatorInValue() throws Exception { - Map<String, Object> config = getEnvironmentProperties(AnotherSeparatorInValue.class); + Map<String, Object> config = getEnvironmentProperties( + AnotherSeparatorInValue.class); assertKey(config, "key", "my:Value"); assertKey(config, "anotherKey", "another=Value"); } @@ -77,8 +78,8 @@ public class SpringApplicationContextLoaderTests { new IntegrationTestPropertiesListener().prepareTestInstance(context); MergedContextConfiguration config = (MergedContextConfiguration) ReflectionTestUtils .getField(context, "mergedContextConfiguration"); - return this.loader.extractEnvironmentProperties(config - .getPropertySourceProperties()); + return this.loader + .extractEnvironmentProperties(config.getPropertySourceProperties()); } private void assertKey(Map<String, Object> actual, String key, Object value) { diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java index 1cf9a76742..9b3558b0b1 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java @@ -57,8 +57,8 @@ public class SpringApplicationIntegrationTestTests { public void runAndTestHttpEndpoint() { assertNotEquals(8080, this.port); assertNotEquals(0, this.port); - String body = new RestTemplate().getForObject("http://localhost:" + this.port - + "/", String.class); + String body = new RestTemplate() + .getForObject("http://localhost:" + this.port + "/", String.class); assertEquals("Hello World", body); } diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java index b4149d762d..700010fc2c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java @@ -55,8 +55,8 @@ public class SpringApplicationWebIntegrationTestTests { public void runAndTestHttpEndpoint() { assertNotEquals(8080, this.port); assertNotEquals(0, this.port); - String body = new RestTemplate().getForObject("http://localhost:" + this.port - + "/", String.class); + String body = new RestTemplate() + .getForObject("http://localhost:" + this.port + "/", String.class); assertEquals("Hello World", body); } diff --git a/spring-boot/src/test/java/org/springframework/boot/test/TestRestTemplateTests.java b/spring-boot/src/test/java/org/springframework/boot/test/TestRestTemplateTests.java index 9726e09a15..2c9a4fe778 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/TestRestTemplateTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/TestRestTemplateTests.java @@ -38,12 +38,14 @@ public class TestRestTemplateTests { @Test public void simple() { // The Apache client is on the classpath so we get the fully-leaded factory - assertTrue(new TestRestTemplate().getRequestFactory() instanceof HttpComponentsClientHttpRequestFactory); + assertTrue(new TestRestTemplate() + .getRequestFactory() instanceof HttpComponentsClientHttpRequestFactory); } @Test public void authenticated() { - assertTrue(new TestRestTemplate("user", "password").getRequestFactory() instanceof InterceptingClientHttpRequestFactory); + assertTrue(new TestRestTemplate("user", "password") + .getRequestFactory() instanceof InterceptingClientHttpRequestFactory); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxViewTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxViewTests.java index 73ff4948f8..eefef65e66 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxViewTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityToolboxViewTests.java @@ -43,8 +43,8 @@ import static org.junit.Assert.assertThat; */ public class EmbeddedVelocityToolboxViewTests { - private static final String PATH = EmbeddedVelocityToolboxViewTests.class - .getPackage().getName().replace(".", "/"); + private static final String PATH = EmbeddedVelocityToolboxViewTests.class.getPackage() + .getName().replace(".", "/"); @Test public void loadsContextFromClassPath() throws Exception { @@ -69,8 +69,8 @@ public class EmbeddedVelocityToolboxViewTests { Map<String, Object> model = new LinkedHashMap<String, Object>(); HttpServletRequest request = new MockHttpServletRequest(); HttpServletResponse response = new MockHttpServletResponse(); - ToolContext toolContext = (ToolContext) view.createVelocityContext(model, - request, response); + ToolContext toolContext = (ToolContext) view.createVelocityContext(model, request, + response); context.close(); return toolContext; } diff --git a/spring-boot/src/test/java/org/springframework/boot/yaml/ArrayDocumentMatcherTests.java b/spring-boot/src/test/java/org/springframework/boot/yaml/ArrayDocumentMatcherTests.java index bbcf93b7ba..777f2747eb 100644 --- a/spring-boot/src/test/java/org/springframework/boot/yaml/ArrayDocumentMatcherTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/yaml/ArrayDocumentMatcherTests.java @@ -53,8 +53,8 @@ public class ArrayDocumentMatcherTests { } private Properties getProperties(String values) throws IOException { - return PropertiesLoaderUtils.loadProperties(new ByteArrayResource(values - .getBytes())); + return PropertiesLoaderUtils + .loadProperties(new ByteArrayResource(values.getBytes())); } }