From 40bf33487177a26e578486942218449658c5e715 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 5 Jul 2013 10:26:50 -0700 Subject: [PATCH 01/15] Restructure projects layout --- .gitignore | 2 +- .travis.yml | 5 - pom.xml | 378 ++++++------- spring-bootstrap-samples/pom.xml | 203 ------- .../pom.xml | 106 ---- .../spring-bootstrap-data-sample/pom.xml | 69 --- .../.springBeans | 14 - .../spring-bootstrap-sample/pom.xml | 35 -- .../spring-bootstrap-trad-sample/README.txt | 17 - .../spring-bootstrap-trad-sample/pom.xml | 168 ------ .../main/assembly/jar-with-dependencies.xml | 26 - spring-bootstrap-starters/pom.xml | 192 ------- .../pom.xml | 23 - .../spring-bootstrap-tomcat-starter/pom.xml | 39 -- .../README.md | 0 .../docs/Features.md | 0 .../pom.xml | 41 +- .../bootstrap/actuate/audit/AuditEvent.java | 0 .../actuate/audit/AuditEventRepository.java | 0 .../audit/InMemoryAuditEventRepository.java | 0 .../audit/listener/AuditApplicationEvent.java | 0 .../actuate/audit/listener/AuditListener.java | 0 .../autoconfigure/AuditAutoConfiguration.java | 0 .../EndpointAutoConfiguration.java | 0 .../EndpointWebMvcAutoConfiguration.java | 0 ...dpointWebMvcChildContextConfiguration.java | 0 .../ErrorMvcAutoConfiguration.java | 0 ...mentServerPropertiesAutoConfiguration.java | 0 .../MetricFilterAutoConfiguration.java | 0 .../MetricRepositoryAutoConfiguration.java | 0 .../SecurityAutoConfiguration.java | 0 .../TraceRepositoryAutoConfiguration.java | 0 .../TraceWebFilterAutoConfiguration.java | 0 .../actuate/endpoint/AbstractEndpoint.java | 0 .../actuate/endpoint/ActionEndpoint.java | 0 .../actuate/endpoint/BeansEndpoint.java | 0 .../actuate/endpoint/DumpEndpoint.java | 0 .../bootstrap/actuate/endpoint/Endpoint.java | 0 .../actuate/endpoint/EnvironmentEndpoint.java | 0 .../actuate/endpoint/HealthEndpoint.java | 0 .../actuate/endpoint/InfoEndpoint.java | 0 .../actuate/endpoint/MetricsEndpoint.java | 0 .../actuate/endpoint/PublicMetrics.java | 0 .../actuate/endpoint/ShutdownEndpoint.java | 0 .../actuate/endpoint/TraceEndpoint.java | 0 .../endpoint/VanillaPublicMetrics.java | 0 .../endpoint/mvc/EndpointHandlerAdapter.java | 0 .../endpoint/mvc/EndpointHandlerMapping.java | 0 .../fixme/ManagementServerConfiguration.java | 0 .../actuate/health/HealthIndicator.java | 0 .../health/VanillaHealthIndicator.java | 0 .../actuate/metrics/CounterService.java | 0 .../metrics/DefaultCounterService.java | 0 .../actuate/metrics/DefaultGaugeService.java | 0 .../actuate/metrics/GaugeService.java | 0 .../metrics/InMemoryMetricRepository.java | 0 .../actuate/metrics/Measurement.java | 0 .../bootstrap/actuate/metrics/Metric.java | 0 .../actuate/metrics/MetricRepository.java | 0 .../ManagementServerProperties.java | 0 .../properties/SecurityProperties.java | 0 .../security/AuthenticationAuditListener.java | 0 .../security/AuthorizationAuditListener.java | 0 .../trace/InMemoryTraceRepository.java | 0 .../bootstrap/actuate/trace/Trace.java | 0 .../actuate/trace/TraceRepository.java | 0 .../actuate/trace/WebRequestTraceFilter.java | 0 .../actuate/web/BasicErrorController.java | 0 .../actuate/web/ErrorController.java | 0 .../main/resources/META-INF/spring.factories | 0 .../bootstrap/actuate/TestUtils.java | 0 .../actuate/audit/AuditEventTests.java | 0 .../InMemoryAuditEventRepositoryTests.java | 0 .../audit/listener/AuditListenerTests.java | 0 .../AuditAutoConfigurationTests.java | 0 .../EndpointAutoConfigurationTests.java | 0 .../EndpointWebMvcAutoConfigurationTests.java | 0 ...erverPropertiesAutoConfigurationTests.java | 0 .../MetricFilterAutoConfigurationTests.java | 0 ...etricRepositoryAutoConfigurationTests.java | 0 .../SecurityAutoConfigurationTests.java | 0 ...TraceRepositoryAutoConfigurationTests.java | 0 .../TraceWebFilterAutoConfigurationTest.java | 0 .../endpoint/AbstractEndpointTests.java | 0 .../actuate/endpoint/BeansEndpointTests.java | 0 .../actuate/endpoint/DumpEndpointTests.java | 0 .../endpoint/EnvironmentEndpointTests.java | 0 .../actuate/endpoint/HealthEndpointTests.java | 0 .../actuate/endpoint/InfoEndpointTests.java | 0 .../endpoint/MetricsEndpointTests.java | 0 .../endpoint/ShutdownEndpointTests.java | 0 .../actuate/endpoint/TraceEndpointTests.java | 0 .../endpoint/VanillaPublicMetricsTests.java | 0 .../mvc/EndpointHandlerAdapterTests.java | 0 .../mvc/EndpointHandlerMappingTests.java | 0 .../fixme/ErrorConfigurationTests.java | 0 .../health/VanillaHealthIndicatorTests.java | 0 .../metrics/DefaultCounterServiceTests.java | 0 .../metrics/DefaultGaugeServiceTests.java | 0 .../InMemoryMetricRepositoryTests.java | 0 .../properties/SecurityPropertiesTests.java | 0 .../AuthenticationAuditListenerTests.java | 0 .../AuthorizationAuditListenerTests.java | 0 .../trace/InMemoryTraceRepositoryTests.java | 0 .../trace/WebRequestTraceFilterTests.java | 0 .../src/test/resources/git.properties | 0 .../pom.xml | 103 ++-- .../autoconfigure/AutoConfigurationUtils.java | 0 .../MessageSourceAutoConfiguration.java | 0 .../PropertyPlaceholderAutoConfiguration.java | 0 .../batch/BatchAutoConfiguration.java | 0 .../batch/BatchDatabaseInitializer.java | 0 .../batch/JobExecutionEvent.java | 0 .../batch/JobExecutionExitCodeGenerator.java | 0 .../batch/JobLauncherCommandLineRunner.java | 0 .../JpaRepositoriesAutoConfiguration.java | 0 ...JpaRepositoriesAutoConfigureRegistrar.java | 0 .../jdbc/AbstractDataSourceConfiguration.java | 0 .../jdbc/BasicDataSourceConfiguration.java | 0 .../jdbc/DataSourceAutoConfiguration.java | 0 ...ceTransactionManagerAutoConfiguration.java | 0 .../jdbc/EmbeddedDatabaseConfiguration.java | 0 .../jdbc/TomcatDataSourceConfiguration.java | 0 .../jpa/HibernateJpaAutoConfiguration.java | 0 .../orm/jpa/JpaAutoConfiguration.java | 0 .../thymeleaf/ThymeleafAutoConfiguration.java | 0 ...ddedServletContainerAutoConfiguration.java | 0 .../web/MultipartAutoConfiguration.java | 0 .../ServerPropertiesAutoConfiguration.java | 0 .../web/WebMvcAutoConfiguration.java | 0 .../annotation/AutoConfigurationSorter.java | 0 .../annotation/AutoConfigureAfter.java | 0 .../annotation/ComponentScanDetector.java | 0 .../annotation/EnableAutoConfiguration.java | 0 ...EnableAutoConfigurationImportSelector.java | 0 .../bootstrap/main/Spring.java | 2 + .../main/resources/META-INF/spring.factories | 8 - .../autoconfigure}/AdhocTestSuite.java | 2 +- .../MessageSourceAutoConfigurationTests.java | 0 .../autoconfigure}/SpringJUnitTests.java | 4 +- .../batch/BatchAutoConfigurationTests.java | 0 .../JobExecutionExitCodeGeneratorTests.java | 0 ...JpaRepositoriesAutoConfigurationTests.java | 0 .../data/JpaWebAutoConfigurationTests.java | 0 .../autoconfigure/data/test/City.java | 0 .../data/test/CityRepository.java | 0 .../BasicDataSourceConfigurationTests.java | 0 .../DataSourceAutoConfigurationTests.java | 0 ...nsactionManagerAutoConfigurationTests.java | 0 .../EmbeddedDatabaseConfigurationTests.java | 0 .../TomcatDataSourceConfigurationTests.java | 0 .../HibernateJpaAutoConfigurationTests.java | 0 .../autoconfigure/orm/jpa/test/City.java | 0 .../ThymeleafAutoConfigurationTests.java | 0 ...ervletContainerAutoConfigurationTests.java | 0 .../web/MultipartAutoConfigurationTests.java | 0 .../ServerPropertiesConfigurationTests.java | 0 .../web/WebMvcAutoConfigurationTests.java | 0 .../AutoConfigurationSorterTest.java | 0 .../ComponentScanDetectorConfiguration.java | 0 .../bootstrap/main/SimpleMainTests.java | 0 .../bootstrap/autoconfigure/jdbc/schema.sql | 0 .../bootstrap/context/annotation/foo.xml | 0 .../context/annotation/testProperties.xml | 0 .../context/embedded/conf.properties | 0 ...pleEmbeddedWebApplicationConfiguration.xml | 0 .../bootstrap/sample-beans.xml | 0 .../resources/fixme}/static/css/style.css | 0 .../bootstrap/autoconfigure/jdbc/schema.sql | 4 + .../src/test/resources/templates/layout.html | 0 .../src/test/resources/templates/template.txt | 0 .../src/test/resources/templates/tiles.xml | 0 .../src/test/resources/templates/view.html | 0 .../test/resources/test/messages.properties | 0 .../pom.xml | 67 +-- .../samples/actuator.groovy | 0 .../samples/app.groovy | 0 .../samples/integration.groovy | 0 .../samples/job.groovy | 0 .../samples/runner.groovy | 0 .../samples/runner.xml | 0 .../samples/template.groovy | 0 .../samples/ui.groovy | 0 .../samples/web.groovy | 0 .../src/main/assembly/descriptor.xml | 0 .../bootstrap/cli/BootstrapCliException.java | 0 .../bootstrap/cli/Command.java | 0 .../bootstrap/cli/CommandFactory.java | 0 .../bootstrap/cli/NoSuchCommandException.java | 0 .../bootstrap/cli/SpringBootstrapCli.java | 0 .../cli/command/AbstractCommand.java | 0 .../bootstrap/cli/command/CleanCommand.java | 0 .../bootstrap/cli/command/CreateCommand.java | 0 .../cli/command/DefaultCommandFactory.java | 0 .../bootstrap/cli/command/OptionHandler.java | 0 .../cli/command/OptionParsingCommand.java | 0 .../bootstrap/cli/command/RunCommand.java | 0 .../bootstrap/cli/command/ScriptCommand.java | 0 .../command/ScriptCompilationCustomizer.java | 0 .../bootstrap/cli/command/VersionCommand.java | 0 .../bootstrap/cli/compiler/AstUtils.java | 0 .../compiler/CompilerAutoConfiguration.java | 0 .../cli/compiler/DependencyCustomizer.java | 0 .../compiler/ExtendedGroovyClassLoader.java | 0 .../cli/compiler/GroovyCompiler.java | 0 .../compiler/GroovyCompilerConfiguration.java | 0 .../SpringBatchCompilerAutoConfiguration.java | 0 ...ingBootstrapCompilerAutoConfiguration.java | 4 +- ...gIntegrationCompilerAutoConfiguration.java | 0 .../SpringMvcCompilerAutoConfiguration.java | 0 .../bootstrap/cli/runner/BootstrapRunner.java | 0 .../runner/BootstrapRunnerConfiguration.java | 0 .../cli/template/GroovyTemplate.java | 0 .../src/main/resources/.gitignore | 0 ...ringframework.bootstrap.cli.CommandFactory | 0 ...rap.cli.compiler.CompilerAutoConfiguration | 0 .../src/main/scripts/spring | 0 .../bootstrap/cli/SampleIntegrationTests.java | 0 .../cli/SpringBootstrapCliTests.java | 0 .../cli/command/ScriptCommandTests.java | 0 .../test/resources/commands/closure.groovy | 0 .../test/resources/commands/command.groovy | 0 .../test/resources/commands/handler.groovy | 0 .../src/test/resources/commands/mixin.groovy | 0 .../test/resources/commands/runnable.groovy | 0 .../src/test/resources/commands/script.groovy | 0 .../src/test/resources/commands/test.groovy | 0 .../src/test/resources/css/bootstrap.min.css | 0 .../src/test/resources/log4j.properties | 0 .../src/test/resources/templates/home.html | 0 .../src/test/resources/templates/test.txt | 0 spring-zero-core/pom.xml | 117 +++++ .../org/springframework/bootstrap/Banner.java | 0 .../bootstrap/BeanDefinitionLoader.java | 0 .../bootstrap/CommandLineRunner.java | 0 .../bootstrap/ExitCodeGenerator.java | 0 .../bootstrap/SpringApplication.java | 0 .../bind/CustomPropertyConstructor.java | 0 .../bootstrap/bind/InetAddressEditor.java | 0 .../bind/PropertiesConfigurationFactory.java | 0 .../bind/PropertySourcesPropertyValues.java | 0 .../bootstrap/bind/RelaxedDataBinder.java | 0 .../bind/YamlConfigurationFactory.java | 0 .../bootstrap/config/JacksonJsonParser.java | 0 .../bootstrap/config/JsonParser.java | 0 .../bootstrap/config/JsonParserFactory.java | 0 .../bootstrap/config/SimpleJsonParser.java | 0 .../bootstrap/config/YamlJsonParser.java | 0 .../bootstrap/config/YamlMapFactoryBean.java | 0 .../bootstrap/config/YamlProcessor.java | 0 .../config/YamlPropertiesFactoryBean.java | 0 .../annotation/AbstractOnBeanCondition.java | 0 .../context/annotation/AssertMissingBean.java | 0 .../AssertMissingBeanCondition.java | 0 .../context/annotation/ConditionLogUtils.java | 0 .../context/annotation/ConditionalOnBean.java | 0 .../annotation/ConditionalOnClass.java | 0 .../annotation/ConditionalOnExpression.java | 0 .../annotation/ConditionalOnMissingBean.java | 0 .../annotation/ConditionalOnMissingClass.java | 0 .../ConditionalOnNotWebApplication.java | 0 .../annotation/ConditionalOnResource.java | 0 .../ConditionalOnWebApplication.java | 0 .../annotation/ConfigurationProperties.java | 0 ...urationPropertiesBindingConfiguration.java | 0 .../EnableConfigurationProperties.java | 0 ...ConfigurationPropertiesImportSelector.java | 0 .../context/annotation/OnBeanCondition.java | 0 .../context/annotation/OnClassCondition.java | 0 .../annotation/OnExpressionCondition.java | 0 .../annotation/OnMissingBeanCondition.java | 0 .../annotation/OnMissingClassCondition.java | 0 .../OnNotWebApplicationCondition.java | 0 .../annotation/OnResourceCondition.java | 0 .../annotation/OnWebApplicationCondition.java | 0 .../PropertySourcesBindingPostProcessor.java | 0 ...stractEmbeddedServletContainerFactory.java | 0 ...onConfigEmbeddedWebApplicationContext.java | 0 ...urableEmbeddedServletContainerFactory.java | 0 .../embedded/EmbeddedServletContainer.java | 0 .../EmbeddedServletContainerCustomizer.java | 0 ...tContainerCustomizerBeanPostProcessor.java | 0 .../EmbeddedServletContainerException.java | 0 .../EmbeddedServletContainerFactory.java | 0 .../EmbeddedWebApplicationContext.java | 0 .../bootstrap/context/embedded/ErrorPage.java | 0 .../embedded/FilterRegistrationBean.java | 0 .../context/embedded/RegistrationBean.java | 0 .../embedded/ServletContextInitializer.java | 0 .../embedded/ServletRegistrationBean.java | 0 ...onContextServletContextAwareProcessor.java | 0 .../XmlEmbeddedWebApplicationContext.java | 0 .../jetty/JettyEmbeddedServletContainer.java | 0 .../JettyEmbeddedServletContainerFactory.java | 0 ...ervletContextInitializerConfiguration.java | 0 .../context/embedded/jetty/package-info.java | 0 .../context/embedded/package-info.java | 0 ...etContextInitializerLifecycleListener.java | 0 .../TomcatEmbeddedServletContainer.java | 0 ...TomcatEmbeddedServletContainerFactory.java | 0 .../TomcatEmbeddedWebappClassLoader.java | 0 .../context/embedded/tomcat/package-info.java | 0 ...nfigFileApplicationContextInitializer.java | 0 ...ontextIdApplicationContextInitializer.java | 0 ...DelegateApplicationContextInitializer.java | 0 .../LoggingApplicationContextInitializer.java | 0 .../VcapApplicationContextInitializer.java | 0 .../logging/JavaLoggerConfigurer.java | 0 .../bootstrap/logging/LogbackConfigurer.java | 0 .../properties/ServerProperties.java | 0 .../web/SpringServletInitializer.java | 0 .../main/resources/META-INF/spring.factories | 7 + .../src/main/resources/favicon.ico | Bin .../bootstrap/logging/log4j.properties | 36 +- .../bootstrap/logging/logback.xml | 0 .../bootstrap/logging/logging.properties | 16 +- .../bootstrap/BeanDefinitionLoaderTests.java | 0 .../bootstrap/SpringApplicationTests.java | 0 .../springframework/bootstrap/TestUtils.java | 0 .../PropertiesConfigurationFactoryTests.java | 0 .../PropertySourcesPropertyValuesTests.java | 0 .../bind/RelaxedDataBinderTests.java | 0 .../bind/YamlConfigurationFactoryTests.java | 0 .../bootstrap/config/JacksonParserTests.java | 0 .../config/SimpleJsonParserTests.java | 0 .../config/YamlMapFactoryBeanTests.java | 0 .../bootstrap/config/YamlParserTests.java | 0 .../YamlPropertiesFactoryBeanTests.java | 0 .../EnableConfigurationPropertiesTests.java | 0 .../NotWebApplicationConditionTests.java | 0 .../annotation/OnBeanConditionTests.java | 0 .../annotation/OnClassConditionTests.java | 0 .../OnExpressionConditionTests.java | 0 .../OnMissingBeanConditionTests.java | 0 .../OnMissingClassConditionTests.java | 0 .../annotation/OnResourceConditionTests.java | 0 .../WebApplicationConditionTests.java | 0 ...tEmbeddedServletContainerFactoryTests.java | 0 ...figEmbeddedWebApplicationContextTests.java | 0 ...edServletContainerMvcIntegrationTests.java | 0 .../EmbeddedWebApplicationContextTests.java | 0 .../context/embedded/ExampleFilter.java | 0 .../context/embedded/ExampleServlet.java | 0 .../embedded/FilterRegistrationBeanTests.java | 0 .../MockEmbeddedServletContainerFactory.java | 0 .../context/embedded/MockFilter.java | 0 .../context/embedded/MockServlet.java | 0 .../ServletRegistrationBeanTests.java | 0 ...XmlEmbeddedWebApplicationContextTests.java | 0 ...leEmbeddedWebApplicationConfiguration.java | 0 ...yEmbeddedServletContainerFactoryTests.java | 0 ...tEmbeddedServletContainerFactoryTests.java | 0 ...ileApplicationContextInitializerTests.java | 0 ...tIdApplicationContextInitializerTests.java | 0 ...gateApplicationContextInitializerTest.java | 0 ...capApplicationContextInitializerTests.java | 0 .../EnableConfigurationPropertiesTests.java | 0 .../logging/JavaLoggerConfigurerTests.java | 0 .../logging/LogbackConfigurerTests.java | 0 .../logging/LoggingInitializerTests.java | 3 +- .../bootstrap/logging/TestFormatter.java | 0 .../properties/ServerPropertiesTests.java | 0 .../bootstrap/sampleconfig/MyComponent.java | 0 .../src/test/resources/application.properties | 0 .../enableprofile-myprofile.properties | 0 .../test/resources/enableprofile.properties | 0 .../src/test/resources/logback-nondefault.xml | 0 .../src/test/resources/logback-test.xml | 0 .../resources/logging-nondefault.properties | 4 +- .../bootstrap/context/annotation/foo.xml | 10 + .../context/annotation/testProperties.xml | 12 + .../context/embedded/conf.properties | 1 + ...pleEmbeddedWebApplicationConfiguration.xml | 11 + .../bootstrap/sample-beans.xml | 9 + .../specificfile-specificprofile.properties | 0 .../resources/specificlocation.properties | 0 .../src/test/resources/testprofiles.yml | 0 .../test/resources/testproperties.properties | 0 .../src/test/resources/testsetprofiles.yml | 0 .../src/test/resources/testyaml.yml | 0 spring-zero-intergration-tests/build.log | 495 ++++++++++++++++++ spring-zero-intergration-tests/pom.xml | 106 ++++ .../src/it/settings.xml | 0 .../pom.xml | 9 +- .../bootstrap/launcher/JarLauncher.java | 0 .../bootstrap/launcher/Launcher.java | 0 .../bootstrap/launcher/MainMethodRunner.java | 0 .../bootstrap/launcher/WarLauncher.java | 0 .../launcher/data/RandomAccessData.java | 0 .../launcher/data/RandomAccessDataFile.java | 0 .../bootstrap/launcher/data/package-info.java | 0 .../launcher/jar/JarEntryFilter.java | 0 .../jar/RandomAccessDataZipEntry.java | 0 .../jar/RandomAccessDataZipInputStream.java | 0 .../launcher/jar/RandomAccessJarFile.java | 0 .../bootstrap/launcher/jar/package-info.java | 0 .../bootstrap/launcher/package-info.java | 0 .../launcher/ByteArrayStartsWith.java | 0 .../data/RandomAccessDataFileTest.java | 0 .../RandomAccessDataZipInputStreamTest.java | 0 .../launcher/jar/RandomAccessJarFileTest.java | 0 .../pom.xml | 155 +++--- .../src/it/executable-jar/pom.xml | 2 +- .../main/java/org/test/SampleApplication.java | 0 .../src/it/executable-jar/verify.groovy | 0 .../src/it/executable-war/pom.xml | 2 +- .../main/java/org/test/SampleApplication.java | 0 .../executable-war/src/main/webapp/index.html | 0 .../src/it/executable-war/verify.groovy | 0 spring-zero-maven-plugin/src/it/settings.xml | 35 ++ .../maven/AbstractExecutableArchiveMojo.java | 2 +- .../bootstrap/maven/ExecutableJarMojo.java | 0 .../bootstrap/maven/ExecutableWarMojo.java | 0 .../bootstrap/maven/MainClassFinder.java | 0 .../PropertiesMergingResourceTransformer.java | 0 .../resources/META-INF/plexus/components.xml | 4 +- .../bootstrap/maven/MainClassFinderTests.java | 0 ...ertiesMergingResourceTransformerTests.java | 10 +- .../bootstrap/maven/Verify.java | 0 .../maven/sample/ClassWithMainMethod.java | 0 .../maven/sample/ClassWithoutMainMethod.java | 0 spring-zero-samples/pom.xml | 29 + .../spring-zero-sample-actuator-ui/pom.xml | 49 ++ .../ui/ActuatorUiBootstrapApplication.java | 0 .../src/main/resources/css/bootstrap.min.css | 0 .../src/main/resources/templates/error.html | 0 .../src/main/resources/templates/home.html | 0 .../ActuatorUiBootstrapApplicationTests.java | 0 ...ementServiceBootstrapApplicationTests.java | 0 .../src/test/resources/logging.properties | 14 +- .../spring-zero-sample-actuator}/pom.xml | 70 ++- .../sample/service/HelloWorldService.java | 0 .../sample/service/SampleController.java | 0 .../service/ServiceBootstrapApplication.java | 0 .../sample/service/ServiceProperties.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logging.properties | 14 +- ...rtiesServiceBootstrapApplicationTests.java | 0 ...dressServiceBootstrapApplicationTests.java | 0 ...ementServiceBootstrapApplicationTests.java | 0 ...ementServiceBootstrapApplicationTests.java | 0 .../ServiceBootstrapApplicationTests.java | 0 ...tdownServiceBootstrapApplicationTests.java | 0 ...ecureServiceBootstrapApplicationTests.java | 0 .../spring-zero-sample-actuator}/start.groovy | 0 .../spring-zero-sample-batch/pom.xml | 32 ++ .../batch/BatchBootstrapApplication.java | 0 .../batch/BatchBootstrapApplicationTests.java | 0 .../spring-zero-sample-data-jpa}/pom.xml | 34 +- .../sample/data/DataBootstrapApplication.java | 0 .../bootstrap/sample/data/domain/City.java | 0 .../bootstrap/sample/data/domain/Hotel.java | 0 .../sample/data/domain/HotelSummary.java | 0 .../bootstrap/sample/data/domain/Rating.java | 0 .../sample/data/domain/RatingCount.java | 0 .../bootstrap/sample/data/domain/Review.java | 0 .../sample/data/domain/ReviewDetails.java | 0 .../sample/data/domain/TripType.java | 0 .../domain/repository/CityRepository.java | 0 .../domain/repository/HotelRepository.java | 0 .../repository/HotelSummaryRepository.java | 0 .../domain/repository/ReviewRepository.java | 0 .../data/service/CitySearchCriteria.java | 0 .../sample/data/service/CityService.java | 0 .../sample/data/service/HotelService.java | 0 .../sample/data/service/ReviewsSummary.java | 0 .../data/service/impl/CityServiceImpl.java | 0 .../data/service/impl/HotelServiceImpl.java | 0 .../sample/data/web/SampleController.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/import.sql | 0 .../data/DataBootstrapApplicationTests.java | 0 .../spring-zero-sample-integration/pom.xml | 32 ++ .../sample/consumer/HelloWorldService.java | 0 .../IntegrationBootstrapApplication.java | 0 .../sample/consumer/SampleEndpoint.java | 0 .../sample/consumer/ServiceProperties.java | 0 .../src/main/resources/application.properties | 0 .../main/resources/integration-context.xml | 0 .../src/main/resources/logback.xml | 0 .../IntegrationBootstrapApplicationTests.java | 0 .../sample/producer/ProducerApplication.java | 0 .../spring-zero-sample-jetty}/pom.xml | 30 +- .../jetty/JettyBootstrapApplication.java | 0 .../jetty/service/HelloWorldService.java | 0 .../sample/jetty/web/SampleController.java | 0 .../jetty/JettyBootstrapApplicationTests.java | 0 .../spring-zero-sample-profile}/pom.xml | 26 +- .../simple/ProfileBootstrapApplication.java | 0 .../simple/service/GoodbyeWorldService.java | 0 .../simple/service/HelloWorldService.java | 0 .../sample/simple/service/MessageService.java | 0 .../src/main/resources/application.yml | 0 .../ProfileBootstrapApplicationTests.java | 0 .../spring-zero-sample-simple}/pom.xml | 26 +- .../simple/SimpleBootstrapApplication.java | 0 .../simple/service/HelloWorldService.java | 0 .../src/main/resources/application.properties | 0 .../SimpleBootstrapApplicationTests.java | 0 .../spring-zero-sample-tomcat}/pom.xml | 37 +- .../tomcat/TomcatBootstrapApplication.java | 0 .../tomcat/service/HelloWorldService.java | 0 .../sample/tomcat/web/SampleController.java | 0 ...onfigurationBootstrapApplicationTests.java | 0 .../TomcatBootstrapApplicationTests.java | 0 .../.gitignore | 0 .../spring-zero-sample-traditional}/pom.xml | 48 +- .../sample/trad/TradBootstrapApplication.java | 0 .../sample/trad/config/WebConfig.java | 0 .../src/main/resources/log4j.properties | 0 .../src/main/webapp/WEB-INF/views/home.jsp | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../src/main/webapp/index.html | 0 .../trad/TradBootstrapApplicationTests.java | 0 .../src/test/resources/log4j.properties | 0 .../spring-zero-sample-web-ui/pom.xml | 40 ++ .../sample/ui/InMemoryMessageRespository.java | 0 .../bootstrap/sample/ui/Message.java | 0 .../sample/ui/MessageRepository.java | 0 .../sample/ui/UiBootstrapApplication.java | 0 .../sample/ui/mvc/MessageController.java | 0 .../src/main/resources/css/bootstrap.min.css | 0 .../src/main/resources/favicon.ico | Bin .../src/main/resources/js/jquery-1.7.2.js | 0 .../src/main/resources/js/jquery.validate.js | 0 .../src/main/resources/templates/layout.html | 0 .../resources/templates/messages/form.html | 0 .../resources/templates/messages/list.html | 0 .../resources/templates/messages/view.html | 0 .../ui/UiBootstrapApplicationTests.java | 0 .../src/test/resources/logging.properties | 12 +- .../spring-zero-sample-xml}/pom.xml | 26 +- .../sample/xml/XmlBootstrapApplication.java | 0 .../sample/xml/service/HelloWorldService.java | 0 .../META-INF/application-context.xml | 0 .../xml/XmlBootstrapApplicationTests.java | 0 spring-zero-starters/pom.xml | 24 + .../spring-zero-starter-actuator}/pom.xml | 13 +- .../spring-zero-starter-batch}/pom.xml | 19 +- .../spring-zero-starter-data-jpa}/pom.xml | 24 +- .../spring-zero-starter-integration}/pom.xml | 33 +- .../spring-zero-starter-security}/pom.xml | 11 +- .../spring-zero-starter-web}/pom.xml | 22 +- .../spring-zero-starter}/pom.xml | 55 +- 544 files changed, 1705 insertions(+), 1573 deletions(-) delete mode 100644 .travis.yml delete mode 100644 spring-bootstrap-samples/pom.xml delete mode 100644 spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/pom.xml delete mode 100644 spring-bootstrap-samples/spring-bootstrap-data-sample/pom.xml delete mode 100644 spring-bootstrap-samples/spring-bootstrap-integration-sample/.springBeans delete mode 100644 spring-bootstrap-samples/spring-bootstrap-sample/pom.xml delete mode 100644 spring-bootstrap-samples/spring-bootstrap-trad-sample/README.txt delete mode 100644 spring-bootstrap-samples/spring-bootstrap-trad-sample/pom.xml delete mode 100644 spring-bootstrap-samples/src/main/assembly/jar-with-dependencies.xml delete mode 100644 spring-bootstrap-starters/pom.xml delete mode 100644 spring-bootstrap-starters/spring-bootstrap-integration-starter/pom.xml delete mode 100644 spring-bootstrap-starters/spring-bootstrap-tomcat-starter/pom.xml rename {spring-bootstrap-actuator => spring-zero-actuator}/README.md (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/docs/Features.md (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/pom.xml (80%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/main/resources/META-INF/spring.factories (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java (100%) rename {spring-bootstrap-actuator => spring-zero-actuator}/src/test/resources/git.properties (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/pom.xml (61%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/java/org/springframework/bootstrap/main/Spring.java (97%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/main/resources/META-INF/spring.factories (66%) rename {spring-bootstrap/src/test/java/org/springframework/bootstrap => spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure}/AdhocTestSuite.java (95%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java (100%) rename {spring-bootstrap/src/test/java/org/springframework/bootstrap => spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure}/SpringJUnitTests.java (93%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java (100%) rename {spring-bootstrap/src/test/resources => spring-zero-autoconfigure/src/test/resources/fixme}/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql (100%) rename {spring-bootstrap/src/test/resources => spring-zero-autoconfigure/src/test/resources/fixme}/org/springframework/bootstrap/context/annotation/foo.xml (100%) rename {spring-bootstrap/src/test/resources => spring-zero-autoconfigure/src/test/resources/fixme}/org/springframework/bootstrap/context/annotation/testProperties.xml (100%) rename {spring-bootstrap/src/test/resources => spring-zero-autoconfigure/src/test/resources/fixme}/org/springframework/bootstrap/context/embedded/conf.properties (100%) rename {spring-bootstrap/src/test/resources => spring-zero-autoconfigure/src/test/resources/fixme}/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml (100%) rename {spring-bootstrap/src/test/resources => spring-zero-autoconfigure/src/test/resources/fixme}/org/springframework/bootstrap/sample-beans.xml (100%) rename {spring-bootstrap/src/test/resources => spring-zero-autoconfigure/src/test/resources/fixme}/static/css/style.css (100%) create mode 100644 spring-zero-autoconfigure/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/resources/templates/layout.html (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/resources/templates/template.txt (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/resources/templates/tiles.xml (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/resources/templates/view.html (100%) rename {spring-bootstrap => spring-zero-autoconfigure}/src/test/resources/test/messages.properties (100%) rename {spring-bootstrap-cli => spring-zero-cli}/pom.xml (70%) rename {spring-bootstrap-cli => spring-zero-cli}/samples/actuator.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/samples/app.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/samples/integration.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/samples/job.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/samples/runner.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/samples/runner.xml (100%) rename {spring-bootstrap-cli => spring-zero-cli}/samples/template.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/samples/ui.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/samples/web.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/assembly/descriptor.xml (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/Command.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/CommandFactory.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/NoSuchCommandException.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/AbstractCommand.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/CleanCommand.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/CreateCommand.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/DefaultCommandFactory.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/OptionHandler.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/OptionParsingCommand.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/RunCommand.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/ScriptCommand.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/ScriptCompilationCustomizer.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/command/VersionCommand.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/CompilerAutoConfiguration.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/DependencyCustomizer.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/ExtendedGroovyClassLoader.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompiler.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompilerConfiguration.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java (98%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunner.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunnerConfiguration.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/java/org/springframework/bootstrap/cli/template/GroovyTemplate.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/resources/.gitignore (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.CommandFactory (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/main/scripts/spring (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/java/org/springframework/bootstrap/cli/SampleIntegrationTests.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/java/org/springframework/bootstrap/cli/command/ScriptCommandTests.java (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/commands/closure.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/commands/command.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/commands/handler.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/commands/mixin.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/commands/runnable.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/commands/script.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/commands/test.groovy (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/css/bootstrap.min.css (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/log4j.properties (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/templates/home.html (100%) rename {spring-bootstrap-cli => spring-zero-cli}/src/test/resources/templates/test.txt (100%) create mode 100644 spring-zero-core/pom.xml rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/Banner.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/CommandLineRunner.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/ExitCodeGenerator.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/SpringApplication.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/config/JsonParser.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBean.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/AbstractOnBeanCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBean.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBeanCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConditionLogUtils.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnBean.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnClass.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnExpression.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingBean.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingClass.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnNotWebApplication.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnResource.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnWebApplication.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationProperties.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationPropertiesBindingConfiguration.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationProperties.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesImportSelector.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/OnBeanCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/OnClassCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/OnExpressionCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingBeanCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingClassCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/OnNotWebApplicationCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/OnResourceCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/OnWebApplicationCondition.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/annotation/PropertySourcesBindingPostProcessor.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/ConfigurableEmbeddedServletContainerFactory.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerException.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerFactory.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/ErrorPage.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/RegistrationBean.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/ServletContextInitializer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/WebApplicationContextServletContextAwareProcessor.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/jetty/ServletContextInitializerConfiguration.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/jetty/package-info.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/package-info.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/package-info.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java (100%) rename {spring-bootstrap => spring-zero-core}/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java (100%) create mode 100644 spring-zero-core/src/main/resources/META-INF/spring.factories rename {spring-bootstrap => spring-zero-core}/src/main/resources/favicon.ico (100%) rename {spring-bootstrap => spring-zero-core}/src/main/resources/org/springframework/bootstrap/logging/log4j.properties (97%) rename {spring-bootstrap => spring-zero-core}/src/main/resources/org/springframework/bootstrap/logging/logback.xml (100%) rename {spring-bootstrap => spring-zero-core}/src/main/resources/org/springframework/bootstrap/logging/logging.properties (87%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/BeanDefinitionLoaderTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/SpringApplicationTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/TestUtils.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/config/YamlParserTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/annotation/NotWebApplicationConditionTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/annotation/OnBeanConditionTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/annotation/OnClassConditionTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/annotation/OnExpressionConditionTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingBeanConditionTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingClassConditionTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/annotation/OnResourceConditionTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/annotation/WebApplicationConditionTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/ExampleFilter.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/ExampleServlet.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBeanTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/MockFilter.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/MockServlet.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContextTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/config/ExampleEmbeddedWebApplicationConfiguration.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializerTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java (99%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/java/org/springframework/bootstrap/sampleconfig/MyComponent.java (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/application.properties (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/enableprofile-myprofile.properties (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/enableprofile.properties (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/logback-nondefault.xml (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/logback-test.xml (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/logging-nondefault.properties (55%) create mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/foo.xml create mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml create mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/conf.properties create mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml create mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/sample-beans.xml rename {spring-bootstrap => spring-zero-core}/src/test/resources/specificfile-specificprofile.properties (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/specificlocation.properties (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/testprofiles.yml (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/testproperties.properties (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/testsetprofiles.yml (100%) rename {spring-bootstrap => spring-zero-core}/src/test/resources/testyaml.yml (100%) create mode 100644 spring-zero-intergration-tests/build.log create mode 100644 spring-zero-intergration-tests/pom.xml rename {spring-bootstrap-maven-plugin => spring-zero-intergration-tests}/src/it/settings.xml (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/pom.xml (65%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/JarLauncher.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/Launcher.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/MainMethodRunner.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/WarLauncher.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessData.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFile.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/data/package-info.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/jar/JarEntryFilter.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipEntry.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStream.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFile.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/jar/package-info.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/main/java/org/springframework/bootstrap/launcher/package-info.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/test/java/org/springframework/bootstrap/launcher/ByteArrayStartsWith.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/test/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFileTest.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStreamTest.java (100%) rename {spring-bootstrap-launcher => spring-zero-launcher}/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/pom.xml (83%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/it/executable-jar/pom.xml (94%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/it/executable-jar/src/main/java/org/test/SampleApplication.java (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/it/executable-jar/verify.groovy (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/it/executable-war/pom.xml (94%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/it/executable-war/src/main/java/org/test/SampleApplication.java (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/it/executable-war/src/main/webapp/index.html (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/it/executable-war/verify.groovy (100%) create mode 100644 spring-zero-maven-plugin/src/it/settings.xml rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java (99%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/main/java/org/springframework/bootstrap/maven/ExecutableJarMojo.java (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/main/java/org/springframework/bootstrap/maven/ExecutableWarMojo.java (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/main/java/org/springframework/bootstrap/maven/MainClassFinder.java (100%) rename {spring-bootstrap => spring-zero-maven-plugin}/src/main/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformer.java (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/main/resources/META-INF/plexus/components.xml (93%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/test/java/org/springframework/bootstrap/maven/MainClassFinderTests.java (100%) rename {spring-bootstrap => spring-zero-maven-plugin}/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java (84%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/test/java/org/springframework/bootstrap/maven/Verify.java (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithMainMethod.java (100%) rename {spring-bootstrap-maven-plugin => spring-zero-maven-plugin}/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithoutMainMethod.java (100%) create mode 100644 spring-zero-samples/pom.xml create mode 100644 spring-zero-samples/spring-zero-sample-actuator-ui/pom.xml rename {spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample => spring-zero-samples/spring-zero-sample-actuator-ui}/src/main/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample => spring-zero-samples/spring-zero-sample-actuator-ui}/src/main/resources/css/bootstrap.min.css (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample => spring-zero-samples/spring-zero-sample-actuator-ui}/src/main/resources/templates/error.html (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample => spring-zero-samples/spring-zero-sample-actuator-ui}/src/main/resources/templates/home.html (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample => spring-zero-samples/spring-zero-sample-actuator-ui}/src/test/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample => spring-zero-samples/spring-zero-sample-actuator-ui}/src/test/java/org/springframework/bootstrap/sample/ui/ManagementServiceBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample => spring-zero-samples/spring-zero-sample-actuator-ui}/src/test/resources/logging.properties (97%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/pom.xml (77%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/main/java/org/springframework/bootstrap/sample/service/HelloWorldService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/main/java/org/springframework/bootstrap/sample/service/SampleController.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/main/java/org/springframework/bootstrap/sample/service/ServiceBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/main/java/org/springframework/bootstrap/sample/service/ServiceProperties.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/main/resources/application.properties (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/main/resources/logging.properties (97%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/test/java/org/springframework/bootstrap/sample/test/EndpointsPropertiesServiceBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/test/java/org/springframework/bootstrap/sample/test/ManagementAddressServiceBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/test/java/org/springframework/bootstrap/sample/test/ManagementServiceBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/test/java/org/springframework/bootstrap/sample/test/NoManagementServiceBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/test/java/org/springframework/bootstrap/sample/test/ServiceBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/test/java/org/springframework/bootstrap/sample/test/ShutdownServiceBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/src/test/java/org/springframework/bootstrap/sample/test/UnsecureServiceBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-actuator-sample => spring-zero-samples/spring-zero-sample-actuator}/start.groovy (100%) create mode 100644 spring-zero-samples/spring-zero-sample-batch/pom.xml rename {spring-bootstrap-samples/spring-bootstrap-batch-sample => spring-zero-samples/spring-zero-sample-batch}/src/main/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-batch-sample => spring-zero-samples/spring-zero-sample-batch}/src/test/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-batch-sample => spring-zero-samples/spring-zero-sample-data-jpa}/pom.xml (51%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/DataBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/City.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/Hotel.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/HotelSummary.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/Rating.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/RatingCount.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/Review.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/ReviewDetails.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/TripType.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/CityRepository.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelRepository.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelSummaryRepository.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/ReviewRepository.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/service/CitySearchCriteria.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/service/CityService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/service/HotelService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/service/ReviewsSummary.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/service/impl/CityServiceImpl.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/service/impl/HotelServiceImpl.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/java/org/springframework/bootstrap/sample/data/web/SampleController.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/resources/application.properties (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/main/resources/import.sql (100%) rename {spring-bootstrap-samples/spring-bootstrap-data-sample => spring-zero-samples/spring-zero-sample-data-jpa}/src/test/java/org/springframework/bootstrap/sample/data/DataBootstrapApplicationTests.java (100%) create mode 100644 spring-zero-samples/spring-zero-sample-integration/pom.xml rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-samples/spring-zero-sample-integration}/src/main/java/org/springframework/bootstrap/sample/consumer/HelloWorldService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-samples/spring-zero-sample-integration}/src/main/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-samples/spring-zero-sample-integration}/src/main/java/org/springframework/bootstrap/sample/consumer/SampleEndpoint.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-samples/spring-zero-sample-integration}/src/main/java/org/springframework/bootstrap/sample/consumer/ServiceProperties.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-samples/spring-zero-sample-integration}/src/main/resources/application.properties (100%) rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-samples/spring-zero-sample-integration}/src/main/resources/integration-context.xml (100%) rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-samples/spring-zero-sample-integration}/src/main/resources/logback.xml (100%) rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-samples/spring-zero-sample-integration}/src/test/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-samples/spring-zero-sample-integration}/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-jetty-sample => spring-zero-samples/spring-zero-sample-jetty}/pom.xml (67%) rename {spring-bootstrap-samples/spring-bootstrap-jetty-sample => spring-zero-samples/spring-zero-sample-jetty}/src/main/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-jetty-sample => spring-zero-samples/spring-zero-sample-jetty}/src/main/java/org/springframework/bootstrap/sample/jetty/service/HelloWorldService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-jetty-sample => spring-zero-samples/spring-zero-sample-jetty}/src/main/java/org/springframework/bootstrap/sample/jetty/web/SampleController.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-jetty-sample => spring-zero-samples/spring-zero-sample-jetty}/src/test/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-profile-sample => spring-zero-samples/spring-zero-sample-profile}/pom.xml (56%) rename {spring-bootstrap-samples/spring-bootstrap-profile-sample => spring-zero-samples/spring-zero-sample-profile}/src/main/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-profile-sample => spring-zero-samples/spring-zero-sample-profile}/src/main/java/org/springframework/bootstrap/sample/simple/service/GoodbyeWorldService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-profile-sample => spring-zero-samples/spring-zero-sample-profile}/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-profile-sample => spring-zero-samples/spring-zero-sample-profile}/src/main/java/org/springframework/bootstrap/sample/simple/service/MessageService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-profile-sample => spring-zero-samples/spring-zero-sample-profile}/src/main/resources/application.yml (100%) rename {spring-bootstrap-samples/spring-bootstrap-profile-sample => spring-zero-samples/spring-zero-sample-profile}/src/test/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-simple-sample => spring-zero-samples/spring-zero-sample-simple}/pom.xml (51%) rename {spring-bootstrap-samples/spring-bootstrap-simple-sample => spring-zero-samples/spring-zero-sample-simple}/src/main/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-simple-sample => spring-zero-samples/spring-zero-sample-simple}/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-simple-sample => spring-zero-samples/spring-zero-sample-simple}/src/main/resources/application.properties (100%) rename {spring-bootstrap-samples/spring-bootstrap-simple-sample => spring-zero-samples/spring-zero-sample-simple}/src/test/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplicationTests.java (100%) rename {spring-bootstrap-starters/spring-bootstrap-web-starter => spring-zero-samples/spring-zero-sample-tomcat}/pom.xml (58%) rename {spring-bootstrap-samples/spring-bootstrap-tomcat-sample => spring-zero-samples/spring-zero-sample-tomcat}/src/main/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-tomcat-sample => spring-zero-samples/spring-zero-sample-tomcat}/src/main/java/org/springframework/bootstrap/sample/tomcat/service/HelloWorldService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-tomcat-sample => spring-zero-samples/spring-zero-sample-tomcat}/src/main/java/org/springframework/bootstrap/sample/tomcat/web/SampleController.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-tomcat-sample => spring-zero-samples/spring-zero-sample-tomcat}/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-tomcat-sample => spring-zero-samples/spring-zero-sample-tomcat}/src/test/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-trad-sample => spring-zero-samples/spring-zero-sample-traditional}/.gitignore (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-traditional}/pom.xml (50%) rename {spring-bootstrap-samples/spring-bootstrap-trad-sample => spring-zero-samples/spring-zero-sample-traditional}/src/main/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-trad-sample => spring-zero-samples/spring-zero-sample-traditional}/src/main/java/org/springframework/bootstrap/sample/trad/config/WebConfig.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-trad-sample => spring-zero-samples/spring-zero-sample-traditional}/src/main/resources/log4j.properties (100%) rename {spring-bootstrap-samples/spring-bootstrap-trad-sample => spring-zero-samples/spring-zero-sample-traditional}/src/main/webapp/WEB-INF/views/home.jsp (100%) rename {spring-bootstrap-samples/spring-bootstrap-trad-sample => spring-zero-samples/spring-zero-sample-traditional}/src/main/webapp/WEB-INF/web.xml (100%) rename {spring-bootstrap-samples/spring-bootstrap-trad-sample => spring-zero-samples/spring-zero-sample-traditional}/src/main/webapp/index.html (100%) rename {spring-bootstrap-samples/spring-bootstrap-trad-sample => spring-zero-samples/spring-zero-sample-traditional}/src/test/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-trad-sample => spring-zero-samples/spring-zero-sample-traditional}/src/test/resources/log4j.properties (100%) create mode 100644 spring-zero-samples/spring-zero-sample-web-ui/pom.xml rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/java/org/springframework/bootstrap/sample/ui/InMemoryMessageRespository.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/java/org/springframework/bootstrap/sample/ui/Message.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/java/org/springframework/bootstrap/sample/ui/MessageRepository.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/java/org/springframework/bootstrap/sample/ui/mvc/MessageController.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/resources/css/bootstrap.min.css (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/resources/favicon.ico (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/resources/js/jquery-1.7.2.js (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/resources/js/jquery.validate.js (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/resources/templates/layout.html (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/resources/templates/messages/form.html (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/resources/templates/messages/list.html (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/main/resources/templates/messages/view.html (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/test/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplicationTests.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-ui-sample => spring-zero-samples/spring-zero-sample-web-ui}/src/test/resources/logging.properties (97%) rename {spring-bootstrap-samples/spring-bootstrap-xml-sample => spring-zero-samples/spring-zero-sample-xml}/pom.xml (51%) rename {spring-bootstrap-samples/spring-bootstrap-xml-sample => spring-zero-samples/spring-zero-sample-xml}/src/main/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplication.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-xml-sample => spring-zero-samples/spring-zero-sample-xml}/src/main/java/org/springframework/bootstrap/sample/xml/service/HelloWorldService.java (100%) rename {spring-bootstrap-samples/spring-bootstrap-xml-sample => spring-zero-samples/spring-zero-sample-xml}/src/main/resources/META-INF/application-context.xml (100%) rename {spring-bootstrap-samples/spring-bootstrap-xml-sample => spring-zero-samples/spring-zero-sample-xml}/src/test/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplicationTests.java (100%) create mode 100644 spring-zero-starters/pom.xml rename {spring-bootstrap-starters/spring-bootstrap-actuator-starter => spring-zero-starters/spring-zero-starter-actuator}/pom.xml (66%) rename {spring-bootstrap-starters/spring-bootstrap-batch-starter => spring-zero-starters/spring-zero-starter-batch}/pom.xml (76%) rename {spring-bootstrap-starters/spring-bootstrap-jpa-starter => spring-zero-starters/spring-zero-starter-data-jpa}/pom.xml (74%) rename {spring-bootstrap-samples/spring-bootstrap-integration-sample => spring-zero-starters/spring-zero-starter-integration}/pom.xml (54%) rename {spring-bootstrap-starters/spring-bootstrap-security-starter => spring-zero-starters/spring-zero-starter-security}/pom.xml (70%) rename {spring-bootstrap-samples/spring-bootstrap-tomcat-sample => spring-zero-starters/spring-zero-starter-web}/pom.xml (70%) rename {spring-bootstrap-starters/spring-bootstrap-starter => spring-zero-starters/spring-zero-starter}/pom.xml (68%) diff --git a/.gitignore b/.gitignore index 5251eb99a9b..3116e183bea 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ build target .springBeans dependency-reduced-pom.xml - +build.log diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d7d0dce8b32..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: java - -install: mvn -U install --quiet -DskipTests=true -script: mvn clean test - diff --git a/pom.xml b/pom.xml index 452f74d91a0..ad61ff648cd 100644 --- a/pom.xml +++ b/pom.xml @@ -2,16 +2,18 @@ 4.0.0 - org.springframework.bootstrap - spring-bootstrap-parent + org.springframework.zero + spring-zero 0.5.0.BUILD-SNAPSHOT pom 3.0.0 + ${basedir} 1.6 UTF-8 + 3.0.5 4.0.0.BUILD-SNAPSHOT 3.1.3.RELEASE 1.0.0.CI-SNAPSHOT @@ -21,47 +23,28 @@ 8.1.9.v20130131 1.7.2 - http://github.com/SpringSource/spring-bootstrap scm:git:git://github.com/SpringSource/spring-bootstrap.git scm:git:ssh://git@github.com/SpringSource/spring-bootstrap.git - - dsyer - Dave Syer - dsyer@gopivotal.com - - - phillweb - Phillip Webb - pweb@gopivotal.com + spring + SpringSource + http://www.springsource.org - - - - http://www.springsource.com/download/community - - - spring-docs - scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-bootstrap/docs/${project.version} - - - - spring-repo-release - Spring Release Repository - http://repo.springsource.org/libs-release-local - - - spring-repo-snapshot - Spring Snapshot Repository - http://repo.springsource.org/libs-snapshot-local - - - + + spring-zero-actuator + spring-zero-autoconfigure + spring-zero-cli + spring-zero-core + spring-zero-intergration-tests + spring-zero-launcher + spring-zero-maven-plugin + spring-zero-starters + @@ -82,7 +65,6 @@ 2.7 - org.apache.maven.plugins maven-dependency-plugin 2.6 @@ -90,6 +72,10 @@ maven-eclipse-plugin 2.9 + + maven-exec-plugin + 1.2.1 + maven-failsafe-plugin 2.13 @@ -106,6 +92,10 @@ maven-jar-plugin 2.4 + + maven-javadoc-plugin + 2.9 + maven-plugin-plugin 3.2 @@ -118,10 +108,6 @@ maven-shade-plugin 2.0 - - maven-surefire-plugin - 2.13 - maven-site-plugin 3.2 @@ -131,17 +117,18 @@ 2.2.1 - maven-javadoc-plugin - 2.9 - - - maven-exec-plugin - 1.2.1 + maven-surefire-plugin + 2.13 maven-war-plugin 2.3 + + org.codehaus.mojo + versions-maven-plugin + 2.0 + @@ -160,11 +147,11 @@ .settings/org.eclipse.jdt.ui.prefs - http://static.springsource.org/sts/jdtconfig/org.eclipse.jdt.ui.prefs + ${main.basedir}/eclipse/org.eclipse.jdt.ui.prefs .settings/org.eclipse.jdt.core.prefs - http://static.springsource.org/sts/jdtconfig/org.eclipse.jdt.core.prefs + ${main.basedir}/eclipse/org.eclipse.jdt.core.prefs @@ -174,22 +161,17 @@ attach-javadocs - verify jar - - - maven-source-plugin attach-sources - verify jar-no-fork @@ -206,16 +188,11 @@ **/Abstract*.java - junit:junit - - file:/dev/./urandom - org.codehaus.mojo versions-maven-plugin - 2.0 @@ -224,7 +201,7 @@ ch.qos.logback logback-classic - 1.0.7 + 1.0.10 com.fasterxml.jackson.core @@ -286,6 +263,46 @@ ivy 2.3.0 + + org.apache.maven + maven-archiver + 2.5 + + + org.apache.maven + maven-artifact + ${maven.version} + + + org.apache.maven + maven-core + ${maven.version} + + + org.apache.maven + maven-model + ${maven.version} + + + org.apache.maven + maven-plugin-api + ${maven.version} + + + org.apache.maven + maven-settings + ${maven.version} + + + org.apache.maven.plugins + maven-shade-plugin + 1.6 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.2 + org.apache.tomcat.embed tomcat-embed-core @@ -326,6 +343,16 @@ groovy-templates 2.1.3 + + org.codehaus.plexus + plexus-archiver + 2.2 + + + org.codehaus.plexus + plexus-utils + 3.0.10 + org.eclipse.jetty jetty-webapp @@ -352,16 +379,16 @@ jetty-annotations ${jetty.version} - - com.h2database - h2 - 1.3.171 - org.hamcrest hamcrest-library 1.3 + + com.h2database + h2 + 1.3.171 + org.hibernate hibernate-entitymanager @@ -387,40 +414,30 @@ mockito-core 1.9.5 + + org.ow2.asm + asm + 4.0 + org.slf4j jcl-over-slf4j - 1.7.2 + 1.7.5 org.slf4j slf4j-api - 1.7.2 + 1.7.5 org.slf4j slf4j-log4j12 - 1.7.2 + 1.7.5 org.slf4j slf4j-jdk14 - 1.7.2 - - - org.springframework.security - spring-security-javaconfig - ${spring.security.javaconfig.version} - - - org.springframework.security - spring-security-web - ${spring.security.version} - - - org.springframework.security - spring-security-core - ${spring.security.version} + 1.7.5 org.springframework @@ -432,11 +449,6 @@ spring-beans ${spring.version} - - org.springframework - spring-expression - ${spring.version} - org.springframework spring-core @@ -460,22 +472,17 @@ org.springframework - spring-web - ${spring.version} - - - org.springframework - spring-jms + spring-expression ${spring.version} org.springframework - spring-webmvc + spring-jdbc ${spring.version} org.springframework - spring-jdbc + spring-jms ${spring.version} @@ -504,16 +511,21 @@ spring-tx ${spring.version} + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + org.springframework.batch spring-batch-core ${spring.batch.version} - - org.springframework.integration - spring-integration-core - ${spring.integration.version} - org.springframework.data spring-data-jpa @@ -530,9 +542,49 @@ - org.springframework.hateoas - spring-hateoas - 0.5.0.RELEASE + org.springframework.integration + spring-integration-core + ${spring.integration.version} + + + org.springframework.integration + spring-integration-file + ${spring.integration.version} + + + org.springframework.integration + spring-integration-http + ${spring.integration.version} + + + org.springframework.integration + spring-integration-ip + ${spring.integration.version} + + + org.springframework.integration + spring-integration-stream + ${spring.integration.version} + + + org.springframework.security + spring-security-core + ${spring.security.version} + + + org.springframework.security + spring-security-javaconfig + ${spring.security.javaconfig.version} + + + org.springframework.security + spring-security-web + ${spring.security.version} + + + org.thymeleaf + thymeleaf + 2.0.16 org.thymeleaf @@ -563,92 +615,27 @@ test - + + http://www.springsource.com/download/community + + spring-docs + scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-bootstrap/docs/${project.version} + + + spring-repo-release + Spring Release Repository + http://repo.springsource.org/libs-release-local + + + spring-repo-snapshot + Spring Snapshot Repository + http://repo.springsource.org/libs-snapshot-local + + - setup - - spring-bootstrap-launcher - spring-bootstrap-maven-plugin - - - - default - - true - - - spring-bootstrap - spring-bootstrap-actuator - spring-bootstrap-cli - spring-bootstrap-launcher - spring-bootstrap-maven-plugin - spring-bootstrap-samples - spring-bootstrap-starters - - - - staging - - - spring-site-staging - file:///${java.io.tmpdir}/spring-bootstrap/docs - - - spring-milestone-staging - file:///${java.io.tmpdir}/spring-bootstrap/milestone - - - spring-snapshot-staging - file:///${java.io.tmpdir}/spring-bootstrap/snapshot - - - - - milestone - - - spring-repo-milestone - Spring Milestone Repository - https://repo.springsource.org/libs-milestone-local - - - - - central - - - sonatype-nexus-snapshots - Sonatype Nexus Snapshots - https://oss.sonatype.org/content/repositories/snapshots/ - - - sonatype-nexus-staging - Nexus Release Repository - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - - org.apache.maven.plugins - maven-gpg-plugin - - - sign-artifacts - verify - - sign - - - - - - - - - bootstrap - + + snapshot-repositories true @@ -671,6 +658,21 @@ + + jdk8 + + 1.8 + + + + + maven-javadoc-plugin + + -Xdoclint:none -quiet + + + + + - diff --git a/spring-bootstrap-samples/pom.xml b/spring-bootstrap-samples/pom.xml deleted file mode 100644 index bdd0ce12334..00000000000 --- a/spring-bootstrap-samples/pom.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - 4.0.0 - - org.springframework.bootstrap - spring-bootstrap-parent - 0.5.0.BUILD-SNAPSHOT - - spring-bootstrap-samples - pom - - spring-bootstrap-sample - spring-bootstrap-actuator-sample - spring-bootstrap-actuator-ui-sample - spring-bootstrap-batch-sample - spring-bootstrap-data-sample - spring-bootstrap-integration-sample - spring-bootstrap-jetty-sample - spring-bootstrap-profile-sample - spring-bootstrap-simple-sample - spring-bootstrap-tomcat-sample - spring-bootstrap-trad-sample - spring-bootstrap-ui-sample - spring-bootstrap-xml-sample - - - - - - org.codehaus.mojo - exec-maven-plugin - - true - ${start-class} - - - - - - - - maven-dependency-plugin - - - unpack - prepare-package - true - - unpack - - - - - ${project.groupId} - spring-bootstrap-launcher - ${project.version} - jar - - - ${project.build.directory}/assembly - - - - copy - prepare-package - true - - copy-dependencies - - - ${project.build.directory}/assembly/lib - runtime - - - - - - - maven-assembly-plugin - - - ${project.parent.basedir}/src/main/assembly/jar-with-dependencies.xml - - - - org.springframework.bootstrap.launcher.JarLauncher - - - ${start-class} - - - - - - jar-with-dependencies - package - true - - single - - - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - ${project.groupId} - spring-bootstrap - ${project.version} - - - - true - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - package - - shade - - - - - META-INF/spring.handlers - - - META-INF/spring.factories - - - META-INF/spring.schemas - - - - ${start-class} - - - - - - - - - - - - ${project.groupId} - spring-bootstrap-maven-plugin - ${project.version} - true - true - - - - maven-deploy-plugin - - true - - - - - - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - - - - org.slf4j - jcl-over-slf4j - runtime - - - diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/pom.xml b/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/pom.xml deleted file mode 100644 index b847540af5b..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - 4.0.0 - - org.springframework.bootstrap - spring-bootstrap-samples - 0.5.0.BUILD-SNAPSHOT - - spring-bootstrap-actuator-ui-sample - - / - org.springframework.bootstrap.sample.ui.UiBootstrapApplication - - - - ${project.groupId} - spring-bootstrap - ${project.version} - - - ${project.groupId} - spring-bootstrap-actuator - ${project.version} - - - org.thymeleaf - thymeleaf-spring3 - - - org.apache.tomcat.embed - tomcat-embed-core - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - - - org.hibernate - hibernate-validator - - - org.slf4j - slf4j-jdk14 - runtime - - - org.springframework.security - spring-security-javaconfig - - - org.springframework.security - spring-security-web - - - - - - maven-dependency-plugin - - - maven-shade-plugin - - - maven-exec-plugin - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.maven.plugins - - - maven-dependency-plugin - - - [2.6,) - - - - copy-dependencies - - - - - - - - - - - - - - - diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/pom.xml b/spring-bootstrap-samples/spring-bootstrap-data-sample/pom.xml deleted file mode 100644 index 9e50bf22c46..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-data-sample/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - 4.0.0 - - org.springframework.bootstrap - spring-bootstrap-samples - 0.5.0.BUILD-SNAPSHOT - - spring-bootstrap-data-sample - executable-jar - - - ${project.groupId} - spring-bootstrap - ${project.version} - - - org.slf4j - slf4j-jdk14 - runtime - - - org.eclipse.jetty - jetty-webapp - runtime - - - org.eclipse.jetty - jetty-util - runtime - - - org.springframework - spring-webmvc - - - javax.servlet - javax.servlet-api - runtime - - - org.springframework - spring-aop - runtime - - - org.springframework - spring-orm - - - org.springframework - spring-jdbc - - - org.hibernate - hibernate-entitymanager - - - org.springframework.data - spring-data-jpa - - - org.hsqldb - hsqldb - runtime - - - diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/.springBeans b/spring-bootstrap-samples/spring-bootstrap-integration-sample/.springBeans deleted file mode 100644 index 51f8f5d53e2..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-integration-sample/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/integration-context.xml - - - - diff --git a/spring-bootstrap-samples/spring-bootstrap-sample/pom.xml b/spring-bootstrap-samples/spring-bootstrap-sample/pom.xml deleted file mode 100644 index 61f9f91b641..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-sample/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - 4.0.0 - - org.springframework.bootstrap - spring-bootstrap-samples - 0.5.0.BUILD-SNAPSHOT - - spring-bootstrap-sample - pom - - - ${project.groupId} - spring-bootstrap - ${project.version} - runtime - - - org.slf4j - slf4j-jdk14 - runtime - - - org.apache.tomcat.embed - tomcat-embed-core - runtime - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - runtime - - - diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/README.txt b/spring-bootstrap-samples/spring-bootstrap-trad-sample/README.txt deleted file mode 100644 index ebad46ee04d..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-trad-sample/README.txt +++ /dev/null @@ -1,17 +0,0 @@ -This is a simple template for creating issue reproduction projects per -the README.markdown file in the root of this repository (and at -https://github.com/cbeams/spring-framework-issues#readme). Please read -that document completely before starting. - -As described at the link above, copy this project to a new directory -having the same name as the JIRA issue you're trying to reproduce and -edit from there. - -Both Gradle (build.gradle) and Maven (pom.xml) build scripts are -included for your convenience and choice. Once you've created your -copy of this directory, delete whichever build script you don't wish -to use, and then edit the remaining one to suit your needs. - -Note that this project contains a log4j.properties file in -src/test/resources that you may wish to configure to emit more detailed -logging. The log level for org.springframework is set to WARN by default. diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/pom.xml b/spring-bootstrap-samples/spring-bootstrap-trad-sample/pom.xml deleted file mode 100644 index ff254ddd491..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-trad-sample/pom.xml +++ /dev/null @@ -1,168 +0,0 @@ - - 4.0.0 - - org.springframework.bootstrap - spring-bootstrap-samples - 0.5.0.BUILD-SNAPSHOT - - spring-bootstrap-trad-sample - spring-bootstrap-trad-sample - war - - - / - org.springframework.bootstrap.sample.trad.TradBootstrapApplication - - - - - - org.springframework - spring-context - - - - commons-logging - commons-logging - - - - - org.springframework - spring-webmvc - - - - - org.slf4j - slf4j-api - - - org.slf4j - jcl-over-slf4j - runtime - - - org.slf4j - slf4j-log4j12 - runtime - - - log4j - log4j - runtime - - - - - ${project.groupId} - spring-bootstrap - ${project.version} - provided - - - org.apache.tomcat.embed - tomcat-embed-core - provided - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - provided - - - org.apache.tomcat.embed - tomcat-embed-jasper - provided - - - - - - - - org.codehaus.mojo - exec-maven-plugin - - true - ${start-class} - - - - ${project.groupId} - spring-bootstrap - ${project.version} - - - org.apache.tomcat.embed - tomcat-embed-core - ${tomcat.version} - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - ${tomcat.version} - - - org.apache.tomcat.embed - tomcat-embed-jasper - ${tomcat.version} - - - - - org.apache.maven.plugins - maven-war-plugin - - - - org.springframework.bootstrap.launcher.WarLauncher - - - org.springframework.bootstrap.sample.trad.TradBootstrapApplication - - - false - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack - prepare-package - - unpack - - - - - ${project.groupId} - spring-bootstrap-launcher - ${project.version} - jar - - - ${project.build.directory}/${project.artifactId}-${project.version} - - - - copy - prepare-package - - copy-dependencies - - - provided - ${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib-provided - - - - - - - - - diff --git a/spring-bootstrap-samples/src/main/assembly/jar-with-dependencies.xml b/spring-bootstrap-samples/src/main/assembly/jar-with-dependencies.xml deleted file mode 100644 index 44626f91aa1..00000000000 --- a/spring-bootstrap-samples/src/main/assembly/jar-with-dependencies.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - full - - jar - - false - - - - - ${project.groupId}:${project.artifactId} - - true - - - - - ${project.build.directory}/assembly - / - - - diff --git a/spring-bootstrap-starters/pom.xml b/spring-bootstrap-starters/pom.xml deleted file mode 100644 index 5867cea47fb..00000000000 --- a/spring-bootstrap-starters/pom.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - 4.0.0 - - org.springframework.bootstrap - spring-bootstrap-parent - 0.5.0.BUILD-SNAPSHOT - - spring-bootstrap-starters - pom - - UTF-8 - UTF-8 - 0.5.0.BUILD-SNAPSHOT - org.springframework.bootstrap.main.Spring - - - spring-bootstrap-starter - spring-bootstrap-actuator-starter - spring-bootstrap-batch-starter - spring-bootstrap-integration-starter - spring-bootstrap-jpa-starter - spring-bootstrap-security-starter - spring-bootstrap-tomcat-starter - spring-bootstrap-web-starter - - - - - org.springframework.bootstrap - spring-bootstrap - ${spring.bootstrap.version} - - - org.springframework.bootstrap - spring-bootstrap-actuator - ${spring.bootstrap.version} - - - org.springframework.bootstrap - spring-bootstrap-starter - ${spring.bootstrap.version} - - - org.springframework.bootstrap - spring-bootstrap-actuator-starter - ${spring.bootstrap.version} - - - org.springframework.bootstrap - spring-bootstrap-web-starter - ${spring.bootstrap.version} - - - org.springframework.bootstrap - spring-bootstrap-tomcat-starter - ${spring.bootstrap.version} - - - org.springframework.bootstrap - spring-bootstrap-jpa-starter - ${spring.bootstrap.version} - - - org.springframework.bootstrap - spring-bootstrap-batch-starter - ${spring.bootstrap.version} - - - org.springframework.bootstrap - spring-bootstrap-integration-starter - ${spring.bootstrap.version} - - - org.springframework.bootstrap - spring-bootstrap-security-starter - ${spring.bootstrap.version} - - - - - - org.springframework - spring-test - - - commons-logging - commons-logging - - - test - - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.hamcrest - hamcrest-library - test - - - - - - - org.springframework.bootstrap - spring-bootstrap-maven-plugin - ${spring.bootstrap.version} - true - true - - - - - - - org.codehaus.mojo - exec-maven-plugin - - true - ${start-class} - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - org.springframework.bootstrap - spring-bootstrap - ${spring.bootstrap.version} - - - - true - true - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - package - - shade - - - - - META-INF/spring.handlers - - - META-INF/spring.factories - - - META-INF/spring.schemas - - - - ${start-class} - - - - - - - - - - diff --git a/spring-bootstrap-starters/spring-bootstrap-integration-starter/pom.xml b/spring-bootstrap-starters/spring-bootstrap-integration-starter/pom.xml deleted file mode 100644 index ed1f279a4d6..00000000000 --- a/spring-bootstrap-starters/spring-bootstrap-integration-starter/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - org.springframework.bootstrap - spring-bootstrap-starters - 0.5.0.BUILD-SNAPSHOT - - spring-bootstrap-integration-starter - jar - - - ${project.groupId} - spring-bootstrap-starter - ${project.version} - - - org.springframework.integration - spring-integration-core - - - diff --git a/spring-bootstrap-starters/spring-bootstrap-tomcat-starter/pom.xml b/spring-bootstrap-starters/spring-bootstrap-tomcat-starter/pom.xml deleted file mode 100644 index 25550156b8f..00000000000 --- a/spring-bootstrap-starters/spring-bootstrap-tomcat-starter/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - org.springframework.bootstrap - spring-bootstrap-starters - 0.5.0.BUILD-SNAPSHOT - - spring-bootstrap-tomcat-starter - - - org.springframework.bootstrap - spring-bootstrap-starter - - - org.apache.tomcat.embed - tomcat-embed-core - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - - - org.springframework - spring-webmvc - - - commons-logging - commons-logging - - - - - javax.servlet - javax.servlet-api - - - diff --git a/spring-bootstrap-actuator/README.md b/spring-zero-actuator/README.md similarity index 100% rename from spring-bootstrap-actuator/README.md rename to spring-zero-actuator/README.md diff --git a/spring-bootstrap-actuator/docs/Features.md b/spring-zero-actuator/docs/Features.md similarity index 100% rename from spring-bootstrap-actuator/docs/Features.md rename to spring-zero-actuator/docs/Features.md diff --git a/spring-bootstrap-actuator/pom.xml b/spring-zero-actuator/pom.xml similarity index 80% rename from spring-bootstrap-actuator/pom.xml rename to spring-zero-actuator/pom.xml index 884f8360708..528da315bda 100644 --- a/spring-bootstrap-actuator/pom.xml +++ b/spring-zero-actuator/pom.xml @@ -3,47 +3,53 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-parent + org.springframework.zero + spring-zero 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-actuator + spring-zero-actuator jar + + ${basedir}/.. + + - org.springframework.bootstrap - spring-bootstrap + ${project.groupId} + spring-zero-autoconfigure ${project.version} - org.springframework - spring-webmvc + com.fasterxml.jackson.core + jackson-databind - org.springframework - spring-core + org.hibernate + hibernate-validator org.springframework - spring-expression + spring-core org.springframework - spring-test - test + spring-context + javax.servlet javax.servlet-api - provided + true - org.hibernate - hibernate-validator + org.springframework + spring-test + test - com.fasterxml.jackson.core - jackson-databind + org.springframework + spring-webmvc + true org.springframework.security @@ -60,6 +66,7 @@ tomcat-embed-core true + org.apache.tomcat.embed tomcat-embed-logging-juli diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java similarity index 100% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java rename to spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java diff --git a/spring-bootstrap-actuator/src/main/resources/META-INF/spring.factories b/spring-zero-actuator/src/main/resources/META-INF/spring.factories similarity index 100% rename from spring-bootstrap-actuator/src/main/resources/META-INF/spring.factories rename to spring-zero-actuator/src/main/resources/META-INF/spring.factories diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java similarity index 100% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java rename to spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java diff --git a/spring-bootstrap-actuator/src/test/resources/git.properties b/spring-zero-actuator/src/test/resources/git.properties similarity index 100% rename from spring-bootstrap-actuator/src/test/resources/git.properties rename to spring-zero-actuator/src/test/resources/git.properties diff --git a/spring-bootstrap/pom.xml b/spring-zero-autoconfigure/pom.xml similarity index 61% rename from spring-bootstrap/pom.xml rename to spring-zero-autoconfigure/pom.xml index a1a7848fbf2..2de900f63b9 100644 --- a/spring-bootstrap/pom.xml +++ b/spring-zero-autoconfigure/pom.xml @@ -3,45 +3,31 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-parent + org.springframework.zero + spring-zero 0.5.0.BUILD-SNAPSHOT - spring-bootstrap + spring-zero-autoconfigure jar + + ${basedir}/.. + + - org.springframework - spring-core - - - org.springframework - spring-context + ${project.groupId} + spring-zero-core + ${project.version} - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - true - - - javax.servlet - javax.servlet-api - true - - - org.hibernate - hibernate-validator - true - - - org.yaml - snakeyaml + commons-dbcp + commons-dbcp true - com.fasterxml.jackson.core - jackson-databind + nz.net.ultraq.web.thymeleaf + thymeleaf-layout-dialect true @@ -55,18 +41,18 @@ true - commons-dbcp - commons-dbcp + org.eclipse.jetty + jetty-webapp true - org.eclipse.jetty - jetty-webapp + org.hibernate + hibernate-entitymanager true - org.eclipse.jetty - jetty-util + org.hibernate.javax.persistence + hibernate-jpa-2.0-api true @@ -94,35 +80,19 @@ spring-webmvc true - - org.springframework.data - spring-data-jpa - true - - - org.springframework.hateoas - spring-hateoas - true - org.springframework.batch spring-batch-core true - org.springframework.integration - spring-integration-core - true - - - ch.qos.logback - logback-classic + org.springframework.data + spring-data-jpa true - org.apache.maven.plugins - maven-shade-plugin - 1.6 + org.thymeleaf + thymeleaf true @@ -130,17 +100,14 @@ thymeleaf-spring3 true + - nz.net.ultraq.web.thymeleaf - thymeleaf-layout-dialect - true - - - org.hibernate - hibernate-entitymanager - true + ${project.groupId} + spring-zero-core + ${project.version} + tests + test - org.hsqldb hsqldb @@ -151,15 +118,5 @@ spring-test test - - commons-httpclient - commons-httpclient - test - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - test - diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/main/Spring.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/main/Spring.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/main/Spring.java rename to spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/main/Spring.java index 5a1f2bb5a00..9122239abcd 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/main/Spring.java +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/main/Spring.java @@ -41,6 +41,8 @@ import org.springframework.util.ClassUtils; @ComponentScan public class Spring { + // FIXME can we delete this? is it used? does it belong here + private static ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( true); diff --git a/spring-bootstrap/src/main/resources/META-INF/spring.factories b/spring-zero-autoconfigure/src/main/resources/META-INF/spring.factories similarity index 66% rename from spring-bootstrap/src/main/resources/META-INF/spring.factories rename to spring-zero-autoconfigure/src/main/resources/META-INF/spring.factories index 7836cb266bd..117934f2920 100644 --- a/spring-bootstrap/src/main/resources/META-INF/spring.factories +++ b/spring-zero-autoconfigure/src/main/resources/META-INF/spring.factories @@ -12,11 +12,3 @@ org.springframework.bootstrap.autoconfigure.web.EmbeddedServletContainerAutoConf org.springframework.bootstrap.autoconfigure.web.ServerPropertiesAutoConfiguration,\ org.springframework.bootstrap.autoconfigure.web.MultipartAutoConfiguration,\ org.springframework.bootstrap.autoconfigure.web.WebMvcAutoConfiguration - -# Application Context Initializers -org.springframework.context.ApplicationContextInitializer=\ -org.springframework.bootstrap.context.initializer.ConfigFileApplicationContextInitializer,\ -org.springframework.bootstrap.context.initializer.ContextIdApplicationContextInitializer,\ -org.springframework.bootstrap.context.initializer.EnvironmentDelegateApplicationContextInitializer,\ -org.springframework.bootstrap.context.initializer.LoggingApplicationContextInitializer,\ -org.springframework.bootstrap.context.initializer.VcapApplicationContextInitializer diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/AdhocTestSuite.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/AdhocTestSuite.java similarity index 95% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/AdhocTestSuite.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/AdhocTestSuite.java index 76562ed241b..fbba0d82340 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/AdhocTestSuite.java +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/AdhocTestSuite.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap; +package org.springframework.bootstrap.autoconfigure; import org.junit.Ignore; import org.junit.runner.RunWith; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringJUnitTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/SpringJUnitTests.java similarity index 93% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringJUnitTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/SpringJUnitTests.java index 4614dd944f9..7b2b79b4feb 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringJUnitTests.java +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/SpringJUnitTests.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap; +package org.springframework.bootstrap.autoconfigure; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.SpringJUnitTests.TestConfiguration; import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.bootstrap.autoconfigure.SpringJUnitTests.TestConfiguration; import org.springframework.bootstrap.context.initializer.ConfigFileApplicationContextInitializer; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java rename to spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java diff --git a/spring-bootstrap/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql b/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql similarity index 100% rename from spring-bootstrap/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql rename to spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql diff --git a/spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/annotation/foo.xml b/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/annotation/foo.xml similarity index 100% rename from spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/annotation/foo.xml rename to spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/annotation/foo.xml diff --git a/spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml b/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/annotation/testProperties.xml similarity index 100% rename from spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml rename to spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/annotation/testProperties.xml diff --git a/spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/embedded/conf.properties b/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/embedded/conf.properties similarity index 100% rename from spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/embedded/conf.properties rename to spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/embedded/conf.properties diff --git a/spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml b/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml similarity index 100% rename from spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml rename to spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml diff --git a/spring-bootstrap/src/test/resources/org/springframework/bootstrap/sample-beans.xml b/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/sample-beans.xml similarity index 100% rename from spring-bootstrap/src/test/resources/org/springframework/bootstrap/sample-beans.xml rename to spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/sample-beans.xml diff --git a/spring-bootstrap/src/test/resources/static/css/style.css b/spring-zero-autoconfigure/src/test/resources/fixme/static/css/style.css similarity index 100% rename from spring-bootstrap/src/test/resources/static/css/style.css rename to spring-zero-autoconfigure/src/test/resources/fixme/static/css/style.css diff --git a/spring-zero-autoconfigure/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql b/spring-zero-autoconfigure/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql new file mode 100644 index 00000000000..38de8810573 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE FOO ( + id INTEGER IDENTITY PRIMARY KEY, + name VARCHAR(30), +); \ No newline at end of file diff --git a/spring-bootstrap/src/test/resources/templates/layout.html b/spring-zero-autoconfigure/src/test/resources/templates/layout.html similarity index 100% rename from spring-bootstrap/src/test/resources/templates/layout.html rename to spring-zero-autoconfigure/src/test/resources/templates/layout.html diff --git a/spring-bootstrap/src/test/resources/templates/template.txt b/spring-zero-autoconfigure/src/test/resources/templates/template.txt similarity index 100% rename from spring-bootstrap/src/test/resources/templates/template.txt rename to spring-zero-autoconfigure/src/test/resources/templates/template.txt diff --git a/spring-bootstrap/src/test/resources/templates/tiles.xml b/spring-zero-autoconfigure/src/test/resources/templates/tiles.xml similarity index 100% rename from spring-bootstrap/src/test/resources/templates/tiles.xml rename to spring-zero-autoconfigure/src/test/resources/templates/tiles.xml diff --git a/spring-bootstrap/src/test/resources/templates/view.html b/spring-zero-autoconfigure/src/test/resources/templates/view.html similarity index 100% rename from spring-bootstrap/src/test/resources/templates/view.html rename to spring-zero-autoconfigure/src/test/resources/templates/view.html diff --git a/spring-bootstrap/src/test/resources/test/messages.properties b/spring-zero-autoconfigure/src/test/resources/test/messages.properties similarity index 100% rename from spring-bootstrap/src/test/resources/test/messages.properties rename to spring-zero-autoconfigure/src/test/resources/test/messages.properties diff --git a/spring-bootstrap-cli/pom.xml b/spring-zero-cli/pom.xml similarity index 70% rename from spring-bootstrap-cli/pom.xml rename to spring-zero-cli/pom.xml index 6f7b0fc119c..8dfb51468dc 100644 --- a/spring-bootstrap-cli/pom.xml +++ b/spring-zero-cli/pom.xml @@ -3,28 +3,42 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-parent + org.springframework.zero + spring-zero 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-cli + spring-zero-cli jar + ${basedir}/.. org.springframework.bootstrap.cli.SpringBootstrapCli + + + + net.sf.jopt-simple + jopt-simple + + + org.apache.ivy + ivy + + + org.codehaus.groovy + groovy + + + + org.codehaus.groovy + groovy-templates + true + + maven-shade-plugin - - - ${project.groupId} - spring-bootstrap - ${project.version} - - - true *:* @@ -44,18 +58,6 @@ - - META-INF/spring.handlers - - - META-INF/spring.factories - - - META-INF/spring.schemas - - - - org.codehaus.groovy - groovy - - - org.codehaus.groovy - groovy-templates - true - - - org.apache.ivy - ivy - - - net.sf.jopt-simple - jopt-simple - - diff --git a/spring-bootstrap-cli/samples/actuator.groovy b/spring-zero-cli/samples/actuator.groovy similarity index 100% rename from spring-bootstrap-cli/samples/actuator.groovy rename to spring-zero-cli/samples/actuator.groovy diff --git a/spring-bootstrap-cli/samples/app.groovy b/spring-zero-cli/samples/app.groovy similarity index 100% rename from spring-bootstrap-cli/samples/app.groovy rename to spring-zero-cli/samples/app.groovy diff --git a/spring-bootstrap-cli/samples/integration.groovy b/spring-zero-cli/samples/integration.groovy similarity index 100% rename from spring-bootstrap-cli/samples/integration.groovy rename to spring-zero-cli/samples/integration.groovy diff --git a/spring-bootstrap-cli/samples/job.groovy b/spring-zero-cli/samples/job.groovy similarity index 100% rename from spring-bootstrap-cli/samples/job.groovy rename to spring-zero-cli/samples/job.groovy diff --git a/spring-bootstrap-cli/samples/runner.groovy b/spring-zero-cli/samples/runner.groovy similarity index 100% rename from spring-bootstrap-cli/samples/runner.groovy rename to spring-zero-cli/samples/runner.groovy diff --git a/spring-bootstrap-cli/samples/runner.xml b/spring-zero-cli/samples/runner.xml similarity index 100% rename from spring-bootstrap-cli/samples/runner.xml rename to spring-zero-cli/samples/runner.xml diff --git a/spring-bootstrap-cli/samples/template.groovy b/spring-zero-cli/samples/template.groovy similarity index 100% rename from spring-bootstrap-cli/samples/template.groovy rename to spring-zero-cli/samples/template.groovy diff --git a/spring-bootstrap-cli/samples/ui.groovy b/spring-zero-cli/samples/ui.groovy similarity index 100% rename from spring-bootstrap-cli/samples/ui.groovy rename to spring-zero-cli/samples/ui.groovy diff --git a/spring-bootstrap-cli/samples/web.groovy b/spring-zero-cli/samples/web.groovy similarity index 100% rename from spring-bootstrap-cli/samples/web.groovy rename to spring-zero-cli/samples/web.groovy diff --git a/spring-bootstrap-cli/src/main/assembly/descriptor.xml b/spring-zero-cli/src/main/assembly/descriptor.xml similarity index 100% rename from spring-bootstrap-cli/src/main/assembly/descriptor.xml rename to spring-zero-cli/src/main/assembly/descriptor.xml diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/Command.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/Command.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/Command.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/Command.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/CommandFactory.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/CommandFactory.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/CommandFactory.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/CommandFactory.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/NoSuchCommandException.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/NoSuchCommandException.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/NoSuchCommandException.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/NoSuchCommandException.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/AbstractCommand.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/AbstractCommand.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/AbstractCommand.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/AbstractCommand.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/CleanCommand.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/CleanCommand.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/CleanCommand.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/CleanCommand.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/CreateCommand.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/CreateCommand.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/CreateCommand.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/CreateCommand.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/DefaultCommandFactory.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/DefaultCommandFactory.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/DefaultCommandFactory.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/DefaultCommandFactory.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionHandler.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionHandler.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionHandler.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionHandler.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionParsingCommand.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionParsingCommand.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionParsingCommand.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionParsingCommand.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/RunCommand.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/RunCommand.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/RunCommand.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/RunCommand.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCommand.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCommand.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCommand.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCommand.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCompilationCustomizer.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCompilationCustomizer.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCompilationCustomizer.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCompilationCustomizer.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/VersionCommand.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/VersionCommand.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/command/VersionCommand.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/VersionCommand.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/CompilerAutoConfiguration.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/CompilerAutoConfiguration.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/CompilerAutoConfiguration.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/CompilerAutoConfiguration.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/DependencyCustomizer.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/DependencyCustomizer.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/DependencyCustomizer.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/DependencyCustomizer.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/ExtendedGroovyClassLoader.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/ExtendedGroovyClassLoader.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/ExtendedGroovyClassLoader.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/ExtendedGroovyClassLoader.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompiler.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompiler.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompiler.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompiler.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompilerConfiguration.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompilerConfiguration.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompilerConfiguration.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompilerConfiguration.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java similarity index 98% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java index 3ddb15c9048..d52990b7f70 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java +++ b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java @@ -40,8 +40,8 @@ public class SpringBootstrapCompilerAutoConfiguration extends CompilerAutoConfig public void applyDependencies(DependencyCustomizer dependencies) { dependencies.ifAnyMissingClasses( "org.springframework.bootstrap.SpringApplication").add( - "org.springframework.bootstrap", "spring-bootstrap", - "0.5.0.BUILD-SNAPSHOT"); + "org.springframework.zero", "spring-zero-autoconfigure", + "0.0.1.BUILD-SNAPSHOT"); dependencies.ifAnyResourcesPresent("logback.xml").add("ch.qos.logback", "logback-classic", "1.0.7"); dependencies.ifNotAdded("cg.qos.logback", "logback-classic") diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunner.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunner.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunner.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunner.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunnerConfiguration.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunnerConfiguration.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunnerConfiguration.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunnerConfiguration.java diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/template/GroovyTemplate.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/template/GroovyTemplate.java similarity index 100% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/template/GroovyTemplate.java rename to spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/template/GroovyTemplate.java diff --git a/spring-bootstrap-cli/src/main/resources/.gitignore b/spring-zero-cli/src/main/resources/.gitignore similarity index 100% rename from spring-bootstrap-cli/src/main/resources/.gitignore rename to spring-zero-cli/src/main/resources/.gitignore diff --git a/spring-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.CommandFactory b/spring-zero-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.CommandFactory similarity index 100% rename from spring-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.CommandFactory rename to spring-zero-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.CommandFactory diff --git a/spring-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration b/spring-zero-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration similarity index 100% rename from spring-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration rename to spring-zero-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration diff --git a/spring-bootstrap-cli/src/main/scripts/spring b/spring-zero-cli/src/main/scripts/spring similarity index 100% rename from spring-bootstrap-cli/src/main/scripts/spring rename to spring-zero-cli/src/main/scripts/spring diff --git a/spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SampleIntegrationTests.java b/spring-zero-cli/src/test/java/org/springframework/bootstrap/cli/SampleIntegrationTests.java similarity index 100% rename from spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SampleIntegrationTests.java rename to spring-zero-cli/src/test/java/org/springframework/bootstrap/cli/SampleIntegrationTests.java diff --git a/spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java b/spring-zero-cli/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java similarity index 100% rename from spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java rename to spring-zero-cli/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java diff --git a/spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/command/ScriptCommandTests.java b/spring-zero-cli/src/test/java/org/springframework/bootstrap/cli/command/ScriptCommandTests.java similarity index 100% rename from spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/command/ScriptCommandTests.java rename to spring-zero-cli/src/test/java/org/springframework/bootstrap/cli/command/ScriptCommandTests.java diff --git a/spring-bootstrap-cli/src/test/resources/commands/closure.groovy b/spring-zero-cli/src/test/resources/commands/closure.groovy similarity index 100% rename from spring-bootstrap-cli/src/test/resources/commands/closure.groovy rename to spring-zero-cli/src/test/resources/commands/closure.groovy diff --git a/spring-bootstrap-cli/src/test/resources/commands/command.groovy b/spring-zero-cli/src/test/resources/commands/command.groovy similarity index 100% rename from spring-bootstrap-cli/src/test/resources/commands/command.groovy rename to spring-zero-cli/src/test/resources/commands/command.groovy diff --git a/spring-bootstrap-cli/src/test/resources/commands/handler.groovy b/spring-zero-cli/src/test/resources/commands/handler.groovy similarity index 100% rename from spring-bootstrap-cli/src/test/resources/commands/handler.groovy rename to spring-zero-cli/src/test/resources/commands/handler.groovy diff --git a/spring-bootstrap-cli/src/test/resources/commands/mixin.groovy b/spring-zero-cli/src/test/resources/commands/mixin.groovy similarity index 100% rename from spring-bootstrap-cli/src/test/resources/commands/mixin.groovy rename to spring-zero-cli/src/test/resources/commands/mixin.groovy diff --git a/spring-bootstrap-cli/src/test/resources/commands/runnable.groovy b/spring-zero-cli/src/test/resources/commands/runnable.groovy similarity index 100% rename from spring-bootstrap-cli/src/test/resources/commands/runnable.groovy rename to spring-zero-cli/src/test/resources/commands/runnable.groovy diff --git a/spring-bootstrap-cli/src/test/resources/commands/script.groovy b/spring-zero-cli/src/test/resources/commands/script.groovy similarity index 100% rename from spring-bootstrap-cli/src/test/resources/commands/script.groovy rename to spring-zero-cli/src/test/resources/commands/script.groovy diff --git a/spring-bootstrap-cli/src/test/resources/commands/test.groovy b/spring-zero-cli/src/test/resources/commands/test.groovy similarity index 100% rename from spring-bootstrap-cli/src/test/resources/commands/test.groovy rename to spring-zero-cli/src/test/resources/commands/test.groovy diff --git a/spring-bootstrap-cli/src/test/resources/css/bootstrap.min.css b/spring-zero-cli/src/test/resources/css/bootstrap.min.css similarity index 100% rename from spring-bootstrap-cli/src/test/resources/css/bootstrap.min.css rename to spring-zero-cli/src/test/resources/css/bootstrap.min.css diff --git a/spring-bootstrap-cli/src/test/resources/log4j.properties b/spring-zero-cli/src/test/resources/log4j.properties similarity index 100% rename from spring-bootstrap-cli/src/test/resources/log4j.properties rename to spring-zero-cli/src/test/resources/log4j.properties diff --git a/spring-bootstrap-cli/src/test/resources/templates/home.html b/spring-zero-cli/src/test/resources/templates/home.html similarity index 100% rename from spring-bootstrap-cli/src/test/resources/templates/home.html rename to spring-zero-cli/src/test/resources/templates/home.html diff --git a/spring-bootstrap-cli/src/test/resources/templates/test.txt b/spring-zero-cli/src/test/resources/templates/test.txt similarity index 100% rename from spring-bootstrap-cli/src/test/resources/templates/test.txt rename to spring-zero-cli/src/test/resources/templates/test.txt diff --git a/spring-zero-core/pom.xml b/spring-zero-core/pom.xml new file mode 100644 index 00000000000..0eeb3c4ab62 --- /dev/null +++ b/spring-zero-core/pom.xml @@ -0,0 +1,117 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero + 0.5.0.BUILD-SNAPSHOT + + spring-zero-core + jar + + ${basedir}/.. + + + + + org.springframework + spring-core + + + org.springframework + spring-context + + + + ch.qos.logback + logback-classic + true + + + com.fasterxml.jackson.core + jackson-databind + true + + + javax.servlet + javax.servlet-api + true + + + org.apache.tomcat.embed + tomcat-embed-core + true + + + org.eclipse.jetty + jetty-webapp + true + + + org.eclipse.jetty + jetty-util + true + + + org.hibernate + hibernate-validator + true + + + org.slf4j + slf4j-api + true + + + org.springframework + spring-web + true + + + org.yaml + snakeyaml + true + + + + commons-httpclient + commons-httpclient + test + + + org.apache.tomcat.embed + tomcat-embed-logging-juli + test + + + org.springframework + spring-test + test + + + org.springframework + spring-webmvc + test + + + org.slf4j + jcl-over-slf4j + test + + + + + + maven-jar-plugin + + + + test-jar + + + + + + + diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/Banner.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/Banner.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/Banner.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/Banner.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/CommandLineRunner.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/CommandLineRunner.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/CommandLineRunner.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/CommandLineRunner.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/ExitCodeGenerator.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/ExitCodeGenerator.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/ExitCodeGenerator.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/ExitCodeGenerator.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/SpringApplication.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/SpringApplication.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/SpringApplication.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/SpringApplication.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParser.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/config/JsonParser.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParser.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/config/JsonParser.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBean.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBean.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBean.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBean.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AbstractOnBeanCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/AbstractOnBeanCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AbstractOnBeanCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/AbstractOnBeanCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBean.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBean.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBean.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBean.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBeanCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBeanCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBeanCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBeanCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionLogUtils.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionLogUtils.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionLogUtils.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionLogUtils.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnBean.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnBean.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnBean.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnBean.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnClass.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnClass.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnClass.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnClass.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnExpression.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnExpression.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnExpression.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnExpression.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingBean.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingBean.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingBean.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingBean.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingClass.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingClass.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingClass.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingClass.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnNotWebApplication.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnNotWebApplication.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnNotWebApplication.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnNotWebApplication.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnResource.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnResource.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnResource.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnResource.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnWebApplication.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnWebApplication.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnWebApplication.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnWebApplication.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationProperties.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationProperties.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationProperties.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationProperties.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationPropertiesBindingConfiguration.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationPropertiesBindingConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationPropertiesBindingConfiguration.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationPropertiesBindingConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationProperties.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationProperties.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationProperties.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationProperties.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesImportSelector.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesImportSelector.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesImportSelector.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesImportSelector.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnBeanCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnBeanCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnBeanCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnBeanCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnClassCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnClassCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnClassCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnClassCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnExpressionCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnExpressionCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnExpressionCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnExpressionCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingBeanCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingBeanCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingBeanCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingBeanCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingClassCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingClassCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingClassCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingClassCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnNotWebApplicationCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnNotWebApplicationCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnNotWebApplicationCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnNotWebApplicationCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnResourceCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnResourceCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnResourceCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnResourceCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnWebApplicationCondition.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnWebApplicationCondition.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnWebApplicationCondition.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnWebApplicationCondition.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/PropertySourcesBindingPostProcessor.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/PropertySourcesBindingPostProcessor.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/PropertySourcesBindingPostProcessor.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/PropertySourcesBindingPostProcessor.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ConfigurableEmbeddedServletContainerFactory.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ConfigurableEmbeddedServletContainerFactory.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ConfigurableEmbeddedServletContainerFactory.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ConfigurableEmbeddedServletContainerFactory.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerException.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerException.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerException.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerException.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerFactory.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerFactory.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerFactory.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerFactory.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ErrorPage.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ErrorPage.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ErrorPage.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ErrorPage.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/RegistrationBean.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/RegistrationBean.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/RegistrationBean.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/RegistrationBean.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ServletContextInitializer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ServletContextInitializer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ServletContextInitializer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ServletContextInitializer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/WebApplicationContextServletContextAwareProcessor.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/WebApplicationContextServletContextAwareProcessor.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/WebApplicationContextServletContextAwareProcessor.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/WebApplicationContextServletContextAwareProcessor.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/ServletContextInitializerConfiguration.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/ServletContextInitializerConfiguration.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/ServletContextInitializerConfiguration.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/ServletContextInitializerConfiguration.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/package-info.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/package-info.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/package-info.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/package-info.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/package-info.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/package-info.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/package-info.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/package-info.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/package-info.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/package-info.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/package-info.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/package-info.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java rename to spring-zero-core/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java diff --git a/spring-zero-core/src/main/resources/META-INF/spring.factories b/spring-zero-core/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000000..03db1ac821f --- /dev/null +++ b/spring-zero-core/src/main/resources/META-INF/spring.factories @@ -0,0 +1,7 @@ +# Application Context Initializers +org.springframework.context.ApplicationContextInitializer=\ +org.springframework.bootstrap.context.initializer.ConfigFileApplicationContextInitializer,\ +org.springframework.bootstrap.context.initializer.ContextIdApplicationContextInitializer,\ +org.springframework.bootstrap.context.initializer.EnvironmentDelegateApplicationContextInitializer,\ +org.springframework.bootstrap.context.initializer.LoggingApplicationContextInitializer,\ +org.springframework.bootstrap.context.initializer.VcapApplicationContextInitializer diff --git a/spring-bootstrap/src/main/resources/favicon.ico b/spring-zero-core/src/main/resources/favicon.ico similarity index 100% rename from spring-bootstrap/src/main/resources/favicon.ico rename to spring-zero-core/src/main/resources/favicon.ico diff --git a/spring-bootstrap/src/main/resources/org/springframework/bootstrap/logging/log4j.properties b/spring-zero-core/src/main/resources/org/springframework/bootstrap/logging/log4j.properties similarity index 97% rename from spring-bootstrap/src/main/resources/org/springframework/bootstrap/logging/log4j.properties rename to spring-zero-core/src/main/resources/org/springframework/bootstrap/logging/log4j.properties index 710dcac51b5..6442a1edf7e 100644 --- a/spring-bootstrap/src/main/resources/org/springframework/bootstrap/logging/log4j.properties +++ b/spring-zero-core/src/main/resources/org/springframework/bootstrap/logging/log4j.properties @@ -1,18 +1,18 @@ -log4j.rootCategory=INFO, CONSOLE, FILE - -PID=???? -catalina.base=/tmp -LOG_PATH=${catalina.base}/logs -LOG_FILE=${LOG_PATH}/service.log -LOG_PATTERN=[%d{yyyy-MM-dd HH:mm:ss.SSS}] service%X{context} - ${PID} %5p [%t] --- %c{1}: %m%n - -# CONSOLE is set to be a ConsoleAppender using a PatternLayout. -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=${LOG_PATTERN} - -log4j.appender.FILE=org.apache.log4j.RollingFileAppender -log4j.appender.FILE.File=${LOG_FILE} -log4j.appender.FILE.MaxFileSize=10MB -log4j.appender.FILE.layout = org.apache.log4j.PatternLayout -log4j.appender.FILE.layout.ConversionPattern=${LOG_PATTERN} +log4j.rootCategory=INFO, CONSOLE, FILE + +PID=???? +catalina.base=/tmp +LOG_PATH=${catalina.base}/logs +LOG_FILE=${LOG_PATH}/service.log +LOG_PATTERN=[%d{yyyy-MM-dd HH:mm:ss.SSS}] service%X{context} - ${PID} %5p [%t] --- %c{1}: %m%n + +# CONSOLE is set to be a ConsoleAppender using a PatternLayout. +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=${LOG_PATTERN} + +log4j.appender.FILE=org.apache.log4j.RollingFileAppender +log4j.appender.FILE.File=${LOG_FILE} +log4j.appender.FILE.MaxFileSize=10MB +log4j.appender.FILE.layout = org.apache.log4j.PatternLayout +log4j.appender.FILE.layout.ConversionPattern=${LOG_PATTERN} diff --git a/spring-bootstrap/src/main/resources/org/springframework/bootstrap/logging/logback.xml b/spring-zero-core/src/main/resources/org/springframework/bootstrap/logging/logback.xml similarity index 100% rename from spring-bootstrap/src/main/resources/org/springframework/bootstrap/logging/logback.xml rename to spring-zero-core/src/main/resources/org/springframework/bootstrap/logging/logback.xml diff --git a/spring-bootstrap/src/main/resources/org/springframework/bootstrap/logging/logging.properties b/spring-zero-core/src/main/resources/org/springframework/bootstrap/logging/logging.properties similarity index 87% rename from spring-bootstrap/src/main/resources/org/springframework/bootstrap/logging/logging.properties rename to spring-zero-core/src/main/resources/org/springframework/bootstrap/logging/logging.properties index 28f690be399..4dc44e89ef2 100644 --- a/spring-bootstrap/src/main/resources/org/springframework/bootstrap/logging/logging.properties +++ b/spring-zero-core/src/main/resources/org/springframework/bootstrap/logging/logging.properties @@ -1,9 +1,9 @@ -handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler -.level = INFO - -# File Logging -java.util.logging.FileHandler.pattern = %t/service.log -java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter -java.util.logging.FileHandler.level = INFO -java.util.logging.FileHandler.limit = 10485760 +handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler +.level = INFO + +# File Logging +java.util.logging.FileHandler.pattern = %t/service.log +java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter +java.util.logging.FileHandler.level = INFO +java.util.logging.FileHandler.limit = 10485760 java.util.logging.FileHandler.count = 10 \ No newline at end of file diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/BeanDefinitionLoaderTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/BeanDefinitionLoaderTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/BeanDefinitionLoaderTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/BeanDefinitionLoaderTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringApplicationTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/SpringApplicationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringApplicationTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/SpringApplicationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/TestUtils.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/TestUtils.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/TestUtils.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/TestUtils.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlParserTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/config/YamlParserTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlParserTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/config/YamlParserTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/NotWebApplicationConditionTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/NotWebApplicationConditionTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/NotWebApplicationConditionTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/NotWebApplicationConditionTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnBeanConditionTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnBeanConditionTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnBeanConditionTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnBeanConditionTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnClassConditionTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnClassConditionTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnClassConditionTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnClassConditionTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnExpressionConditionTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnExpressionConditionTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnExpressionConditionTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnExpressionConditionTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingBeanConditionTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingBeanConditionTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingBeanConditionTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingBeanConditionTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingClassConditionTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingClassConditionTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingClassConditionTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingClassConditionTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnResourceConditionTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnResourceConditionTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnResourceConditionTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnResourceConditionTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/WebApplicationConditionTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/WebApplicationConditionTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/WebApplicationConditionTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/WebApplicationConditionTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ExampleFilter.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/ExampleFilter.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ExampleFilter.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/ExampleFilter.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ExampleServlet.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/ExampleServlet.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ExampleServlet.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/ExampleServlet.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBeanTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBeanTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBeanTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBeanTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockFilter.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/MockFilter.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockFilter.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/MockFilter.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockServlet.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/MockServlet.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockServlet.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/MockServlet.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContextTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContextTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContextTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContextTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/config/ExampleEmbeddedWebApplicationConfiguration.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/config/ExampleEmbeddedWebApplicationConfiguration.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/config/ExampleEmbeddedWebApplicationConfiguration.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/config/ExampleEmbeddedWebApplicationConfiguration.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializerTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializerTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializerTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializerTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java similarity index 99% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java index 90d475dfb66..e240f3ca374 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java +++ b/spring-zero-core/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java @@ -39,11 +39,12 @@ public class LoggingInitializerTests { private LoggingApplicationContextInitializer initializer = new LoggingApplicationContextInitializer(); private PrintStream savedOutput; + private ByteArrayOutputStream output; @Before public void init() { - this.savedOutput = System.out; + this.savedOutput = System.err; this.output = new ByteArrayOutputStream(); System.setOut(new PrintStream(this.output)); } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/sampleconfig/MyComponent.java b/spring-zero-core/src/test/java/org/springframework/bootstrap/sampleconfig/MyComponent.java similarity index 100% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/sampleconfig/MyComponent.java rename to spring-zero-core/src/test/java/org/springframework/bootstrap/sampleconfig/MyComponent.java diff --git a/spring-bootstrap/src/test/resources/application.properties b/spring-zero-core/src/test/resources/application.properties similarity index 100% rename from spring-bootstrap/src/test/resources/application.properties rename to spring-zero-core/src/test/resources/application.properties diff --git a/spring-bootstrap/src/test/resources/enableprofile-myprofile.properties b/spring-zero-core/src/test/resources/enableprofile-myprofile.properties similarity index 100% rename from spring-bootstrap/src/test/resources/enableprofile-myprofile.properties rename to spring-zero-core/src/test/resources/enableprofile-myprofile.properties diff --git a/spring-bootstrap/src/test/resources/enableprofile.properties b/spring-zero-core/src/test/resources/enableprofile.properties similarity index 100% rename from spring-bootstrap/src/test/resources/enableprofile.properties rename to spring-zero-core/src/test/resources/enableprofile.properties diff --git a/spring-bootstrap/src/test/resources/logback-nondefault.xml b/spring-zero-core/src/test/resources/logback-nondefault.xml similarity index 100% rename from spring-bootstrap/src/test/resources/logback-nondefault.xml rename to spring-zero-core/src/test/resources/logback-nondefault.xml diff --git a/spring-bootstrap/src/test/resources/logback-test.xml b/spring-zero-core/src/test/resources/logback-test.xml similarity index 100% rename from spring-bootstrap/src/test/resources/logback-test.xml rename to spring-zero-core/src/test/resources/logback-test.xml diff --git a/spring-bootstrap/src/test/resources/logging-nondefault.properties b/spring-zero-core/src/test/resources/logging-nondefault.properties similarity index 55% rename from spring-bootstrap/src/test/resources/logging-nondefault.properties rename to spring-zero-core/src/test/resources/logging-nondefault.properties index ec997fde4d4..7aba690145c 100644 --- a/spring-bootstrap/src/test/resources/logging-nondefault.properties +++ b/spring-zero-core/src/test/resources/logging-nondefault.properties @@ -1,3 +1,3 @@ -handlers = java.util.logging.ConsoleHandler -.level = INFO +handlers = java.util.logging.ConsoleHandler +.level = INFO java.util.logging.ConsoleHandler.formatter = \ No newline at end of file diff --git a/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/foo.xml b/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/foo.xml new file mode 100644 index 00000000000..735b571fc78 --- /dev/null +++ b/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/foo.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml b/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml new file mode 100644 index 00000000000..c04d85080c4 --- /dev/null +++ b/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/conf.properties b/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/conf.properties new file mode 100644 index 00000000000..eb99d1fa071 --- /dev/null +++ b/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/conf.properties @@ -0,0 +1 @@ +port=8081 diff --git a/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml b/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml new file mode 100644 index 00000000000..c4a4d1737a0 --- /dev/null +++ b/spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/spring-zero-core/src/test/resources/org/springframework/bootstrap/sample-beans.xml b/spring-zero-core/src/test/resources/org/springframework/bootstrap/sample-beans.xml new file mode 100644 index 00000000000..3658eb12749 --- /dev/null +++ b/spring-zero-core/src/test/resources/org/springframework/bootstrap/sample-beans.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/spring-bootstrap/src/test/resources/specificfile-specificprofile.properties b/spring-zero-core/src/test/resources/specificfile-specificprofile.properties similarity index 100% rename from spring-bootstrap/src/test/resources/specificfile-specificprofile.properties rename to spring-zero-core/src/test/resources/specificfile-specificprofile.properties diff --git a/spring-bootstrap/src/test/resources/specificlocation.properties b/spring-zero-core/src/test/resources/specificlocation.properties similarity index 100% rename from spring-bootstrap/src/test/resources/specificlocation.properties rename to spring-zero-core/src/test/resources/specificlocation.properties diff --git a/spring-bootstrap/src/test/resources/testprofiles.yml b/spring-zero-core/src/test/resources/testprofiles.yml similarity index 100% rename from spring-bootstrap/src/test/resources/testprofiles.yml rename to spring-zero-core/src/test/resources/testprofiles.yml diff --git a/spring-bootstrap/src/test/resources/testproperties.properties b/spring-zero-core/src/test/resources/testproperties.properties similarity index 100% rename from spring-bootstrap/src/test/resources/testproperties.properties rename to spring-zero-core/src/test/resources/testproperties.properties diff --git a/spring-bootstrap/src/test/resources/testsetprofiles.yml b/spring-zero-core/src/test/resources/testsetprofiles.yml similarity index 100% rename from spring-bootstrap/src/test/resources/testsetprofiles.yml rename to spring-zero-core/src/test/resources/testsetprofiles.yml diff --git a/spring-bootstrap/src/test/resources/testyaml.yml b/spring-zero-core/src/test/resources/testyaml.yml similarity index 100% rename from spring-bootstrap/src/test/resources/testyaml.yml rename to spring-zero-core/src/test/resources/testyaml.yml diff --git a/spring-zero-intergration-tests/build.log b/spring-zero-intergration-tests/build.log new file mode 100644 index 00000000000..1ca3e48a121 --- /dev/null +++ b/spring-zero-intergration-tests/build.log @@ -0,0 +1,495 @@ +[INFO] Scanning for projects... +[INFO] +[INFO] ------------------------------------------------------------------------ +[INFO] Building spring-zero-integration-tests 0.0.1.BUILD-SNAPSHOT +[INFO] ------------------------------------------------------------------------ +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-javadoc-plugin/2.9/maven-javadoc-plugin-2.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-javadoc-plugin/2.9/maven-javadoc-plugin-2.9.pom (16 KB at 1369.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-plugins/23/maven-plugins-23.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-plugins/23/maven-plugins-23.pom (9 KB at 2994.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/22/maven-parent-22.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/22/maven-parent-22.pom (30 KB at 4841.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/apache/11/apache-11.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/apache/11/apache-11.pom (15 KB at 3616.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-javadoc-plugin/2.9/maven-javadoc-plugin-2.9.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-javadoc-plugin/2.9/maven-javadoc-plugin-2.9.jar (354 KB at 8044.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-source-plugin/2.2.1/maven-source-plugin-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-source-plugin/2.2.1/maven-source-plugin-2.2.1.pom (7 KB at 2171.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-source-plugin/2.2.1/maven-source-plugin-2.2.1.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-source-plugin/2.2.1/maven-source-plugin-2.2.1.jar (30 KB at 5863.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-invoker-plugin/1.8/maven-invoker-plugin-1.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-invoker-plugin/1.8/maven-invoker-plugin-1.8.pom (13 KB at 4156.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-invoker-plugin/1.8/maven-invoker-plugin-1.8.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/plugins/maven-invoker-plugin/1.8/maven-invoker-plugin-1.8.jar (103 KB at 7913.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.pom (3 KB at 941.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/2.1/plexus-utils-2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/2.1/plexus-utils-2.1.pom (4 KB at 1969.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/sonatype/spice/spice-parent/16/spice-parent-16.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/sonatype/spice/spice-parent/16/spice-parent-16.pom (9 KB at 4081.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/sonatype/forge/forge-parent/5/forge-parent-5.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/sonatype/forge/forge-parent/5/forge-parent-5.pom (9 KB at 2722.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.pom (6 KB at 2513.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.11/plexus-1.0.11.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.11/plexus-1.0.11.pom (9 KB at 2919.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.pom (2 KB at 770.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven/2.0.6/maven-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven/2.0.6/maven-2.0.6.pom (9 KB at 4417.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/5/maven-parent-5.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/5/maven-parent-5.pom (15 KB at 4960.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/apache/3/apache-3.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/apache/3/apache-3.pom (4 KB at 1674.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.pom (2 KB at 1864.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.pom (3 KB at 1487.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-core/2.0.6/maven-core-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-core/2.0.6/maven-core-2.0.6.pom (7 KB at 6553.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.pom (2 KB at 977.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.pom (4 KB at 1928.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-containers/1.0.3/plexus-containers-1.0.3.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-containers/1.0.3/plexus-containers-1.0.3.pom (492 B at 480.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.4/plexus-1.0.4.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.4/plexus-1.0.4.pom (6 KB at 2801.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/junit/junit/4.11/junit-4.11.pom +Downloaded: file:///Users/pwebb/.m2/repository/junit/junit/4.11/junit-4.11.pom (3 KB at 2289.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.pom (766 B at 748.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-parent/1.3/hamcrest-parent-1.3.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-parent/1.3/hamcrest-parent-1.3.pom (2 KB at 1925.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.pom (7 KB at 3347.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.pom (4 KB at 1527.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-file/1.0-beta-2/wagon-file-1.0-beta-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-file/1.0-beta-2/wagon-file-1.0-beta-2.pom (637 B at 311.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-providers/1.0-beta-2/wagon-providers-1.0-beta-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-providers/1.0-beta-2/wagon-providers-1.0-beta-2.pom (2 KB at 1734.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon/1.0-beta-2/wagon-1.0-beta-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon/1.0-beta-2/wagon-1.0-beta-2.pom (6 KB at 2872.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/4/maven-parent-4.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/4/maven-parent-4.pom (10 KB at 4880.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.pom (680 B at 664.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-parameter-documenter/2.0.6/maven-plugin-parameter-documenter-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-parameter-documenter/2.0.6/maven-plugin-parameter-documenter-2.0.6.pom (2 KB at 1866.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-http-lightweight/1.0-beta-2/wagon-http-lightweight-1.0-beta-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-http-lightweight/1.0-beta-2/wagon-http-lightweight-1.0-beta-2.pom (2 KB at 1334.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-http-shared/1.0-beta-2/wagon-http-shared-1.0-beta-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-http-shared/1.0-beta-2/wagon-http-shared-1.0-beta-2.pom (845 B at 412.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/jtidy/jtidy/4aug2000r7-dev/jtidy-4aug2000r7-dev.pom +Downloaded: file:///Users/pwebb/.m2/repository/jtidy/jtidy/4aug2000r7-dev/jtidy-4aug2000r7-dev.pom (2 KB at 638.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.pom +Downloaded: file:///Users/pwebb/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.pom (3 KB at 1098.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.pom (2 KB at 1710.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting/2.0.6/maven-reporting-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting/2.0.6/maven-reporting-2.0.6.pom (2 KB at 1405.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.pom (424 B at 414.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia/1.0-alpha-7/doxia-1.0-alpha-7.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia/1.0-alpha-7/doxia-1.0-alpha-7.pom (4 KB at 1910.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.pom (2 KB at 1933.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.pom (2 KB at 1806.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-error-diagnostics/2.0.6/maven-error-diagnostics-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-error-diagnostics/2.0.6/maven-error-diagnostics-2.0.6.pom (2 KB at 832.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.pom (3 KB at 2575.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.pom (3 KB at 2560.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.pom (2 KB at 1900.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.pom (3 KB at 2055.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.pom (2 KB at 710.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-ssh-external/1.0-beta-2/wagon-ssh-external-1.0-beta-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-ssh-external/1.0-beta-2/wagon-ssh-external-1.0-beta-2.pom (2 KB at 1424.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-ssh-common/1.0-beta-2/wagon-ssh-common-1.0-beta-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-ssh-common/1.0-beta-2/wagon-ssh-common-1.0-beta-2.pom (851 B at 415.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.pom (7 KB at 6924.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-7/plexus-container-default-1.0-alpha-7.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-7/plexus-container-default-1.0-alpha-7.pom (2 KB at 1258.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/plexus/plexus-containers/1.0.2/plexus-containers-1.0.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/plexus/plexus-containers/1.0.2/plexus-containers-1.0.2.pom (471 B at 230.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/plexus/plexus-root/1.0.3/plexus-root-1.0.3.pom +Downloaded: file:///Users/pwebb/.m2/repository/plexus/plexus-root/1.0.3/plexus-root-1.0.3.pom (6 KB at 2939.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/plexus/plexus-utils/1.0.2/plexus-utils-1.0.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/plexus/plexus-utils/1.0.2/plexus-utils-1.0.2.pom (740 B at 361.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-descriptor/2.0.6/maven-plugin-descriptor-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-descriptor/2.0.6/maven-plugin-descriptor-2.0.6.pom (2 KB at 1970.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-monitor/2.0.6/maven-monitor-2.0.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-monitor/2.0.6/maven-monitor-2.0.6.pom (2 KB at 1224.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-ssh/1.0-beta-2/wagon-ssh-1.0-beta-2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-ssh/1.0-beta-2/wagon-ssh-1.0-beta-2.pom (2 KB at 846.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/com/jcraft/jsch/0.1.27/jsch-0.1.27.pom +Downloaded: file:///Users/pwebb/.m2/repository/com/jcraft/jsch/0.1.27/jsch-0.1.27.pom (965 B at 942.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/classworlds/classworlds/1.1/classworlds-1.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/classworlds/classworlds/1.1/classworlds-1.1.pom (4 KB at 3246.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.pom (3 KB at 2743.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.pom (4 KB at 3971.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-io/2.0.2/plexus-io-2.0.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-io/2.0.2/plexus-io-2.0.2.pom (2 KB at 1692.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.pom (1018 B at 994.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.7/plexus-utils-3.0.7.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.7/plexus-utils-3.0.7.pom (3 KB at 2453.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.pom (2 KB at 1417.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom (481 B at 469.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.pom (6 KB at 5739.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/objenesis/objenesis/1.0/objenesis-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/objenesis/objenesis/1.0/objenesis-1.0.pom (853 B at 833.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.pom (820 B at 800.8 KB/sec) +[INFO] +[INFO] --- maven-javadoc-plugin:2.9:jar (attach-javadocs) @ spring-zero-integration-tests --- +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-core/2.2.1/maven-core-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-core/2.2.1/maven-core-2.2.1.pom (12 KB at 11360.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven/2.2.1/maven-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven/2.2.1/maven-2.2.1.pom (22 KB at 10941.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/11/maven-parent-11.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/11/maven-parent-11.pom (32 KB at 15824.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/apache/5/apache-5.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/apache/5/apache-5.pom (5 KB at 2000.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom (3 KB at 2127.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-model/2.2.1/maven-model-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-model/2.2.1/maven-model-2.2.1.pom (4 KB at 1582.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.pom (7 KB at 3344.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/2.0.2/plexus-2.0.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/2.0.2/plexus-2.0.2.pom (12 KB at 11337.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.pom (889 B at 868.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-components/1.1.14/plexus-components-1.1.14.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-components/1.1.14/plexus-components-1.1.14.pom (6 KB at 5705.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/junit/junit/3.8.1/junit-3.8.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/junit/junit/3.8.1/junit-3.8.1.pom (998 B at 974.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-parameter-documenter/2.2.1/maven-plugin-parameter-documenter-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-parameter-documenter/2.2.1/maven-plugin-parameter-documenter-2.2.1.pom (2 KB at 1911.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.pom (2 KB at 1853.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-parent/1.5.6/slf4j-parent-1.5.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-parent/1.5.6/slf4j-parent-1.5.6.pom (8 KB at 3867.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.pom (3 KB at 2914.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.pom (3 KB at 2118.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.pom (2 KB at 904.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting/2.2.1/maven-reporting-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting/2.2.1/maven-reporting-2.2.1.pom (2 KB at 1409.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.pom (2 KB at 995.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia/1.1/doxia-1.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia/1.1/doxia-1.1.pom (15 KB at 14822.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.pom (2 KB at 1538.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-30/plexus-container-default-1.0-alpha-30.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-30/plexus-container-default-1.0-alpha-30.pom (4 KB at 3395.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-containers/1.0-alpha-30/plexus-containers-1.0-alpha-30.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-containers/1.0-alpha-30/plexus-containers-1.0-alpha-30.pom (2 KB at 1849.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.5/plexus-utils-1.4.5.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.5/plexus-utils-1.4.5.pom (3 KB at 2211.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-classworlds/1.2-alpha-9/plexus-classworlds-1.2-alpha-9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-classworlds/1.2-alpha-9/plexus-classworlds-1.2-alpha-9.pom (4 KB at 3147.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.10/plexus-1.0.10.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.10/plexus-1.0.10.pom (9 KB at 8056.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-profile/2.2.1/maven-profile-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-profile/2.2.1/maven-profile-2.2.1.pom (3 KB at 2120.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.pom (2 KB at 772.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-repository-metadata/2.2.1/maven-repository-metadata-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-repository-metadata/2.2.1/maven-repository-metadata-2.2.1.pom (2 KB at 1827.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-error-diagnostics/2.2.1/maven-error-diagnostics-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-error-diagnostics/2.2.1/maven-error-diagnostics-2.2.1.pom (2 KB at 1668.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-project/2.2.1/maven-project-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-project/2.2.1/maven-project-2.2.1.pom (3 KB at 1354.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact-manager/2.2.1/maven-artifact-manager-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact-manager/2.2.1/maven-artifact-manager-2.2.1.pom (4 KB at 1515.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.pom (880 B at 429.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-registry/2.2.1/maven-plugin-registry-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-registry/2.2.1/maven-plugin-registry-2.2.1.pom (2 KB at 1883.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.pom (8 KB at 3896.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/commons/commons-parent/11/commons-parent-11.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/commons/commons-parent/11/commons-parent-11.pom (25 KB at 12035.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/apache/4/apache-4.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/apache/4/apache-4.pom (5 KB at 4389.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-api/2.2.1/maven-plugin-api-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-api/2.2.1/maven-plugin-api-2.2.1.pom (2 KB at 712.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-descriptor/2.2.1/maven-plugin-descriptor-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-descriptor/2.2.1/maven-plugin-descriptor-2.2.1.pom (3 KB at 2015.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-monitor/2.2.1/maven-monitor-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-monitor/2.2.1/maven-monitor-2.2.1.pom (2 KB at 1227.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.pom (4 KB at 3265.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.pom (3 KB at 2317.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-shared-components/15/maven-shared-components-15.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-shared-components/15/maven-shared-components-15.pom (10 KB at 9118.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/16/maven-parent-16.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/16/maven-parent-16.pom (23 KB at 22726.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/apache/7/apache-7.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/apache/7/apache-7.pom (15 KB at 14091.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0/doxia-sink-api-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0/doxia-sink-api-1.0.pom (2 KB at 1354.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia/1.0/doxia-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia/1.0/doxia-1.0.pom (10 KB at 9418.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/10/maven-parent-10.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/10/maven-parent-10.pom (31 KB at 15446.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-invoker/2.0.9/maven-invoker-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-invoker/2.0.9/maven-invoker-2.0.9.pom (6 KB at 5641.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-shared-components/9/maven-shared-components-9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-shared-components/9/maven-shared-components-9.pom (4 KB at 3418.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/8/maven-parent-8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/8/maven-parent-8.pom (24 KB at 23567.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.pom (6 KB at 5177.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.12/plexus-1.0.12.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.12/plexus-1.0.12.pom (10 KB at 9570.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.pom (4 KB at 1807.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-shared-components/12/maven-shared-components-12.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-shared-components/12/maven-shared-components-12.pom (10 KB at 4559.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/13/maven-parent-13.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/13/maven-parent-13.pom (23 KB at 22103.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/apache/6/apache-6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/apache/6/apache-6.pom (13 KB at 12496.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact/2.0.8/maven-artifact-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact/2.0.8/maven-artifact-2.0.8.pom (2 KB at 1581.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven/2.0.8/maven-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven/2.0.8/maven-2.0.8.pom (12 KB at 11811.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/6/maven-parent-6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-parent/6/maven-parent-6.pom (20 KB at 19576.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.6/plexus-utils-1.4.6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.6/plexus-utils-1.4.6.pom (3 KB at 2211.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-model/2.0.8/maven-model-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-model/2.0.8/maven-model-2.0.8.pom (4 KB at 1533.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-project/2.0.8/maven-project-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-project/2.0.8/maven-project-2.0.8.pom (3 KB at 2646.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-settings/2.0.8/maven-settings-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-settings/2.0.8/maven-settings-2.0.8.pom (3 KB at 2009.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-profile/2.0.8/maven-profile-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-profile/2.0.8/maven-profile-2.0.8.pom (2 KB at 1989.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact-manager/2.0.8/maven-artifact-manager-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact-manager/2.0.8/maven-artifact-manager-2.0.8.pom (3 KB at 2636.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-repository-metadata/2.0.8/maven-repository-metadata-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-repository-metadata/2.0.8/maven-repository-metadata-2.0.8.pom (2 KB at 1856.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-registry/2.0.8/maven-plugin-registry-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-registry/2.0.8/maven-plugin-registry-2.0.8.pom (2 KB at 1952.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-api/2.0.8/maven-plugin-api-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-api/2.0.8/maven-plugin-api-2.0.8.pom (2 KB at 1459.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-9/plexus-container-default-1.0-alpha-9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-9/plexus-container-default-1.0-alpha-9.pom (2 KB at 1207.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.9/plexus-utils-1.4.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.9/plexus-utils-1.4.9.pom (3 KB at 2242.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.0/doxia-site-renderer-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.0/doxia-site-renderer-1.0.pom (5 KB at 4323.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sitetools/1.0/doxia-sitetools-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sitetools/1.0/doxia-sitetools-1.0.pom (10 KB at 9361.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-core/1.0/doxia-core-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-core/1.0/doxia-core-1.0.pom (3 KB at 1169.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.7/plexus-utils-1.5.7.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.7/plexus-utils-1.5.7.pom (8 KB at 3937.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.pom (2 KB at 1034.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-components/1.1.12/plexus-components-1.1.12.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-components/1.1.12/plexus-components-1.1.12.pom (3 KB at 2932.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.7/plexus-velocity-1.1.7.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.7/plexus-velocity-1.1.7.pom (2 KB at 955.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-20/plexus-container-default-1.0-alpha-20.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-20/plexus-container-default-1.0-alpha-20.pom (3 KB at 1460.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-containers/1.0-alpha-20/plexus-containers-1.0-alpha-20.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-containers/1.0-alpha-20/plexus-containers-1.0-alpha-20.pom (2 KB at 263.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.3/plexus-utils-1.3.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.3/plexus-utils-1.3.pom (2 KB at 1009.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom (8 KB at 7060.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-classworlds/1.2-alpha-7/plexus-classworlds-1.2-alpha-7.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-classworlds/1.2-alpha-7/plexus-classworlds-1.2-alpha-7.pom (3 KB at 1158.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.9/plexus-1.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/1.0.9/plexus-1.0.9.pom (8 KB at 7500.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.pom (8 KB at 3791.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.pom (6 KB at 2970.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.pom (10 KB at 9695.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/oro/oro/2.0.8/oro-2.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/oro/oro/2.0.8/oro-2.0.8.pom (140 B at 136.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.0/doxia-decoration-model-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.0/doxia-decoration-model-1.0.pom (4 KB at 3080.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.pom (11 KB at 10775.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-apt/1.0/doxia-module-apt-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-apt/1.0/doxia-module-apt-1.0.pom (3 KB at 2200.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-modules/1.0/doxia-modules-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-modules/1.0/doxia-modules-1.0.pom (3 KB at 2337.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.0/doxia-module-fml-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.0/doxia-module-fml-1.0.pom (3 KB at 1314.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-xdoc/1.0/doxia-module-xdoc-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-xdoc/1.0/doxia-module-xdoc-1.0.pom (3 KB at 1094.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.0/doxia-module-xhtml-1.0.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.0/doxia-module-xhtml-1.0.pom (2 KB at 1561.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-provider-api/1.0-beta-6/wagon-provider-api-1.0-beta-6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon-provider-api/1.0-beta-6/wagon-provider-api-1.0-beta-6.pom (2 KB at 1718.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon/1.0-beta-6/wagon-1.0-beta-6.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/wagon/wagon/1.0-beta-6/wagon-1.0-beta-6.pom (13 KB at 12095.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.2/plexus-utils-1.4.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.2/plexus-utils-1.4.2.pom (2 KB at 1913.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.pom (14 KB at 13648.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/commons/commons-parent/9/commons-parent-9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/commons/commons-parent/9/commons-parent-9.pom (22 KB at 21416.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.pom (11 KB at 10775.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/commons/commons-parent/24/commons-parent-24.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/commons/commons-parent/24/commons-parent-24.pom (47 KB at 46157.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/apache/9/apache-9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/apache/9/apache-9.pom (15 KB at 7402.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.pom (8 KB at 3790.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom (6 KB at 5140.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-codec/commons-codec/1.2/commons-codec-1.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-codec/commons-codec/1.2/commons-codec-1.2.pom (4 KB at 3735.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom (18 KB at 17934.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/commons/commons-parent/5/commons-parent-5.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/commons/commons-parent/5/commons-parent-5.pom (16 KB at 7832.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.pom +Downloaded: file:///Users/pwebb/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.pom (3 KB at 1159.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/com/thoughtworks/qdox/qdox/1.12/qdox-1.12.pom +Downloaded: file:///Users/pwebb/.m2/repository/com/thoughtworks/qdox/qdox/1.12/qdox-1.12.pom (19 KB at 18120.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-archiver/2.1.2/plexus-archiver-2.1.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-archiver/2.1.2/plexus-archiver-2.1.2.pom (4 KB at 17.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.2/plexus-utils-3.0.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.2/plexus-utils-3.0.2.pom (3 KB at 817.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom (3 KB at 1226.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar +Downloading: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar +Downloading: file:///Users/pwebb/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar +Downloading: file:///Users/pwebb/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar (9 KB at 4304.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar (22 KB at 10907.2 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar (14 KB at 6546.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar (17 KB at 8165.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-invoker/2.0.9/maven-invoker-2.0.9.jar +Downloaded: file:///Users/pwebb/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar (41 KB at 13386.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar (11 KB at 5341.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0/doxia-sink-api-1.0.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-invoker/2.0.9/maven-invoker-2.0.9.jar (28 KB at 13809.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.0/doxia-site-renderer-1.0.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar (50 KB at 16580.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-core/1.0/doxia-core-1.0.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.jar (31 KB at 15165.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0/doxia-sink-api-1.0.jar (10 KB at 4918.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.7/plexus-velocity-1.1.7.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar (11 KB at 5131.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.0/doxia-site-renderer-1.0.jar (46 KB at 22713.4 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-core/1.0/doxia-core-1.0.jar (54 KB at 26831.1 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.7/plexus-velocity-1.1.7.jar (8 KB at 7488.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar +Downloading: file:///Users/pwebb/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.0/doxia-decoration-model-1.0.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.0/doxia-decoration-model-1.0.jar (48 KB at 11959.5 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar (64 KB at 15932.9 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar (324 KB at 35993.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.0/doxia-module-fml-1.0.jar +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-xdoc/1.0/doxia-module-xdoc-1.0.jar +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-apt/1.0/doxia-module-apt-1.0.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.0/doxia-module-fml-1.0.jar (19 KB at 18110.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.0/doxia-module-xhtml-1.0.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-xdoc/1.0/doxia-module-xdoc-1.0.jar (28 KB at 13572.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-apt/1.0/doxia-module-apt-1.0.jar (46 KB at 15324.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.0/doxia-module-xhtml-1.0.jar (22 KB at 10647.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar (383 KB at 34812.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-codec/commons-codec/1.2/commons-codec-1.2.jar +Downloaded: file:///Users/pwebb/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar (170 KB at 33903.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar +Downloaded: file:///Users/pwebb/.m2/repository/commons-codec/commons-codec/1.2/commons-codec-1.2.jar (30 KB at 9793.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar +Downloaded: file:///Users/pwebb/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar (256 KB at 36524.7 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/com/thoughtworks/qdox/qdox/1.12/qdox-1.12.jar +Downloaded: file:///Users/pwebb/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar (558 KB at 37191.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar +Downloaded: file:///Users/pwebb/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar (60 KB at 9877.3 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar (298 KB at 29785.3 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-archiver/2.1.2/plexus-archiver-2.1.2.jar +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar +Downloaded: file:///Users/pwebb/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar (119 KB at 29558.1 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/com/thoughtworks/qdox/qdox/1.12/qdox-1.12.jar (176 KB at 29251.5 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar (359 KB at 39870.2 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-archiver/2.1.2/plexus-archiver-2.1.2.jar (181 KB at 30087.2 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar (226 KB at 32149.4 KB/sec) +[INFO] Not executing Javadoc as the project is not a Java classpath-capable package +[INFO] +[INFO] --- maven-source-plugin:2.2.1:jar-no-fork (attach-sources) @ spring-zero-integration-tests --- +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-model/2.0.9/maven-model-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-model/2.0.9/maven-model-2.0.9.pom (4 KB at 1533.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven/2.0.9/maven-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven/2.0.9/maven-2.0.9.pom (19 KB at 18463.9 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.1/plexus-utils-1.5.1.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.1/plexus-utils-1.5.1.pom (3 KB at 2242.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact/2.0.9/maven-artifact-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact/2.0.9/maven-artifact-2.0.9.pom (2 KB at 1581.1 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-api/2.0.9/maven-plugin-api-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-api/2.0.9/maven-plugin-api-2.0.9.pom (2 KB at 1459.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-project/2.0.9/maven-project-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-project/2.0.9/maven-project-2.0.9.pom (3 KB at 2646.5 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-settings/2.0.9/maven-settings-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-settings/2.0.9/maven-settings-2.0.9.pom (3 KB at 2009.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-profile/2.0.9/maven-profile-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-profile/2.0.9/maven-profile-2.0.9.pom (3 KB at 1001.0 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact-manager/2.0.9/maven-artifact-manager-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-artifact-manager/2.0.9/maven-artifact-manager-2.0.9.pom (3 KB at 1318.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-repository-metadata/2.0.9/maven-repository-metadata-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-repository-metadata/2.0.9/maven-repository-metadata-2.0.9.pom (2 KB at 1856.4 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-registry/2.0.9/maven-plugin-registry-2.0.9.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/maven-plugin-registry/2.0.9/maven-plugin-registry-2.0.9.pom (2 KB at 1924.8 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.pom (4 KB at 1534.2 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/3.2/plexus-3.2.pom +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus/3.2/plexus-3.2.pom (19 KB at 18306.6 KB/sec) +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar +Downloading: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar +Downloading: file:///Users/pwebb/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.jar +Downloading: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.jar +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar (6 KB at 2898.4 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar (10 KB at 4854.0 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar (30 KB at 14705.6 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.jar (60 KB at 19685.5 KB/sec) +Downloaded: file:///Users/pwebb/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.jar (227 KB at 37731.4 KB/sec) +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 2.704s +[INFO] Finished at: Wed Jul 03 13:00:17 PDT 2013 +[INFO] Final Memory: 15M/355M +[INFO] ------------------------------------------------------------------------ diff --git a/spring-zero-intergration-tests/pom.xml b/spring-zero-intergration-tests/pom.xml new file mode 100644 index 00000000000..f58ee26e263 --- /dev/null +++ b/spring-zero-intergration-tests/pom.xml @@ -0,0 +1,106 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero + 0.5.0.BUILD-SNAPSHOT + + spring-zero-integration-tests + pom + + ${basedir}/.. + + + + + ${project.groupId} + spring-zero-actuator + ${project.version} + + + ${project.groupId} + spring-zero-autoconfigure + ${project.version} + + + ${project.groupId} + spring-zero-cli + ${project.version} + + + ${project.groupId} + spring-zero-core + ${project.version} + + + ${project.groupId} + spring-zero-launcher + ${project.version} + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + + + ${project.groupId} + spring-zero-starter + ${project.version} + + + ${project.groupId} + spring-zero-starter-actuator + ${project.version} + + + ${project.groupId} + spring-zero-starter-batch + ${project.version} + + + ${project.groupId} + spring-zero-starter-data-jpa + ${project.version} + + + ${project.groupId} + spring-zero-starter-integration + ${project.version} + + + ${project.groupId} + spring-zero-starter-security + ${project.version} + + + ${project.groupId} + spring-zero-starter-web + ${project.version} + + + + + + + maven-invoker-plugin + + src/it/settings.xml + ${project.parent.basedir}/spring-zero-samples/ + ${project.build.directory}/local-repo + + + + integration-test + install + + install + run + + + + + + + diff --git a/spring-bootstrap-maven-plugin/src/it/settings.xml b/spring-zero-intergration-tests/src/it/settings.xml similarity index 100% rename from spring-bootstrap-maven-plugin/src/it/settings.xml rename to spring-zero-intergration-tests/src/it/settings.xml diff --git a/spring-bootstrap-launcher/pom.xml b/spring-zero-launcher/pom.xml similarity index 65% rename from spring-bootstrap-launcher/pom.xml rename to spring-zero-launcher/pom.xml index 95891143bab..10651bba2ab 100644 --- a/spring-bootstrap-launcher/pom.xml +++ b/spring-zero-launcher/pom.xml @@ -3,10 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-parent + org.springframework.zero + spring-zero 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-launcher + spring-zero-launcher jar + + ${basedir}/.. + diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/JarLauncher.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/JarLauncher.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/JarLauncher.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/JarLauncher.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/Launcher.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/Launcher.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/Launcher.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/Launcher.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/MainMethodRunner.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/MainMethodRunner.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/MainMethodRunner.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/MainMethodRunner.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/WarLauncher.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/WarLauncher.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/WarLauncher.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/WarLauncher.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessData.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessData.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessData.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessData.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFile.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFile.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFile.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFile.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/package-info.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/data/package-info.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/package-info.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/data/package-info.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/JarEntryFilter.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/JarEntryFilter.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/JarEntryFilter.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/JarEntryFilter.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipEntry.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipEntry.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipEntry.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipEntry.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStream.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStream.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStream.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStream.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFile.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFile.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFile.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFile.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/package-info.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/package-info.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/package-info.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/package-info.java diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/package-info.java b/spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/package-info.java similarity index 100% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/package-info.java rename to spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/package-info.java diff --git a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/ByteArrayStartsWith.java b/spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/ByteArrayStartsWith.java similarity index 100% rename from spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/ByteArrayStartsWith.java rename to spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/ByteArrayStartsWith.java diff --git a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFileTest.java b/spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFileTest.java similarity index 100% rename from spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFileTest.java rename to spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFileTest.java diff --git a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStreamTest.java b/spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStreamTest.java similarity index 100% rename from spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStreamTest.java rename to spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStreamTest.java diff --git a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java b/spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java similarity index 100% rename from spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java rename to spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java diff --git a/spring-bootstrap-maven-plugin/pom.xml b/spring-zero-maven-plugin/pom.xml similarity index 83% rename from spring-bootstrap-maven-plugin/pom.xml rename to spring-zero-maven-plugin/pom.xml index 0b8b26b36f4..e47d5de4825 100644 --- a/spring-bootstrap-maven-plugin/pom.xml +++ b/spring-zero-maven-plugin/pom.xml @@ -3,15 +3,93 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-parent + org.springframework.zero + spring-zero 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-maven-plugin + spring-zero-maven-plugin maven-plugin - 3.0.5 + ${basedir}/.. + + + + org.apache.maven + maven-archiver + + + org.apache.maven + maven-artifact + + + org.apache.maven + maven-core + + + org.apache.maven + maven-model + + + org.apache.maven + maven-plugin-api + + + org.apache.maven + maven-settings + + + org.codehaus.plexus + plexus-archiver + + + org.codehaus.plexus + plexus-container-default + + + org.codehaus.plexus + plexus-component-api + + + + + org.codehaus.plexus + plexus-utils + + + org.ow2.asm + asm + + + + org.apache.maven.plugins + maven-shade-plugin + true + + + asm + asm + + + asm-commons + asm + + + + + + org.apache.maven.plugin-tools + maven-plugin-annotations + provided + + + + ${project.groupId} + spring-zero-launcher + ${project.version} + test + + @@ -69,73 +147,4 @@ - - - org.apache.maven - maven-plugin-api - ${mavenVersion} - - - org.apache.maven - maven-artifact - ${mavenVersion} - - - org.apache.maven - maven-model - ${mavenVersion} - - - org.apache.maven - maven-core - ${mavenVersion} - - - org.apache.maven - maven-settings - ${mavenVersion} - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.2 - provided - - - org.apache.maven - maven-archiver - 2.5 - - - org.ow2.asm - asm - 4.0 - - - org.codehaus.plexus - plexus-archiver - 2.2 - - - org.codehaus.plexus - plexus-container-default - - - org.codehaus.plexus - plexus-component-api - - - - - org.codehaus.plexus - plexus-utils - 3.0.10 - - - ${project.groupId} - spring-bootstrap-launcher - ${project.version} - test - - diff --git a/spring-bootstrap-maven-plugin/src/it/executable-jar/pom.xml b/spring-zero-maven-plugin/src/it/executable-jar/pom.xml similarity index 94% rename from spring-bootstrap-maven-plugin/src/it/executable-jar/pom.xml rename to spring-zero-maven-plugin/src/it/executable-jar/pom.xml index 4e93230ef8e..b3795bc8179 100644 --- a/spring-bootstrap-maven-plugin/src/it/executable-jar/pom.xml +++ b/spring-zero-maven-plugin/src/it/executable-jar/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.springframework.bootstrap.maven.it + org.springframework.zero.maven.it executable-jar 0.0.1.BUILD-SNAPSHOT executable-jar diff --git a/spring-bootstrap-maven-plugin/src/it/executable-jar/src/main/java/org/test/SampleApplication.java b/spring-zero-maven-plugin/src/it/executable-jar/src/main/java/org/test/SampleApplication.java similarity index 100% rename from spring-bootstrap-maven-plugin/src/it/executable-jar/src/main/java/org/test/SampleApplication.java rename to spring-zero-maven-plugin/src/it/executable-jar/src/main/java/org/test/SampleApplication.java diff --git a/spring-bootstrap-maven-plugin/src/it/executable-jar/verify.groovy b/spring-zero-maven-plugin/src/it/executable-jar/verify.groovy similarity index 100% rename from spring-bootstrap-maven-plugin/src/it/executable-jar/verify.groovy rename to spring-zero-maven-plugin/src/it/executable-jar/verify.groovy diff --git a/spring-bootstrap-maven-plugin/src/it/executable-war/pom.xml b/spring-zero-maven-plugin/src/it/executable-war/pom.xml similarity index 94% rename from spring-bootstrap-maven-plugin/src/it/executable-war/pom.xml rename to spring-zero-maven-plugin/src/it/executable-war/pom.xml index 99a9639a921..efc70508cda 100644 --- a/spring-bootstrap-maven-plugin/src/it/executable-war/pom.xml +++ b/spring-zero-maven-plugin/src/it/executable-war/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.springframework.bootstrap.maven.it + org.springframework.zero.maven.it executable-war 0.0.1.BUILD-SNAPSHOT executable-war diff --git a/spring-bootstrap-maven-plugin/src/it/executable-war/src/main/java/org/test/SampleApplication.java b/spring-zero-maven-plugin/src/it/executable-war/src/main/java/org/test/SampleApplication.java similarity index 100% rename from spring-bootstrap-maven-plugin/src/it/executable-war/src/main/java/org/test/SampleApplication.java rename to spring-zero-maven-plugin/src/it/executable-war/src/main/java/org/test/SampleApplication.java diff --git a/spring-bootstrap-maven-plugin/src/it/executable-war/src/main/webapp/index.html b/spring-zero-maven-plugin/src/it/executable-war/src/main/webapp/index.html similarity index 100% rename from spring-bootstrap-maven-plugin/src/it/executable-war/src/main/webapp/index.html rename to spring-zero-maven-plugin/src/it/executable-war/src/main/webapp/index.html diff --git a/spring-bootstrap-maven-plugin/src/it/executable-war/verify.groovy b/spring-zero-maven-plugin/src/it/executable-war/verify.groovy similarity index 100% rename from spring-bootstrap-maven-plugin/src/it/executable-war/verify.groovy rename to spring-zero-maven-plugin/src/it/executable-war/verify.groovy diff --git a/spring-zero-maven-plugin/src/it/settings.xml b/spring-zero-maven-plugin/src/it/settings.xml new file mode 100644 index 00000000000..e1e0ace341b --- /dev/null +++ b/spring-zero-maven-plugin/src/it/settings.xml @@ -0,0 +1,35 @@ + + + + + it-repo + + true + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + diff --git a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java b/spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java similarity index 99% rename from spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java rename to spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java index 496850790ec..2208db57bbf 100644 --- a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java +++ b/spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java @@ -289,7 +289,7 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo { String version = getClass().getPackage().getImplementationVersion(); DefaultArtifact artifact = new DefaultArtifact( - "org.springframework.bootstrap:spring-bootstrap-launcher:" + version); + "org.springframework.zero:spring-zero-launcher:" + version); ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest( artifact, repositories, "plugin"); ArtifactDescriptorResult descriptorResult = this.repositorySystem diff --git a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableJarMojo.java b/spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableJarMojo.java similarity index 100% rename from spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableJarMojo.java rename to spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableJarMojo.java diff --git a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableWarMojo.java b/spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableWarMojo.java similarity index 100% rename from spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableWarMojo.java rename to spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableWarMojo.java diff --git a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/MainClassFinder.java b/spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/MainClassFinder.java similarity index 100% rename from spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/MainClassFinder.java rename to spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/MainClassFinder.java diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformer.java b/spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformer.java similarity index 100% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformer.java rename to spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformer.java diff --git a/spring-bootstrap-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/spring-zero-maven-plugin/src/main/resources/META-INF/plexus/components.xml similarity index 93% rename from spring-bootstrap-maven-plugin/src/main/resources/META-INF/plexus/components.xml rename to spring-zero-maven-plugin/src/main/resources/META-INF/plexus/components.xml index 8ed12cc6f96..f24d5280370 100644 --- a/spring-bootstrap-maven-plugin/src/main/resources/META-INF/plexus/components.xml +++ b/spring-zero-maven-plugin/src/main/resources/META-INF/plexus/components.xml @@ -27,7 +27,7 @@ org.apache.maven.plugins:maven-resources-plugin:testResources org.apache.maven.plugins:maven-compiler-plugin:testCompile org.apache.maven.plugins:maven-surefire-plugin:test - org.springframework.bootstrap:spring-bootstrap-maven-plugin:executable-jar + org.springframework.zero:spring-zero-maven-plugin:executable-jar org.apache.maven.plugins:maven-install-plugin:install org.apache.maven.plugins:maven-deploy-plugin:deploy @@ -62,7 +62,7 @@ org.apache.maven.plugins:maven-resources-plugin:testResources org.apache.maven.plugins:maven-compiler-plugin:testCompile org.apache.maven.plugins:maven-surefire-plugin:test - org.springframework.bootstrap:spring-bootstrap-maven-plugin:executable-war + org.springframework.zero:spring-zero-maven-plugin:executable-war org.apache.maven.plugins:maven-install-plugin:install org.apache.maven.plugins:maven-deploy-plugin:deploy diff --git a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/MainClassFinderTests.java b/spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/MainClassFinderTests.java similarity index 100% rename from spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/MainClassFinderTests.java rename to spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/MainClassFinderTests.java diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java b/spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java similarity index 84% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java rename to spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java index abbdf82bb11..f72ea7e4cec 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java +++ b/spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java @@ -16,11 +16,11 @@ package org.springframework.bootstrap.maven; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.jar.JarOutputStream; import org.junit.Test; -import org.springframework.core.io.ByteArrayResource; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -38,16 +38,16 @@ public class PropertiesMergingResourceTransformerTests { public void testProcess() throws Exception { assertFalse(this.transformer.hasTransformedResource()); this.transformer.processResource("foo", - new ByteArrayResource("foo=bar".getBytes()).getInputStream(), null); + new ByteArrayInputStream("foo=bar".getBytes()), null); assertTrue(this.transformer.hasTransformedResource()); } @Test public void testMerge() throws Exception { this.transformer.processResource("foo", - new ByteArrayResource("foo=bar".getBytes()).getInputStream(), null); + new ByteArrayInputStream("foo=bar".getBytes()), null); this.transformer.processResource("bar", - new ByteArrayResource("foo=spam".getBytes()).getInputStream(), null); + new ByteArrayInputStream("foo=spam".getBytes()), null); assertEquals("bar,spam", this.transformer.getData().getProperty("foo")); } @@ -55,7 +55,7 @@ public class PropertiesMergingResourceTransformerTests { public void testOutput() throws Exception { this.transformer.resource = "foo"; this.transformer.processResource("foo", - new ByteArrayResource("foo=bar".getBytes()).getInputStream(), null); + new ByteArrayInputStream("foo=bar".getBytes()), null); ByteArrayOutputStream out = new ByteArrayOutputStream(); JarOutputStream os = new JarOutputStream(out); this.transformer.modifyOutputStream(os); diff --git a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/Verify.java b/spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/Verify.java similarity index 100% rename from spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/Verify.java rename to spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/Verify.java diff --git a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithMainMethod.java b/spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithMainMethod.java similarity index 100% rename from spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithMainMethod.java rename to spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithMainMethod.java diff --git a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithoutMainMethod.java b/spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithoutMainMethod.java similarity index 100% rename from spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithoutMainMethod.java rename to spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithoutMainMethod.java diff --git a/spring-zero-samples/pom.xml b/spring-zero-samples/pom.xml new file mode 100644 index 00000000000..ca7263fd8b8 --- /dev/null +++ b/spring-zero-samples/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero + 0.5.0.BUILD-SNAPSHOT + + spring-zero-samples + pom + + ${basedir}/.. + + + spring-zero-sample-actuator + spring-zero-sample-actuator-ui + spring-zero-sample-batch + spring-zero-sample-data-jpa + spring-zero-sample-integration + spring-zero-sample-jetty + spring-zero-sample-profile + spring-zero-sample-simple + spring-zero-sample-tomcat + spring-zero-sample-traditional + spring-zero-sample-web-ui + spring-zero-sample-xml + + diff --git a/spring-zero-samples/spring-zero-sample-actuator-ui/pom.xml b/spring-zero-samples/spring-zero-sample-actuator-ui/pom.xml new file mode 100644 index 00000000000..bfe4f4bf05b --- /dev/null +++ b/spring-zero-samples/spring-zero-sample-actuator-ui/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero-samples + 0.5.0.BUILD-SNAPSHOT + + spring-zero-sample-actuator-ui + executable-jar + + ${basedir}/../.. + + + + ${project.groupId} + spring-zero-starter-actuator + ${project.version} + + + ${project.groupId} + spring-zero-starter-web + ${project.version} + + + org.springframework.security + spring-security-javaconfig + + + org.springframework.security + spring-security-web + + + org.thymeleaf + thymeleaf-spring3 + + + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-actuator-ui/src/main/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-actuator-ui/src/main/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/resources/css/bootstrap.min.css b/spring-zero-samples/spring-zero-sample-actuator-ui/src/main/resources/css/bootstrap.min.css similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/resources/css/bootstrap.min.css rename to spring-zero-samples/spring-zero-sample-actuator-ui/src/main/resources/css/bootstrap.min.css diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/resources/templates/error.html b/spring-zero-samples/spring-zero-sample-actuator-ui/src/main/resources/templates/error.html similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/resources/templates/error.html rename to spring-zero-samples/spring-zero-sample-actuator-ui/src/main/resources/templates/error.html diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/resources/templates/home.html b/spring-zero-samples/spring-zero-sample-actuator-ui/src/main/resources/templates/home.html similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/resources/templates/home.html rename to spring-zero-samples/spring-zero-sample-actuator-ui/src/main/resources/templates/home.html diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/test/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator-ui/src/test/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/test/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-actuator-ui/src/test/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/test/java/org/springframework/bootstrap/sample/ui/ManagementServiceBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator-ui/src/test/java/org/springframework/bootstrap/sample/ui/ManagementServiceBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/test/java/org/springframework/bootstrap/sample/ui/ManagementServiceBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-actuator-ui/src/test/java/org/springframework/bootstrap/sample/ui/ManagementServiceBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/test/resources/logging.properties b/spring-zero-samples/spring-zero-sample-actuator-ui/src/test/resources/logging.properties similarity index 97% rename from spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/test/resources/logging.properties rename to spring-zero-samples/spring-zero-sample-actuator-ui/src/test/resources/logging.properties index 5fc37e69746..a9c2c378371 100644 --- a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/test/resources/logging.properties +++ b/spring-zero-samples/spring-zero-sample-actuator-ui/src/test/resources/logging.properties @@ -1,7 +1,7 @@ -handlers = java.util.logging.ConsoleHandler -.level = INFO - -java.util.logging.ConsoleHandler.level = FINE -sun.net.www.protocol.http.HttpURLConnection.level = ALL -org.springframework.bootstrap.context.annotation.level = ALL -org.springframework.bootstrap.actuate.autoconfigure.level = ALL +handlers = java.util.logging.ConsoleHandler +.level = INFO + +java.util.logging.ConsoleHandler.level = FINE +sun.net.www.protocol.http.HttpURLConnection.level = ALL +org.springframework.bootstrap.context.annotation.level = ALL +org.springframework.bootstrap.actuate.autoconfigure.level = ALL diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/pom.xml b/spring-zero-samples/spring-zero-sample-actuator/pom.xml similarity index 77% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/pom.xml rename to spring-zero-samples/spring-zero-sample-actuator/pom.xml index 4c52dca7b6a..84d62b3a20c 100644 --- a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/pom.xml +++ b/spring-zero-samples/spring-zero-sample-actuator/pom.xml @@ -3,15 +3,52 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-samples + org.springframework.zero + spring-zero-samples 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-actuator-sample - jar + spring-zero-sample-actuator + executable-jar - org.springframework.bootstrap.sample.service.ServiceBootstrapApplication + ${basedir}/../.. + + + ${project.groupId} + spring-zero-starter-actuator + ${project.version} + + + com.fasterxml.jackson.core + jackson-databind + + + javax.servlet + javax.servlet-api + + + org.springframework + spring-webmvc + + + org.springframework.security + spring-security-javaconfig + + + org.springframework.security + spring-security-web + + + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + tomcat @@ -86,27 +123,4 @@ - - - ${project.groupId} - spring-bootstrap-actuator - ${project.version} - - - org.springframework.security - spring-security-javaconfig - - - org.springframework.security - spring-security-web - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/java/org/springframework/bootstrap/sample/service/HelloWorldService.java b/spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/HelloWorldService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/java/org/springframework/bootstrap/sample/service/HelloWorldService.java rename to spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/HelloWorldService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/java/org/springframework/bootstrap/sample/service/SampleController.java b/spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/SampleController.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/java/org/springframework/bootstrap/sample/service/SampleController.java rename to spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/SampleController.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/java/org/springframework/bootstrap/sample/service/ServiceBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/ServiceBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/java/org/springframework/bootstrap/sample/service/ServiceBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/ServiceBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/java/org/springframework/bootstrap/sample/service/ServiceProperties.java b/spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/ServiceProperties.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/java/org/springframework/bootstrap/sample/service/ServiceProperties.java rename to spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/ServiceProperties.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/resources/application.properties b/spring-zero-samples/spring-zero-sample-actuator/src/main/resources/application.properties similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/resources/application.properties rename to spring-zero-samples/spring-zero-sample-actuator/src/main/resources/application.properties diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/resources/logging.properties b/spring-zero-samples/spring-zero-sample-actuator/src/main/resources/logging.properties similarity index 97% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/resources/logging.properties rename to spring-zero-samples/spring-zero-sample-actuator/src/main/resources/logging.properties index a494d4cad78..3f4cf000259 100644 --- a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/main/resources/logging.properties +++ b/spring-zero-samples/spring-zero-sample-actuator/src/main/resources/logging.properties @@ -1,7 +1,7 @@ -handlers = java.util.logging.ConsoleHandler -.level = INFO - -#java.util.logging.ConsoleHandler.level = FINE -#sun.net.www.protocol.http.HttpURLConnection.level = ALL -#org.springframework.bootstrap.level = ALL -#org.springframework.security.level = ALL +handlers = java.util.logging.ConsoleHandler +.level = INFO + +#java.util.logging.ConsoleHandler.level = FINE +#sun.net.www.protocol.http.HttpURLConnection.level = ALL +#org.springframework.bootstrap.level = ALL +#org.springframework.security.level = ALL diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/EndpointsPropertiesServiceBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/EndpointsPropertiesServiceBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/EndpointsPropertiesServiceBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/EndpointsPropertiesServiceBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/ManagementAddressServiceBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ManagementAddressServiceBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/ManagementAddressServiceBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ManagementAddressServiceBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/ManagementServiceBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ManagementServiceBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/ManagementServiceBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ManagementServiceBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/NoManagementServiceBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/NoManagementServiceBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/NoManagementServiceBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/NoManagementServiceBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/ServiceBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ServiceBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/ServiceBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ServiceBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/ShutdownServiceBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ShutdownServiceBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/ShutdownServiceBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ShutdownServiceBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/UnsecureServiceBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/UnsecureServiceBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/src/test/java/org/springframework/bootstrap/sample/test/UnsecureServiceBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/UnsecureServiceBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/start.groovy b/spring-zero-samples/spring-zero-sample-actuator/start.groovy similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-actuator-sample/start.groovy rename to spring-zero-samples/spring-zero-sample-actuator/start.groovy diff --git a/spring-zero-samples/spring-zero-sample-batch/pom.xml b/spring-zero-samples/spring-zero-sample-batch/pom.xml new file mode 100644 index 00000000000..b8baffbbdff --- /dev/null +++ b/spring-zero-samples/spring-zero-sample-batch/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero-samples + 0.5.0.BUILD-SNAPSHOT + + spring-zero-sample-batch + executable-jar + + ${basedir}/../.. + + + + ${project.groupId} + spring-zero-starter-batch + ${project.version} + + + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-batch-sample/src/main/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-batch/src/main/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-batch-sample/src/main/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-batch/src/main/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-batch-sample/src/test/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-batch/src/test/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-batch-sample/src/test/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-batch/src/test/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-batch-sample/pom.xml b/spring-zero-samples/spring-zero-sample-data-jpa/pom.xml similarity index 51% rename from spring-bootstrap-samples/spring-bootstrap-batch-sample/pom.xml rename to spring-zero-samples/spring-zero-sample-data-jpa/pom.xml index 5fe21aa70a9..af1f1fe4683 100644 --- a/spring-bootstrap-samples/spring-bootstrap-batch-sample/pom.xml +++ b/spring-zero-samples/spring-zero-sample-data-jpa/pom.xml @@ -3,34 +3,40 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-samples + org.springframework.zero + spring-zero-samples 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-batch-sample + spring-zero-sample-data-jpa executable-jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-zero-starter-data-jpa ${project.version} - org.springframework.batch - spring-batch-core - - - org.springframework - spring-jdbc + ${project.groupId} + spring-zero-starter-web + ${project.version} org.hsqldb hsqldb - - - org.slf4j - slf4j-jdk14 runtime + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/DataBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/DataBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/DataBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/DataBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/City.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/City.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/City.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/City.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/Hotel.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/Hotel.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/Hotel.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/Hotel.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/HotelSummary.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/HotelSummary.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/HotelSummary.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/HotelSummary.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/Rating.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/Rating.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/Rating.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/Rating.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/RatingCount.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/RatingCount.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/RatingCount.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/RatingCount.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/Review.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/Review.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/Review.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/Review.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/ReviewDetails.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/ReviewDetails.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/ReviewDetails.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/ReviewDetails.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/TripType.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/TripType.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/TripType.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/TripType.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/CityRepository.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/CityRepository.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/CityRepository.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/CityRepository.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelRepository.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelRepository.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelRepository.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelRepository.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelSummaryRepository.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelSummaryRepository.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelSummaryRepository.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelSummaryRepository.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/ReviewRepository.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/ReviewRepository.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/ReviewRepository.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/ReviewRepository.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/CitySearchCriteria.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/CitySearchCriteria.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/CitySearchCriteria.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/CitySearchCriteria.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/CityService.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/CityService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/CityService.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/CityService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/HotelService.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/HotelService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/HotelService.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/HotelService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/ReviewsSummary.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/ReviewsSummary.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/ReviewsSummary.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/ReviewsSummary.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/impl/CityServiceImpl.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/impl/CityServiceImpl.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/impl/CityServiceImpl.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/impl/CityServiceImpl.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/impl/HotelServiceImpl.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/impl/HotelServiceImpl.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/service/impl/HotelServiceImpl.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/impl/HotelServiceImpl.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/web/SampleController.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/web/SampleController.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/web/SampleController.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/web/SampleController.java diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/resources/application.properties b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/resources/application.properties similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/resources/application.properties rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/resources/application.properties diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/resources/import.sql b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/resources/import.sql similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/resources/import.sql rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/resources/import.sql diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/test/java/org/springframework/bootstrap/sample/data/DataBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/test/java/org/springframework/bootstrap/sample/data/DataBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/test/java/org/springframework/bootstrap/sample/data/DataBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/test/java/org/springframework/bootstrap/sample/data/DataBootstrapApplicationTests.java diff --git a/spring-zero-samples/spring-zero-sample-integration/pom.xml b/spring-zero-samples/spring-zero-sample-integration/pom.xml new file mode 100644 index 00000000000..44b43bd46f2 --- /dev/null +++ b/spring-zero-samples/spring-zero-sample-integration/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero-samples + 0.5.0.BUILD-SNAPSHOT + + spring-zero-sample-integration + executable-jar + + ${basedir}/../.. + + + + org.springframework.zero + spring-zero-starter-integration + ${project.version} + + + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/java/org/springframework/bootstrap/sample/consumer/HelloWorldService.java b/spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/HelloWorldService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/java/org/springframework/bootstrap/sample/consumer/HelloWorldService.java rename to spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/HelloWorldService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/java/org/springframework/bootstrap/sample/consumer/SampleEndpoint.java b/spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/SampleEndpoint.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/java/org/springframework/bootstrap/sample/consumer/SampleEndpoint.java rename to spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/SampleEndpoint.java diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/java/org/springframework/bootstrap/sample/consumer/ServiceProperties.java b/spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/ServiceProperties.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/java/org/springframework/bootstrap/sample/consumer/ServiceProperties.java rename to spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/ServiceProperties.java diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/resources/application.properties b/spring-zero-samples/spring-zero-sample-integration/src/main/resources/application.properties similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/resources/application.properties rename to spring-zero-samples/spring-zero-sample-integration/src/main/resources/application.properties diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/resources/integration-context.xml b/spring-zero-samples/spring-zero-sample-integration/src/main/resources/integration-context.xml similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/resources/integration-context.xml rename to spring-zero-samples/spring-zero-sample-integration/src/main/resources/integration-context.xml diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/resources/logback.xml b/spring-zero-samples/spring-zero-sample-integration/src/main/resources/logback.xml similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/src/main/resources/logback.xml rename to spring-zero-samples/spring-zero-sample-integration/src/main/resources/logback.xml diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/test/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/src/test/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java b/spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java rename to spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-jetty-sample/pom.xml b/spring-zero-samples/spring-zero-sample-jetty/pom.xml similarity index 67% rename from spring-bootstrap-samples/spring-bootstrap-jetty-sample/pom.xml rename to spring-zero-samples/spring-zero-sample-jetty/pom.xml index 07713f3bd05..eccf6b857e8 100644 --- a/spring-bootstrap-samples/spring-bootstrap-jetty-sample/pom.xml +++ b/spring-zero-samples/spring-zero-sample-jetty/pom.xml @@ -3,22 +3,24 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-samples + org.springframework.zero + spring-zero-samples 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-jetty-sample + spring-zero-sample-jetty executable-jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-zero-starter ${project.version} - org.slf4j - slf4j-jdk14 - runtime + org.springframework + spring-webmvc org.eclipse.jetty @@ -30,14 +32,20 @@ jetty-util runtime - - org.springframework - spring-webmvc - javax.servlet javax.servlet-api runtime + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-jetty-sample/src/main/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-jetty-sample/src/main/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-jetty-sample/src/main/java/org/springframework/bootstrap/sample/jetty/service/HelloWorldService.java b/spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/bootstrap/sample/jetty/service/HelloWorldService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-jetty-sample/src/main/java/org/springframework/bootstrap/sample/jetty/service/HelloWorldService.java rename to spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/bootstrap/sample/jetty/service/HelloWorldService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-jetty-sample/src/main/java/org/springframework/bootstrap/sample/jetty/web/SampleController.java b/spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/bootstrap/sample/jetty/web/SampleController.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-jetty-sample/src/main/java/org/springframework/bootstrap/sample/jetty/web/SampleController.java rename to spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/bootstrap/sample/jetty/web/SampleController.java diff --git a/spring-bootstrap-samples/spring-bootstrap-jetty-sample/src/test/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-jetty/src/test/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-jetty-sample/src/test/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-jetty/src/test/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-profile-sample/pom.xml b/spring-zero-samples/spring-zero-sample-profile/pom.xml similarity index 56% rename from spring-bootstrap-samples/spring-bootstrap-profile-sample/pom.xml rename to spring-zero-samples/spring-zero-sample-profile/pom.xml index 9ef9724ed51..46b40d65b53 100644 --- a/spring-bootstrap-samples/spring-bootstrap-profile-sample/pom.xml +++ b/spring-zero-samples/spring-zero-sample-profile/pom.xml @@ -3,27 +3,35 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-samples + org.springframework.zero + spring-zero-samples 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-profile-sample + spring-zero-sample-profile executable-jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-zero-starter ${project.version} - - org.slf4j - slf4j-jdk14 - runtime - org.yaml snakeyaml runtime + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/java/org/springframework/bootstrap/sample/simple/service/GoodbyeWorldService.java b/spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/service/GoodbyeWorldService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/java/org/springframework/bootstrap/sample/simple/service/GoodbyeWorldService.java rename to spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/service/GoodbyeWorldService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java b/spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java rename to spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/java/org/springframework/bootstrap/sample/simple/service/MessageService.java b/spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/service/MessageService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/java/org/springframework/bootstrap/sample/simple/service/MessageService.java rename to spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/service/MessageService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/resources/application.yml b/spring-zero-samples/spring-zero-sample-profile/src/main/resources/application.yml similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-profile-sample/src/main/resources/application.yml rename to spring-zero-samples/spring-zero-sample-profile/src/main/resources/application.yml diff --git a/spring-bootstrap-samples/spring-bootstrap-profile-sample/src/test/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-profile/src/test/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-profile-sample/src/test/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-profile/src/test/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-simple-sample/pom.xml b/spring-zero-samples/spring-zero-sample-simple/pom.xml similarity index 51% rename from spring-bootstrap-samples/spring-bootstrap-simple-sample/pom.xml rename to spring-zero-samples/spring-zero-sample-simple/pom.xml index b9c5b9ece22..1457432890b 100644 --- a/spring-bootstrap-samples/spring-bootstrap-simple-sample/pom.xml +++ b/spring-zero-samples/spring-zero-sample-simple/pom.xml @@ -3,22 +3,30 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-samples + org.springframework.zero + spring-zero-samples 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-simple-sample + spring-zero-sample-simple executable-jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-zero-starter ${project.version} - - org.slf4j - slf4j-jdk14 - runtime - + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-simple-sample/src/main/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-simple/src/main/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-simple-sample/src/main/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-simple/src/main/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-simple-sample/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java b/spring-zero-samples/spring-zero-sample-simple/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-simple-sample/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java rename to spring-zero-samples/spring-zero-sample-simple/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-simple-sample/src/main/resources/application.properties b/spring-zero-samples/spring-zero-sample-simple/src/main/resources/application.properties similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-simple-sample/src/main/resources/application.properties rename to spring-zero-samples/spring-zero-sample-simple/src/main/resources/application.properties diff --git a/spring-bootstrap-samples/spring-bootstrap-simple-sample/src/test/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-simple/src/test/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-simple-sample/src/test/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-simple/src/test/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplicationTests.java diff --git a/spring-bootstrap-starters/spring-bootstrap-web-starter/pom.xml b/spring-zero-samples/spring-zero-sample-tomcat/pom.xml similarity index 58% rename from spring-bootstrap-starters/spring-bootstrap-web-starter/pom.xml rename to spring-zero-samples/spring-zero-sample-tomcat/pom.xml index 93d3ac6e350..04935bf2bc3 100644 --- a/spring-bootstrap-starters/spring-bootstrap-web-starter/pom.xml +++ b/spring-zero-samples/spring-zero-sample-tomcat/pom.xml @@ -3,16 +3,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-starters + org.springframework.zero + spring-zero-samples 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-web-starter - jar + spring-zero-sample-tomcat + executable-jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap-starter + spring-zero-starter ${project.version} @@ -26,20 +29,16 @@ org.springframework spring-webmvc - - - commons-logging - commons-logging - - - - - javax.servlet - javax.servlet-api - - - com.fasterxml.jackson.core - jackson-databind + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/main/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/main/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/main/java/org/springframework/bootstrap/sample/tomcat/service/HelloWorldService.java b/spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/bootstrap/sample/tomcat/service/HelloWorldService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/main/java/org/springframework/bootstrap/sample/tomcat/service/HelloWorldService.java rename to spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/bootstrap/sample/tomcat/service/HelloWorldService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/main/java/org/springframework/bootstrap/sample/tomcat/web/SampleController.java b/spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/bootstrap/sample/tomcat/web/SampleController.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/main/java/org/springframework/bootstrap/sample/tomcat/web/SampleController.java rename to spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/bootstrap/sample/tomcat/web/SampleController.java diff --git a/spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/test/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-tomcat-sample/src/test/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/.gitignore b/spring-zero-samples/spring-zero-sample-traditional/.gitignore similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-trad-sample/.gitignore rename to spring-zero-samples/spring-zero-sample-traditional/.gitignore diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/pom.xml b/spring-zero-samples/spring-zero-sample-traditional/pom.xml similarity index 50% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/pom.xml rename to spring-zero-samples/spring-zero-sample-traditional/pom.xml index 00a471ae067..4095d6612f6 100644 --- a/spring-bootstrap-samples/spring-bootstrap-ui-sample/pom.xml +++ b/spring-zero-samples/spring-zero-sample-traditional/pom.xml @@ -1,64 +1,54 @@ - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-samples + org.springframework.zero + spring-zero-samples 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-ui-sample + spring-zero-sample-traditional + executable-war + ${basedir}/../.. / - org.springframework.bootstrap.sample.ui.UiBootstrapApplication + ${project.groupId} - spring-bootstrap + spring-zero-starter ${project.version} org.springframework spring-webmvc - - org.thymeleaf - thymeleaf-spring3 - - - nz.net.ultraq.web.thymeleaf - thymeleaf-layout-dialect - + org.apache.tomcat.embed tomcat-embed-core + provided org.apache.tomcat.embed tomcat-embed-logging-juli + provided - org.hibernate - hibernate-validator - - - org.slf4j - slf4j-jdk14 - runtime + org.apache.tomcat.embed + tomcat-embed-jasper + provided - maven-dependency-plugin - - - maven-shade-plugin - - - maven-exec-plugin + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-traditional/src/main/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-traditional/src/main/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/java/org/springframework/bootstrap/sample/trad/config/WebConfig.java b/spring-zero-samples/spring-zero-sample-traditional/src/main/java/org/springframework/bootstrap/sample/trad/config/WebConfig.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/java/org/springframework/bootstrap/sample/trad/config/WebConfig.java rename to spring-zero-samples/spring-zero-sample-traditional/src/main/java/org/springframework/bootstrap/sample/trad/config/WebConfig.java diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/resources/log4j.properties b/spring-zero-samples/spring-zero-sample-traditional/src/main/resources/log4j.properties similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/resources/log4j.properties rename to spring-zero-samples/spring-zero-sample-traditional/src/main/resources/log4j.properties diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/webapp/WEB-INF/views/home.jsp b/spring-zero-samples/spring-zero-sample-traditional/src/main/webapp/WEB-INF/views/home.jsp similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/webapp/WEB-INF/views/home.jsp rename to spring-zero-samples/spring-zero-sample-traditional/src/main/webapp/WEB-INF/views/home.jsp diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/webapp/WEB-INF/web.xml b/spring-zero-samples/spring-zero-sample-traditional/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/webapp/WEB-INF/web.xml rename to spring-zero-samples/spring-zero-sample-traditional/src/main/webapp/WEB-INF/web.xml diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/webapp/index.html b/spring-zero-samples/spring-zero-sample-traditional/src/main/webapp/index.html similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-trad-sample/src/main/webapp/index.html rename to spring-zero-samples/spring-zero-sample-traditional/src/main/webapp/index.html diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/src/test/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-traditional/src/test/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-trad-sample/src/test/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-traditional/src/test/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-trad-sample/src/test/resources/log4j.properties b/spring-zero-samples/spring-zero-sample-traditional/src/test/resources/log4j.properties similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-trad-sample/src/test/resources/log4j.properties rename to spring-zero-samples/spring-zero-sample-traditional/src/test/resources/log4j.properties diff --git a/spring-zero-samples/spring-zero-sample-web-ui/pom.xml b/spring-zero-samples/spring-zero-sample-web-ui/pom.xml new file mode 100644 index 00000000000..a7906372517 --- /dev/null +++ b/spring-zero-samples/spring-zero-sample-web-ui/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero-samples + 0.5.0.BUILD-SNAPSHOT + + spring-zero-sample-web-ui + executable-jar + + ${basedir}/../.. + + + + ${project.groupId} + spring-zero-starter-web + ${project.version} + + + org.thymeleaf + thymeleaf-spring3 + + + nz.net.ultraq.web.thymeleaf + thymeleaf-layout-dialect + + + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/InMemoryMessageRespository.java b/spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/InMemoryMessageRespository.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/InMemoryMessageRespository.java rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/InMemoryMessageRespository.java diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/Message.java b/spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/Message.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/Message.java rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/Message.java diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/MessageRepository.java b/spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/MessageRepository.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/MessageRepository.java rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/MessageRepository.java diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/mvc/MessageController.java b/spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/mvc/MessageController.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/mvc/MessageController.java rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/mvc/MessageController.java diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/css/bootstrap.min.css b/spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/css/bootstrap.min.css similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/css/bootstrap.min.css rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/css/bootstrap.min.css diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/favicon.ico b/spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/favicon.ico similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/favicon.ico rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/favicon.ico diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/js/jquery-1.7.2.js b/spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/js/jquery-1.7.2.js similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/js/jquery-1.7.2.js rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/js/jquery-1.7.2.js diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/js/jquery.validate.js b/spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/js/jquery.validate.js similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/js/jquery.validate.js rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/js/jquery.validate.js diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/templates/layout.html b/spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/templates/layout.html similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/templates/layout.html rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/templates/layout.html diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/templates/messages/form.html b/spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/templates/messages/form.html similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/templates/messages/form.html rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/templates/messages/form.html diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/templates/messages/list.html b/spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/templates/messages/list.html similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/templates/messages/list.html rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/templates/messages/list.html diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/templates/messages/view.html b/spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/templates/messages/view.html similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/main/resources/templates/messages/view.html rename to spring-zero-samples/spring-zero-sample-web-ui/src/main/resources/templates/messages/view.html diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/test/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-web-ui/src/test/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/test/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-web-ui/src/test/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplicationTests.java diff --git a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/test/resources/logging.properties b/spring-zero-samples/spring-zero-sample-web-ui/src/test/resources/logging.properties similarity index 97% rename from spring-bootstrap-samples/spring-bootstrap-ui-sample/src/test/resources/logging.properties rename to spring-zero-samples/spring-zero-sample-web-ui/src/test/resources/logging.properties index 4c989d9a9b5..a86ad1a2987 100644 --- a/spring-bootstrap-samples/spring-bootstrap-ui-sample/src/test/resources/logging.properties +++ b/spring-zero-samples/spring-zero-sample-web-ui/src/test/resources/logging.properties @@ -1,6 +1,6 @@ -handlers = java.util.logging.ConsoleHandler -.level = INFO - -java.util.logging.ConsoleHandler.level = FINE -sun.net.www.protocol.http.HttpURLConnection.level = ALL -org.springframework.bootstrap.context.annotation.level = ALL +handlers = java.util.logging.ConsoleHandler +.level = INFO + +java.util.logging.ConsoleHandler.level = FINE +sun.net.www.protocol.http.HttpURLConnection.level = ALL +org.springframework.bootstrap.context.annotation.level = ALL diff --git a/spring-bootstrap-samples/spring-bootstrap-xml-sample/pom.xml b/spring-zero-samples/spring-zero-sample-xml/pom.xml similarity index 51% rename from spring-bootstrap-samples/spring-bootstrap-xml-sample/pom.xml rename to spring-zero-samples/spring-zero-sample-xml/pom.xml index 8bf8a520f7b..e987c698950 100644 --- a/spring-bootstrap-samples/spring-bootstrap-xml-sample/pom.xml +++ b/spring-zero-samples/spring-zero-sample-xml/pom.xml @@ -3,22 +3,30 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-samples + org.springframework.zero + spring-zero-samples 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-xml-sample + spring-zero-sample-xml executable-jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-zero-starter ${project.version} - - org.slf4j - slf4j-jdk14 - runtime - + + + + ${project.groupId} + spring-zero-maven-plugin + ${project.version} + true + + + diff --git a/spring-bootstrap-samples/spring-bootstrap-xml-sample/src/main/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplication.java b/spring-zero-samples/spring-zero-sample-xml/src/main/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplication.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-xml-sample/src/main/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplication.java rename to spring-zero-samples/spring-zero-sample-xml/src/main/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplication.java diff --git a/spring-bootstrap-samples/spring-bootstrap-xml-sample/src/main/java/org/springframework/bootstrap/sample/xml/service/HelloWorldService.java b/spring-zero-samples/spring-zero-sample-xml/src/main/java/org/springframework/bootstrap/sample/xml/service/HelloWorldService.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-xml-sample/src/main/java/org/springframework/bootstrap/sample/xml/service/HelloWorldService.java rename to spring-zero-samples/spring-zero-sample-xml/src/main/java/org/springframework/bootstrap/sample/xml/service/HelloWorldService.java diff --git a/spring-bootstrap-samples/spring-bootstrap-xml-sample/src/main/resources/META-INF/application-context.xml b/spring-zero-samples/spring-zero-sample-xml/src/main/resources/META-INF/application-context.xml similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-xml-sample/src/main/resources/META-INF/application-context.xml rename to spring-zero-samples/spring-zero-sample-xml/src/main/resources/META-INF/application-context.xml diff --git a/spring-bootstrap-samples/spring-bootstrap-xml-sample/src/test/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-xml/src/test/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplicationTests.java similarity index 100% rename from spring-bootstrap-samples/spring-bootstrap-xml-sample/src/test/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplicationTests.java rename to spring-zero-samples/spring-zero-sample-xml/src/test/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplicationTests.java diff --git a/spring-zero-starters/pom.xml b/spring-zero-starters/pom.xml new file mode 100644 index 00000000000..e82942c1236 --- /dev/null +++ b/spring-zero-starters/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero + 0.5.0.BUILD-SNAPSHOT + + spring-zero-starters + pom + + ${basedir}/.. + + + spring-zero-starter-actuator + spring-zero-starter-batch + spring-zero-starter-integration + spring-zero-starter-data-jpa + spring-zero-starter-security + spring-zero-starter + spring-zero-starter-web + + diff --git a/spring-bootstrap-starters/spring-bootstrap-actuator-starter/pom.xml b/spring-zero-starters/spring-zero-starter-actuator/pom.xml similarity index 66% rename from spring-bootstrap-starters/spring-bootstrap-actuator-starter/pom.xml rename to spring-zero-starters/spring-zero-starter-actuator/pom.xml index 47e350e8144..0d31c5c529f 100644 --- a/spring-bootstrap-starters/spring-bootstrap-actuator-starter/pom.xml +++ b/spring-zero-starters/spring-zero-starter-actuator/pom.xml @@ -3,21 +3,24 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-starters + org.springframework.zero + spring-zero-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-actuator-starter + spring-zero-starter-actuator jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap-starter + spring-zero-starter ${project.version} ${project.groupId} - spring-bootstrap-actuator + spring-zero-actuator ${project.version} diff --git a/spring-bootstrap-starters/spring-bootstrap-batch-starter/pom.xml b/spring-zero-starters/spring-zero-starter-batch/pom.xml similarity index 76% rename from spring-bootstrap-starters/spring-bootstrap-batch-starter/pom.xml rename to spring-zero-starters/spring-zero-starter-batch/pom.xml index 1c38bf119ea..d5ffc46428a 100644 --- a/spring-bootstrap-starters/spring-bootstrap-batch-starter/pom.xml +++ b/spring-zero-starters/spring-zero-starter-batch/pom.xml @@ -3,29 +3,32 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-starters + org.springframework.zero + spring-zero-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-batch-starter + spring-zero-starter-batch jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap-starter + spring-zero-starter ${project.version} - org.springframework.batch - spring-batch-core + org.hsqldb + hsqldb org.springframework spring-jdbc - org.hsqldb - hsqldb + org.springframework.batch + spring-batch-core diff --git a/spring-bootstrap-starters/spring-bootstrap-jpa-starter/pom.xml b/spring-zero-starters/spring-zero-starter-data-jpa/pom.xml similarity index 74% rename from spring-bootstrap-starters/spring-bootstrap-jpa-starter/pom.xml rename to spring-zero-starters/spring-zero-starter-data-jpa/pom.xml index 26b1cbdba41..9174bd195f7 100644 --- a/spring-bootstrap-starters/spring-bootstrap-jpa-starter/pom.xml +++ b/spring-zero-starters/spring-zero-starter-data-jpa/pom.xml @@ -3,18 +3,25 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-starters + org.springframework.zero + spring-zero-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-jpa-starter + spring-zero-starter-data-jpa jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap-starter + spring-zero-starter ${project.version} + + org.hibernate + hibernate-entitymanager + org.springframework spring-orm @@ -23,18 +30,9 @@ org.springframework spring-jdbc - - org.hibernate - hibernate-entitymanager - org.springframework.data spring-data-jpa - - org.hsqldb - hsqldb - runtime - diff --git a/spring-bootstrap-samples/spring-bootstrap-integration-sample/pom.xml b/spring-zero-starters/spring-zero-starter-integration/pom.xml similarity index 54% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/pom.xml rename to spring-zero-starters/spring-zero-starter-integration/pom.xml index 3ba4e36455a..88dc4b4140e 100644 --- a/spring-bootstrap-samples/spring-bootstrap-integration-sample/pom.xml +++ b/spring-zero-starters/spring-zero-starter-integration/pom.xml @@ -3,19 +3,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-samples + org.springframework.zero + spring-zero-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-integration-sample + spring-zero-starter-integration jar - org.springframework.bootstrap.sample.service.IntegrationBootstrapApplication + ${basedir}/../.. - org.springframework.bootstrap - spring-bootstrap-actuator + ${project.groupId} + spring-zero-starter ${project.version} @@ -25,19 +25,18 @@ org.springframework.integration spring-integration-file - ${spring.integration.version} - ch.qos.logback - logback-classic + org.springframework.integration + spring-integration-http + + + org.springframework.integration + spring-integration-ip + + + org.springframework.integration + spring-integration-stream - - - - org.apache.maven.plugins - maven-shade-plugin - - - diff --git a/spring-bootstrap-starters/spring-bootstrap-security-starter/pom.xml b/spring-zero-starters/spring-zero-starter-security/pom.xml similarity index 70% rename from spring-bootstrap-starters/spring-bootstrap-security-starter/pom.xml rename to spring-zero-starters/spring-zero-starter-security/pom.xml index 34fb7bc0cbe..97532d0e2f8 100644 --- a/spring-bootstrap-starters/spring-bootstrap-security-starter/pom.xml +++ b/spring-zero-starters/spring-zero-starter-security/pom.xml @@ -3,16 +3,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-starters + org.springframework.zero + spring-zero-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-security-starter + spring-zero-starter-security jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap-starter + spring-zero-starter ${project.version} diff --git a/spring-bootstrap-samples/spring-bootstrap-tomcat-sample/pom.xml b/spring-zero-starters/spring-zero-starter-web/pom.xml similarity index 70% rename from spring-bootstrap-samples/spring-bootstrap-tomcat-sample/pom.xml rename to spring-zero-starters/spring-zero-starter-web/pom.xml index cbe9ced5bef..c5eaa478970 100644 --- a/spring-bootstrap-samples/spring-bootstrap-tomcat-sample/pom.xml +++ b/spring-zero-starters/spring-zero-starter-web/pom.xml @@ -3,21 +3,24 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-samples + org.springframework.zero + spring-zero-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-tomcat-sample - executable-jar + spring-zero-starter-web + jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-zero-starter ${project.version} - org.springframework - spring-webmvc + javax.servlet + javax.servlet-api org.apache.tomcat.embed @@ -28,9 +31,8 @@ tomcat-embed-logging-juli - org.slf4j - slf4j-jdk14 - runtime + org.springframework + spring-webmvc diff --git a/spring-bootstrap-starters/spring-bootstrap-starter/pom.xml b/spring-zero-starters/spring-zero-starter/pom.xml similarity index 68% rename from spring-bootstrap-starters/spring-bootstrap-starter/pom.xml rename to spring-zero-starters/spring-zero-starter/pom.xml index 13d31e6a946..e418b395978 100644 --- a/spring-bootstrap-starters/spring-bootstrap-starter/pom.xml +++ b/spring-zero-starters/spring-zero-starter/pom.xml @@ -3,18 +3,47 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.bootstrap - spring-bootstrap-starters + org.springframework.zero + spring-zero-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-starter + spring-zero-starter jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-zero-core ${project.version} + + ${project.groupId} + spring-zero-autoconfigure + ${project.version} + + + com.fasterxml.jackson.core + jackson-databind + + + org.hibernate + hibernate-validator + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + slf4j-jdk14 + runtime + + + org.springframework + spring-beans + org.springframework spring-core @@ -25,10 +54,6 @@ - - org.springframework - spring-beans - org.springframework spring-context @@ -37,19 +62,5 @@ org.springframework spring-expression - - org.springframework - spring-aop - true - - - org.slf4j - jcl-over-slf4j - - - org.slf4j - slf4j-jdk14 - runtime - From d039822064b3ed1c16973428fc4b477f8b86048e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 5 Jul 2013 15:49:43 -0700 Subject: [PATCH 02/15] Source formatting and clean-up --- .../actuate/trace/WebRequestTraceFilter.java | 3 +++ .../actuate/fixme/ErrorConfigurationTests.java | 1 - .../batch/JobLauncherCommandLineRunner.java | 1 + .../bootstrap/cli/compiler/AstUtils.java | 3 ++- .../AbstractEmbeddedServletContainerFactory.java | 11 +++++++++-- .../bootstrap/web/SpringServletInitializer.java | 1 + .../launcher/jar/RandomAccessJarFileTest.java | 2 +- .../sample/producer/ProducerApplication.java | 3 ++- ...NonAutoConfigurationBootstrapApplicationTests.java | 4 ++-- 9 files changed, 21 insertions(+), 8 deletions(-) diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java index e1c893ce970..2f0ba219f23 100644 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java +++ b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java @@ -83,6 +83,7 @@ public class WebRequestTraceFilter implements Filter, Ordered { this.dumpRequests = dumpRequests; } + @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; @@ -133,9 +134,11 @@ public class WebRequestTraceFilter implements Filter, Ordered { return trace; } + @Override public void init(FilterConfig filterConfig) throws ServletException { } + @Override public void destroy() { } diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java index 64461112ca6..e70fbabc3b9 100644 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java +++ b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java @@ -16,7 +16,6 @@ package org.springframework.bootstrap.actuate.fixme; - /** * @author Dave Syer */ diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java index 18f2a30d6b5..50e31b5e165 100644 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java @@ -63,6 +63,7 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, this.publisher = publisher; } + @Override public void run(String... args) throws JobExecutionException { logger.info("Running default command line with: " + Arrays.asList(args)); launchJobFromProperties(StringUtils.splitArrayElementsIntoProperties(args, "=")); diff --git a/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java index dc4c6261404..b7f1397b99c 100644 --- a/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java +++ b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java @@ -29,7 +29,8 @@ public abstract class AstUtils { /** * Determine if an {@link AnnotatedNode} has one or more of the specified annotations. */ - public static boolean hasAtLeastOneAnnotation(AnnotatedNode node, String... annotations) { + public static boolean hasAtLeastOneAnnotation(AnnotatedNode node, + String... annotations) { for (AnnotationNode annotationNode : node.getAnnotations()) { for (String annotation : annotations) { diff --git a/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java index 228d8c1ce7e..a67ad206b88 100644 --- a/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java +++ b/spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java @@ -98,6 +98,7 @@ public abstract class AbstractEmbeddedServletContainerFactory implements * @param contextPath the contextPath to set * @see #getContextPath */ + @Override public void setContextPath(String contextPath) { Assert.notNull(contextPath, "ContextPath must not be null"); if (contextPath.length() > 0) { @@ -117,6 +118,7 @@ public abstract class AbstractEmbeddedServletContainerFactory implements * Returns the context path for the embedded servlet container. The path will start * with "/" and not end with "/". The root context is represented by an empty string. */ + @Override public String getContextPath() { return this.contextPath; } @@ -127,6 +129,7 @@ public abstract class AbstractEmbeddedServletContainerFactory implements * * @param port the port to set */ + @Override public void setPort(int port) { if (port < 0 || port > 65535) { throw new IllegalArgumentException("Port must be between 1 and 65535"); @@ -137,6 +140,7 @@ public abstract class AbstractEmbeddedServletContainerFactory implements /** * Returns the port that the embedded servlet container should listen on. */ + @Override public int getPort() { return this.port; } @@ -146,6 +150,7 @@ public abstract class AbstractEmbeddedServletContainerFactory implements * * @param address the address to set (defaults to null) */ + @Override public void setAddress(InetAddress address) { this.address = address; } @@ -153,18 +158,20 @@ public abstract class AbstractEmbeddedServletContainerFactory implements /** * @return the address the embedded container binds to */ + @Override public InetAddress getAddress() { return this.address; } /** * Sets {@link ServletContextInitializer} that should be applied in addition to - * {@link #getEmbeddedServletContainer(ServletContextInitializer...)} parameters. - * This method will replace any previously set or added initializers. + * {@link #getEmbeddedServletContainer(ServletContextInitializer...)} parameters. This + * method will replace any previously set or added initializers. * @param initializers the initializers to set * @see #addInitializers * @see #getInitializers */ + @Override public void setInitializers(List initializers) { Assert.notNull(initializers, "Initializers must not be null"); this.initializers = new ArrayList(initializers); diff --git a/spring-zero-core/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java b/spring-zero-core/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java index ba7c51d31ef..27f7d0fceb1 100644 --- a/spring-zero-core/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java +++ b/spring-zero-core/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java @@ -35,6 +35,7 @@ public abstract class SpringServletInitializer implements WebApplicationInitiali /** Logger available to subclasses. */ protected final Log logger = LogFactory.getLog(getClass()); + @Override public void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext rootAppContext = this .createRootApplicationContext(servletContext); diff --git a/spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java b/spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java index 906290dc6e1..46efa926c3c 100644 --- a/spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java +++ b/spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java @@ -52,7 +52,7 @@ import org.springframework.bootstrap.launcher.data.RandomAccessDataFile; /** * Tests for {@link RandomAccessJarFile}. - * + * * @author Phillip Webb */ public class RandomAccessJarFileTest { diff --git a/spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java b/spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java index c715340e18e..ba129c89bb3 100644 --- a/spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java +++ b/spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java @@ -13,7 +13,8 @@ public class ProducerApplication implements CommandLineRunner { @Override public void run(String... args) throws Exception { new File("target/input").mkdirs(); - 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-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java index cc01bb3ad56..d13e2ce7fd8 100644 --- a/spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java +++ b/spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java @@ -38,8 +38,8 @@ public class NonAutoConfigurationBootstrapApplicationTests { private static ConfigurableApplicationContext context; @Configuration - @Import({ EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class }) + @Import({ EmbeddedServletContainerAutoConfiguration.class, + WebMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) @ComponentScan(basePackageClasses = { SampleController.class, HelloWorldService.class }) public static class NonAutoConfigurationBootstrapApplication { From 261955c50b8fb44311324d2188bf6e3f92237e0c Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 5 Jul 2013 16:44:24 -0700 Subject: [PATCH 03/15] Restructure 'bootstrap' to use 'zero' --- eclipse/eclipse-code-formatter.xml | 2 +- spring-zero-actuator/README.md | 60 +- spring-zero-actuator/docs/Features.md | 28 +- .../bootstrap/actuate/audit/AuditEvent.java | 137 ---- .../actuate/audit/AuditEventRepository.java | 45 -- .../audit/InMemoryAuditEventRepository.java | 69 -- .../audit/listener/AuditApplicationEvent.java | 80 --- .../actuate/audit/listener/AuditListener.java | 47 -- .../autoconfigure/AuditAutoConfiguration.java | 68 -- .../EndpointAutoConfiguration.java | 203 ------ .../EndpointWebMvcAutoConfiguration.java | 163 ----- ...dpointWebMvcChildContextConfiguration.java | 98 --- .../ErrorMvcAutoConfiguration.java | 56 -- ...mentServerPropertiesAutoConfiguration.java | 44 -- .../MetricFilterAutoConfiguration.java | 131 ---- .../MetricRepositoryAutoConfiguration.java | 56 -- .../SecurityAutoConfiguration.java | 219 ------ .../TraceRepositoryAutoConfiguration.java | 40 -- .../TraceWebFilterAutoConfiguration.java | 54 -- .../actuate/endpoint/AbstractEndpoint.java | 71 -- .../actuate/endpoint/ActionEndpoint.java | 27 - .../actuate/endpoint/BeansEndpoint.java | 62 -- .../actuate/endpoint/DumpEndpoint.java | 47 -- .../bootstrap/actuate/endpoint/Endpoint.java | 53 -- .../actuate/endpoint/EnvironmentEndpoint.java | 86 --- .../actuate/endpoint/HealthEndpoint.java | 49 -- .../actuate/endpoint/InfoEndpoint.java | 58 -- .../actuate/endpoint/MetricsEndpoint.java | 56 -- .../actuate/endpoint/PublicMetrics.java | 36 - .../actuate/endpoint/ShutdownEndpoint.java | 81 --- .../actuate/endpoint/TraceEndpoint.java | 51 -- .../endpoint/VanillaPublicMetrics.java | 52 -- .../endpoint/mvc/EndpointHandlerAdapter.java | 225 ------ .../endpoint/mvc/EndpointHandlerMapping.java | 133 ---- .../fixme/ManagementServerConfiguration.java | 141 ---- .../actuate/health/HealthIndicator.java | 32 - .../health/VanillaHealthIndicator.java | 31 - .../actuate/metrics/CounterService.java | 44 -- .../metrics/DefaultCounterService.java | 62 -- .../actuate/metrics/DefaultGaugeService.java | 51 -- .../actuate/metrics/GaugeService.java | 33 - .../metrics/InMemoryMetricRepository.java | 81 --- .../actuate/metrics/Measurement.java | 79 --- .../bootstrap/actuate/metrics/Metric.java | 113 --- .../actuate/metrics/MetricRepository.java | 45 -- .../ManagementServerProperties.java | 85 --- .../properties/SecurityProperties.java | 115 ---- .../security/AuthenticationAuditListener.java | 91 --- .../security/AuthorizationAuditListener.java | 78 --- .../trace/InMemoryTraceRepository.java | 61 -- .../bootstrap/actuate/trace/Trace.java | 52 -- .../actuate/trace/TraceRepository.java | 40 -- .../actuate/trace/WebRequestTraceFilter.java | 145 ---- .../actuate/web/BasicErrorController.java | 110 --- .../actuate/web/ErrorController.java | 31 - .../zero/actuate/audit/AuditEvent.java | 137 ++++ .../actuate/audit/AuditEventRepository.java | 45 ++ .../audit/InMemoryAuditEventRepository.java | 69 ++ .../audit/listener/AuditApplicationEvent.java | 80 +++ .../actuate/audit/listener/AuditListener.java | 47 ++ .../autoconfigure/AuditAutoConfiguration.java | 68 ++ .../EndpointAutoConfiguration.java | 203 ++++++ .../EndpointWebMvcAutoConfiguration.java | 163 +++++ ...dpointWebMvcChildContextConfiguration.java | 98 +++ .../ErrorMvcAutoConfiguration.java | 56 ++ ...mentServerPropertiesAutoConfiguration.java | 44 ++ .../MetricFilterAutoConfiguration.java | 131 ++++ .../MetricRepositoryAutoConfiguration.java | 56 ++ .../SecurityAutoConfiguration.java | 219 ++++++ .../TraceRepositoryAutoConfiguration.java | 40 ++ .../TraceWebFilterAutoConfiguration.java | 54 ++ .../actuate/endpoint/AbstractEndpoint.java | 71 ++ .../zero/actuate/endpoint/ActionEndpoint.java | 27 + .../zero/actuate/endpoint/BeansEndpoint.java | 62 ++ .../zero/actuate/endpoint/DumpEndpoint.java | 47 ++ .../zero/actuate/endpoint/Endpoint.java | 53 ++ .../actuate/endpoint/EnvironmentEndpoint.java | 86 +++ .../zero/actuate/endpoint/HealthEndpoint.java | 49 ++ .../zero/actuate/endpoint/InfoEndpoint.java | 58 ++ .../actuate/endpoint/MetricsEndpoint.java | 56 ++ .../zero/actuate/endpoint/PublicMetrics.java | 36 + .../actuate/endpoint/ShutdownEndpoint.java | 81 +++ .../zero/actuate/endpoint/TraceEndpoint.java | 51 ++ .../endpoint/VanillaPublicMetrics.java | 52 ++ .../endpoint/mvc/EndpointHandlerAdapter.java | 225 ++++++ .../endpoint/mvc/EndpointHandlerMapping.java | 133 ++++ .../fixme/ManagementServerConfiguration.java | 141 ++++ .../zero/actuate/health/HealthIndicator.java | 32 + .../health/VanillaHealthIndicator.java | 31 + .../zero/actuate/metrics/CounterService.java | 44 ++ .../metrics/DefaultCounterService.java | 62 ++ .../actuate/metrics/DefaultGaugeService.java | 51 ++ .../zero/actuate/metrics/GaugeService.java | 33 + .../metrics/InMemoryMetricRepository.java | 81 +++ .../zero/actuate/metrics/Measurement.java | 79 +++ .../zero/actuate/metrics/Metric.java | 113 +++ .../actuate/metrics/MetricRepository.java | 45 ++ .../ManagementServerProperties.java | 85 +++ .../properties/SecurityProperties.java | 115 ++++ .../security/AuthenticationAuditListener.java | 91 +++ .../security/AuthorizationAuditListener.java | 78 +++ .../trace/InMemoryTraceRepository.java | 61 ++ .../zero/actuate/trace/Trace.java | 52 ++ .../zero/actuate/trace/TraceRepository.java | 40 ++ .../actuate/trace/WebRequestTraceFilter.java | 145 ++++ .../actuate/web/BasicErrorController.java | 110 +++ .../zero/actuate/web/ErrorController.java | 31 + .../main/resources/META-INF/spring.factories | 22 +- .../bootstrap/actuate/TestUtils.java | 43 -- .../actuate/audit/AuditEventTests.java | 50 -- .../InMemoryAuditEventRepositoryTests.java | 45 -- .../audit/listener/AuditListenerTests.java | 44 -- .../AuditAutoConfigurationTests.java | 73 -- .../EndpointAutoConfigurationTests.java | 87 --- .../EndpointWebMvcAutoConfigurationTests.java | 237 ------- ...erverPropertiesAutoConfigurationTests.java | 65 -- .../MetricFilterAutoConfigurationTests.java | 93 --- ...etricRepositoryAutoConfigurationTests.java | 72 -- .../SecurityAutoConfigurationTests.java | 85 --- ...TraceRepositoryAutoConfigurationTests.java | 66 -- .../TraceWebFilterAutoConfigurationTest.java | 43 -- .../endpoint/AbstractEndpointTests.java | 111 --- .../actuate/endpoint/BeansEndpointTests.java | 55 -- .../actuate/endpoint/DumpEndpointTests.java | 57 -- .../endpoint/EnvironmentEndpointTests.java | 53 -- .../actuate/endpoint/HealthEndpointTests.java | 59 -- .../actuate/endpoint/InfoEndpointTests.java | 55 -- .../endpoint/MetricsEndpointTests.java | 64 -- .../endpoint/ShutdownEndpointTests.java | 68 -- .../actuate/endpoint/TraceEndpointTests.java | 60 -- .../endpoint/VanillaPublicMetricsTests.java | 51 -- .../mvc/EndpointHandlerAdapterTests.java | 43 -- .../mvc/EndpointHandlerMappingTests.java | 122 ---- .../fixme/ErrorConfigurationTests.java | 39 -- .../health/VanillaHealthIndicatorTests.java | 37 - .../metrics/DefaultCounterServiceTests.java | 37 - .../metrics/DefaultGaugeServiceTests.java | 37 - .../InMemoryMetricRepositoryTests.java | 37 - .../properties/SecurityPropertiesTests.java | 58 -- .../AuthenticationAuditListenerTests.java | 37 - .../AuthorizationAuditListenerTests.java | 37 - .../trace/InMemoryTraceRepositoryTests.java | 46 -- .../trace/WebRequestTraceFilterTests.java | 45 -- .../zero/actuate/TestUtils.java | 43 ++ .../zero/actuate/audit/AuditEventTests.java | 51 ++ .../InMemoryAuditEventRepositoryTests.java | 47 ++ .../audit/listener/AuditListenerTests.java | 46 ++ .../AuditAutoConfigurationTests.java | 74 ++ .../EndpointAutoConfigurationTests.java | 88 +++ .../EndpointWebMvcAutoConfigurationTests.java | 239 +++++++ ...erverPropertiesAutoConfigurationTests.java | 66 ++ .../MetricFilterAutoConfigurationTests.java | 94 +++ ...etricRepositoryAutoConfigurationTests.java | 73 ++ .../SecurityAutoConfigurationTests.java | 87 +++ ...TraceRepositoryAutoConfigurationTests.java | 67 ++ .../TraceWebFilterAutoConfigurationTest.java | 45 ++ .../endpoint/AbstractEndpointTests.java | 112 +++ .../actuate/endpoint/BeansEndpointTests.java | 56 ++ .../actuate/endpoint/DumpEndpointTests.java | 58 ++ .../endpoint/EnvironmentEndpointTests.java | 54 ++ .../actuate/endpoint/HealthEndpointTests.java | 60 ++ .../actuate/endpoint/InfoEndpointTests.java | 56 ++ .../endpoint/MetricsEndpointTests.java | 66 ++ .../endpoint/ShutdownEndpointTests.java | 69 ++ .../actuate/endpoint/TraceEndpointTests.java | 61 ++ .../endpoint/VanillaPublicMetricsTests.java | 52 ++ .../mvc/EndpointHandlerAdapterTests.java | 44 ++ .../mvc/EndpointHandlerMappingTests.java | 123 ++++ .../fixme/ErrorConfigurationTests.java | 39 ++ .../health/VanillaHealthIndicatorTests.java | 38 ++ .../metrics/DefaultCounterServiceTests.java | 38 ++ .../metrics/DefaultGaugeServiceTests.java | 38 ++ .../InMemoryMetricRepositoryTests.java | 38 ++ .../properties/SecurityPropertiesTests.java | 58 ++ .../AuthenticationAuditListenerTests.java | 38 ++ .../AuthorizationAuditListenerTests.java | 38 ++ .../trace/InMemoryTraceRepositoryTests.java | 48 ++ .../trace/WebRequestTraceFilterTests.java | 47 ++ .../autoconfigure/AutoConfigurationUtils.java | 63 -- .../MessageSourceAutoConfiguration.java | 49 -- .../PropertyPlaceholderAutoConfiguration.java | 46 -- .../batch/BatchAutoConfiguration.java | 58 -- .../batch/BatchDatabaseInitializer.java | 60 -- .../batch/JobExecutionEvent.java | 46 -- .../batch/JobExecutionExitCodeGenerator.java | 51 -- .../batch/JobLauncherCommandLineRunner.java | 82 --- .../JpaRepositoriesAutoConfiguration.java | 40 -- ...JpaRepositoriesAutoConfigureRegistrar.java | 122 ---- .../jdbc/AbstractDataSourceConfiguration.java | 86 --- .../jdbc/BasicDataSourceConfiguration.java | 68 -- .../jdbc/DataSourceAutoConfiguration.java | 294 -------- ...ceTransactionManagerAutoConfiguration.java | 58 -- .../jdbc/EmbeddedDatabaseConfiguration.java | 99 --- .../jdbc/TomcatDataSourceConfiguration.java | 53 -- .../jpa/HibernateJpaAutoConfiguration.java | 98 --- .../orm/jpa/JpaAutoConfiguration.java | 114 ---- .../thymeleaf/ThymeleafAutoConfiguration.java | 162 ----- ...ddedServletContainerAutoConfiguration.java | 103 --- .../web/MultipartAutoConfiguration.java | 48 -- .../ServerPropertiesAutoConfiguration.java | 106 --- .../web/WebMvcAutoConfiguration.java | 157 ----- .../annotation/AutoConfigurationSorter.java | 172 ----- .../annotation/AutoConfigureAfter.java | 33 - .../annotation/ComponentScanDetector.java | 154 ----- .../annotation/EnableAutoConfiguration.java | 71 -- ...EnableAutoConfigurationImportSelector.java | 87 --- .../bootstrap/main/Spring.java | 95 --- .../autoconfigure/AutoConfigurationUtils.java | 63 ++ .../MessageSourceAutoConfiguration.java | 49 ++ .../PropertyPlaceholderAutoConfiguration.java | 46 ++ .../batch/BatchAutoConfiguration.java | 58 ++ .../batch/BatchDatabaseInitializer.java | 60 ++ .../batch/JobExecutionEvent.java | 46 ++ .../batch/JobExecutionExitCodeGenerator.java | 51 ++ .../batch/JobLauncherCommandLineRunner.java | 82 +++ .../JpaRepositoriesAutoConfiguration.java | 40 ++ ...JpaRepositoriesAutoConfigureRegistrar.java | 122 ++++ .../jdbc/AbstractDataSourceConfiguration.java | 86 +++ .../jdbc/BasicDataSourceConfiguration.java | 68 ++ .../jdbc/DataSourceAutoConfiguration.java | 294 ++++++++ ...ceTransactionManagerAutoConfiguration.java | 58 ++ .../jdbc/EmbeddedDatabaseConfiguration.java | 99 +++ .../jdbc/TomcatDataSourceConfiguration.java | 53 ++ .../jpa/HibernateJpaAutoConfiguration.java | 98 +++ .../orm/jpa/JpaAutoConfiguration.java | 114 ++++ .../thymeleaf/ThymeleafAutoConfiguration.java | 162 +++++ ...ddedServletContainerAutoConfiguration.java | 103 +++ .../web/MultipartAutoConfiguration.java | 48 ++ .../ServerPropertiesAutoConfiguration.java | 106 +++ .../web/WebMvcAutoConfiguration.java | 157 +++++ .../annotation/AutoConfigurationSorter.java | 172 +++++ .../annotation/AutoConfigureAfter.java | 33 + .../annotation/ComponentScanDetector.java | 154 +++++ .../annotation/EnableAutoConfiguration.java | 74 ++ ...EnableAutoConfigurationImportSelector.java | 87 +++ .../org/springframework/zero/main/Spring.java | 95 +++ .../main/resources/META-INF/spring.factories | 26 +- .../autoconfigure/AdhocTestSuite.java | 36 - .../MessageSourceAutoConfigurationTests.java | 60 -- .../autoconfigure/SpringJUnitTests.java | 64 -- .../batch/BatchAutoConfigurationTests.java | 105 --- .../JobExecutionExitCodeGeneratorTests.java | 54 -- ...JpaRepositoriesAutoConfigurationTests.java | 62 -- .../data/JpaWebAutoConfigurationTests.java | 63 -- .../autoconfigure/data/test/City.java | 76 --- .../data/test/CityRepository.java | 32 - .../BasicDataSourceConfigurationTests.java | 41 -- .../DataSourceAutoConfigurationTests.java | 118 ---- ...nsactionManagerAutoConfigurationTests.java | 54 -- .../EmbeddedDatabaseConfigurationTests.java | 42 -- .../TomcatDataSourceConfigurationTests.java | 88 --- .../HibernateJpaAutoConfigurationTests.java | 66 -- .../autoconfigure/orm/jpa/test/City.java | 76 --- .../ThymeleafAutoConfigurationTests.java | 84 --- ...ervletContainerAutoConfigurationTests.java | 125 ---- .../web/MultipartAutoConfigurationTests.java | 215 ------ .../ServerPropertiesConfigurationTests.java | 105 --- .../web/WebMvcAutoConfigurationTests.java | 29 - .../AutoConfigurationSorterTest.java | 104 --- .../ComponentScanDetectorConfiguration.java | 29 - .../bootstrap/main/SimpleMainTests.java | 63 -- .../zero/autoconfigure/AdhocTestSuite.java | 36 + .../MessageSourceAutoConfigurationTests.java | 62 ++ .../zero/autoconfigure/SpringJUnitTests.java | 64 ++ .../batch/BatchAutoConfigurationTests.java | 107 +++ .../JobExecutionExitCodeGeneratorTests.java | 56 ++ ...JpaRepositoriesAutoConfigurationTests.java | 63 ++ .../data/JpaWebAutoConfigurationTests.java | 64 ++ .../zero/autoconfigure/data/test/City.java | 76 +++ .../data/test/CityRepository.java | 32 + .../BasicDataSourceConfigurationTests.java | 42 ++ .../DataSourceAutoConfigurationTests.java | 119 ++++ ...nsactionManagerAutoConfigurationTests.java | 56 ++ .../EmbeddedDatabaseConfigurationTests.java | 43 ++ .../TomcatDataSourceConfigurationTests.java | 90 +++ .../HibernateJpaAutoConfigurationTests.java | 67 ++ .../zero/autoconfigure/orm/jpa/test/City.java | 76 +++ .../ThymeleafAutoConfigurationTests.java | 85 +++ ...ervletContainerAutoConfigurationTests.java | 126 ++++ .../web/MultipartAutoConfigurationTests.java | 217 ++++++ .../ServerPropertiesConfigurationTests.java | 106 +++ .../web/WebMvcAutoConfigurationTests.java | 30 + .../AutoConfigurationSorterTest.java | 106 +++ .../ComponentScanDetectorConfiguration.java | 30 + .../zero/main/SimpleMainTests.java | 64 ++ .../context/annotation/testProperties.xml | 12 - ...pleEmbeddedWebApplicationConfiguration.xml | 11 - .../bootstrap/sample-beans.xml | 9 - .../test/resources/fixme/static/css/style.css | 1 - .../bootstrap/autoconfigure/jdbc/schema.sql | 4 - .../zero}/autoconfigure/jdbc/schema.sql | 0 spring-zero-cli/pom.xml | 2 +- spring-zero-cli/samples/actuator.groovy | 2 +- spring-zero-cli/samples/template.groovy | 2 +- .../src/main/assembly/descriptor.xml | 2 +- .../bootstrap/cli/BootstrapCliException.java | 96 --- .../bootstrap/cli/Command.java | 58 -- .../bootstrap/cli/CommandFactory.java | 36 - .../bootstrap/cli/NoSuchCommandException.java | 33 - .../bootstrap/cli/SpringBootstrapCli.java | 254 ------- .../cli/command/AbstractCommand.java | 63 -- .../bootstrap/cli/command/CleanCommand.java | 167 ----- .../bootstrap/cli/command/CreateCommand.java | 57 -- .../cli/command/DefaultCommandFactory.java | 41 -- .../bootstrap/cli/command/OptionHandler.java | 86 --- .../cli/command/OptionParsingCommand.java | 50 -- .../bootstrap/cli/command/RunCommand.java | 180 ----- .../bootstrap/cli/command/ScriptCommand.java | 233 ------- .../command/ScriptCompilationCustomizer.java | 156 ----- .../bootstrap/cli/command/VersionCommand.java | 38 -- .../bootstrap/cli/compiler/AstUtils.java | 46 -- .../compiler/CompilerAutoConfiguration.java | 83 --- .../cli/compiler/DependencyCustomizer.java | 232 ------- .../compiler/ExtendedGroovyClassLoader.java | 95 --- .../cli/compiler/GroovyCompiler.java | 212 ------ .../compiler/GroovyCompilerConfiguration.java | 36 - .../SpringBatchCompilerAutoConfiguration.java | 67 -- ...ingBootstrapCompilerAutoConfiguration.java | 119 ---- ...gIntegrationCompilerAutoConfiguration.java | 80 --- .../SpringMvcCompilerAutoConfiguration.java | 65 -- .../bootstrap/cli/runner/BootstrapRunner.java | 206 ------ .../runner/BootstrapRunnerConfiguration.java | 46 -- .../cli/template/GroovyTemplate.java | 61 -- .../org/springframework/zero/cli/Command.java | 58 ++ .../zero/cli/CommandFactory.java | 36 + .../zero/cli/NoSuchCommandException.java | 33 + .../zero/cli/SpringZeroCli.java | 254 +++++++ .../zero/cli/SpringZeroCliException.java | 96 +++ .../zero/cli/command/AbstractCommand.java | 63 ++ .../zero/cli/command/CleanCommand.java | 167 +++++ .../zero/cli/command/CreateCommand.java | 57 ++ .../cli/command/DefaultCommandFactory.java | 41 ++ .../zero/cli/command/OptionHandler.java | 86 +++ .../cli/command/OptionParsingCommand.java | 50 ++ .../zero/cli/command/RunCommand.java | 180 +++++ .../zero/cli/command/ScriptCommand.java | 233 +++++++ .../command/ScriptCompilationCustomizer.java | 156 +++++ .../zero/cli/command/VersionCommand.java | 38 ++ .../zero/cli/compiler/AstUtils.java | 46 ++ .../compiler/CompilerAutoConfiguration.java | 83 +++ .../cli/compiler/DependencyCustomizer.java | 232 +++++++ .../compiler/ExtendedGroovyClassLoader.java | 95 +++ .../zero/cli/compiler/GroovyCompiler.java | 212 ++++++ .../compiler/GroovyCompilerConfiguration.java | 36 + .../SpringBatchCompilerAutoConfiguration.java | 67 ++ ...gIntegrationCompilerAutoConfiguration.java | 80 +++ .../SpringMvcCompilerAutoConfiguration.java | 65 ++ .../SpringZeroCompilerAutoConfiguration.java | 118 ++++ .../zero/cli/runner/SpringZeroRunner.java | 206 ++++++ .../runner/SpringZeroRunnerConfiguration.java | 46 ++ .../zero/cli/template/GroovyTemplate.java | 61 ++ ...ringframework.bootstrap.cli.CommandFactory | 1 - ...rap.cli.compiler.CompilerAutoConfiguration | 5 - ...rg.springframework.zero.cli.CommandFactory | 1 + ...ero.cli.compiler.CompilerAutoConfiguration | 5 + .../bootstrap/cli/SampleIntegrationTests.java | 170 ----- .../cli/SpringBootstrapCliTests.java | 166 ----- .../cli/command/ScriptCommandTests.java | 120 ---- .../zero/cli/SampleIntegrationTests.java | 170 +++++ .../zero/cli/SpringZeroCliTests.java | 169 +++++ .../zero/cli/command/ScriptCommandTests.java | 122 ++++ .../test/resources/commands/closure.groovy | 4 +- .../test/resources/commands/command.groovy | 6 +- .../test/resources/commands/handler.groovy | 2 +- .../src/test/resources/commands/mixin.groovy | 2 +- .../test/resources/commands/runnable.groovy | 4 +- .../src/test/resources/commands/test.groovy | 2 +- .../src/test/resources/log4j.properties | 2 +- .../org/springframework/bootstrap/Banner.java | 49 -- .../bootstrap/BeanDefinitionLoader.java | 196 ------ .../bootstrap/CommandLineRunner.java | 39 -- .../bootstrap/ExitCodeGenerator.java | 35 - .../bootstrap/SpringApplication.java | 643 ------------------ .../bind/CustomPropertyConstructor.java | 101 --- .../bootstrap/bind/InetAddressEditor.java | 45 -- .../bind/PropertiesConfigurationFactory.java | 259 ------- .../bind/PropertySourcesPropertyValues.java | 119 ---- .../bootstrap/bind/RelaxedDataBinder.java | 275 -------- .../bind/YamlConfigurationFactory.java | 192 ------ .../bootstrap/config/JacksonJsonParser.java | 53 -- .../bootstrap/config/JsonParser.java | 46 -- .../bootstrap/config/JsonParserFactory.java | 46 -- .../bootstrap/config/SimpleJsonParser.java | 143 ---- .../bootstrap/config/YamlJsonParser.java | 46 -- .../bootstrap/config/YamlMapFactoryBean.java | 126 ---- .../bootstrap/config/YamlProcessor.java | 302 -------- .../config/YamlPropertiesFactoryBean.java | 109 --- .../annotation/AbstractOnBeanCondition.java | 167 ----- .../context/annotation/AssertMissingBean.java | 61 -- .../AssertMissingBeanCondition.java | 50 -- .../context/annotation/ConditionLogUtils.java | 46 -- .../context/annotation/ConditionalOnBean.java | 60 -- .../annotation/ConditionalOnClass.java | 52 -- .../annotation/ConditionalOnExpression.java | 41 -- .../annotation/ConditionalOnMissingBean.java | 60 -- .../annotation/ConditionalOnMissingClass.java | 43 -- .../ConditionalOnNotWebApplication.java | 38 -- .../annotation/ConditionalOnResource.java | 44 -- .../ConditionalOnWebApplication.java | 38 -- .../annotation/ConfigurationProperties.java | 73 -- ...urationPropertiesBindingConfiguration.java | 146 ---- .../EnableConfigurationProperties.java | 48 -- ...ConfigurationPropertiesImportSelector.java | 113 --- .../context/annotation/OnBeanCondition.java | 33 - .../context/annotation/OnClassCondition.java | 82 --- .../annotation/OnExpressionCondition.java | 75 -- .../annotation/OnMissingBeanCondition.java | 40 -- .../annotation/OnMissingClassCondition.java | 82 --- .../OnNotWebApplicationCondition.java | 61 -- .../annotation/OnResourceCondition.java | 85 --- .../annotation/OnWebApplicationCondition.java | 61 -- .../PropertySourcesBindingPostProcessor.java | 138 ---- ...stractEmbeddedServletContainerFactory.java | 386 ----------- ...onConfigEmbeddedWebApplicationContext.java | 190 ------ ...urableEmbeddedServletContainerFactory.java | 72 -- .../embedded/EmbeddedServletContainer.java | 51 -- .../EmbeddedServletContainerCustomizer.java | 38 -- ...tContainerCustomizerBeanPostProcessor.java | 86 --- .../EmbeddedServletContainerException.java | 31 - .../EmbeddedServletContainerFactory.java | 46 -- .../EmbeddedWebApplicationContext.java | 357 ---------- .../bootstrap/context/embedded/ErrorPage.java | 135 ---- .../embedded/FilterRegistrationBean.java | 258 ------- .../context/embedded/RegistrationBean.java | 128 ---- .../embedded/ServletContextInitializer.java | 53 -- .../embedded/ServletRegistrationBean.java | 207 ------ ...onContextServletContextAwareProcessor.java | 56 -- .../XmlEmbeddedWebApplicationContext.java | 133 ---- .../jetty/JettyEmbeddedServletContainer.java | 74 -- .../JettyEmbeddedServletContainerFactory.java | 285 -------- ...ervletContextInitializerConfiguration.java | 71 -- .../context/embedded/jetty/package-info.java | 21 - .../context/embedded/package-info.java | 23 - ...etContextInitializerLifecycleListener.java | 62 -- .../TomcatEmbeddedServletContainer.java | 87 --- ...TomcatEmbeddedServletContainerFactory.java | 380 ----------- .../TomcatEmbeddedWebappClassLoader.java | 59 -- .../context/embedded/tomcat/package-info.java | 21 - ...nfigFileApplicationContextInitializer.java | 267 -------- ...ontextIdApplicationContextInitializer.java | 91 --- ...DelegateApplicationContextInitializer.java | 116 ---- .../LoggingApplicationContextInitializer.java | 221 ------ .../VcapApplicationContextInitializer.java | 200 ------ .../logging/JavaLoggerConfigurer.java | 53 -- .../bootstrap/logging/LogbackConfigurer.java | 56 -- .../properties/ServerProperties.java | 119 ---- .../web/SpringServletInitializer.java | 78 --- .../java/org/springframework/zero/Banner.java | 49 ++ .../zero/BeanDefinitionLoader.java | 196 ++++++ .../zero/CommandLineRunner.java | 39 ++ .../zero/ExitCodeGenerator.java | 35 + .../zero/SpringApplication.java | 643 ++++++++++++++++++ .../zero/bind/CustomPropertyConstructor.java | 101 +++ .../zero/bind/InetAddressEditor.java | 45 ++ .../bind/PropertiesConfigurationFactory.java | 259 +++++++ .../bind/PropertySourcesPropertyValues.java | 119 ++++ .../zero/bind/RelaxedDataBinder.java | 275 ++++++++ .../zero/bind/YamlConfigurationFactory.java | 192 ++++++ .../zero/config/JacksonJsonParser.java | 53 ++ .../zero/config/JsonParser.java | 46 ++ .../zero/config/JsonParserFactory.java | 46 ++ .../zero/config/SimpleJsonParser.java | 143 ++++ .../zero/config/YamlJsonParser.java | 46 ++ .../zero/config/YamlMapFactoryBean.java | 126 ++++ .../zero/config/YamlProcessor.java | 302 ++++++++ .../config/YamlPropertiesFactoryBean.java | 109 +++ .../annotation/AbstractOnBeanCondition.java | 167 +++++ .../context/annotation/AssertMissingBean.java | 61 ++ .../AssertMissingBeanCondition.java | 50 ++ .../context/annotation/ConditionLogUtils.java | 46 ++ .../context/annotation/ConditionalOnBean.java | 60 ++ .../annotation/ConditionalOnClass.java | 52 ++ .../annotation/ConditionalOnExpression.java | 41 ++ .../annotation/ConditionalOnMissingBean.java | 60 ++ .../annotation/ConditionalOnMissingClass.java | 43 ++ .../ConditionalOnNotWebApplication.java | 38 ++ .../annotation/ConditionalOnResource.java | 44 ++ .../ConditionalOnWebApplication.java | 38 ++ .../annotation/ConfigurationProperties.java | 73 ++ ...urationPropertiesBindingConfiguration.java | 146 ++++ .../EnableConfigurationProperties.java | 48 ++ ...ConfigurationPropertiesImportSelector.java | 113 +++ .../context/annotation/OnBeanCondition.java | 33 + .../context/annotation/OnClassCondition.java | 82 +++ .../annotation/OnExpressionCondition.java | 75 ++ .../annotation/OnMissingBeanCondition.java | 40 ++ .../annotation/OnMissingClassCondition.java | 82 +++ .../OnNotWebApplicationCondition.java | 61 ++ .../annotation/OnResourceCondition.java | 85 +++ .../annotation/OnWebApplicationCondition.java | 61 ++ .../PropertySourcesBindingPostProcessor.java | 138 ++++ ...stractEmbeddedServletContainerFactory.java | 386 +++++++++++ ...onConfigEmbeddedWebApplicationContext.java | 190 ++++++ ...urableEmbeddedServletContainerFactory.java | 72 ++ .../embedded/EmbeddedServletContainer.java | 51 ++ .../EmbeddedServletContainerCustomizer.java | 38 ++ ...tContainerCustomizerBeanPostProcessor.java | 86 +++ .../EmbeddedServletContainerException.java | 31 + .../EmbeddedServletContainerFactory.java | 46 ++ .../EmbeddedWebApplicationContext.java | 357 ++++++++++ .../zero/context/embedded/ErrorPage.java | 135 ++++ .../embedded/FilterRegistrationBean.java | 258 +++++++ .../context/embedded/RegistrationBean.java | 128 ++++ .../embedded/ServletContextInitializer.java | 53 ++ .../embedded/ServletRegistrationBean.java | 207 ++++++ ...onContextServletContextAwareProcessor.java | 56 ++ .../XmlEmbeddedWebApplicationContext.java | 133 ++++ .../jetty/JettyEmbeddedServletContainer.java | 74 ++ .../JettyEmbeddedServletContainerFactory.java | 285 ++++++++ ...ervletContextInitializerConfiguration.java | 71 ++ .../context/embedded/jetty/package-info.java | 21 + .../zero/context/embedded/package-info.java | 23 + ...etContextInitializerLifecycleListener.java | 62 ++ .../TomcatEmbeddedServletContainer.java | 87 +++ ...TomcatEmbeddedServletContainerFactory.java | 380 +++++++++++ .../TomcatEmbeddedWebappClassLoader.java | 59 ++ .../context/embedded/tomcat/package-info.java | 21 + ...nfigFileApplicationContextInitializer.java | 267 ++++++++ ...ontextIdApplicationContextInitializer.java | 91 +++ ...DelegateApplicationContextInitializer.java | 116 ++++ .../LoggingApplicationContextInitializer.java | 221 ++++++ .../VcapApplicationContextInitializer.java | 200 ++++++ .../zero/logging/JavaLoggerConfigurer.java | 53 ++ .../zero/logging/LogbackConfigurer.java | 56 ++ .../zero/properties/ServerProperties.java | 119 ++++ .../zero/web/SpringServletInitializer.java | 78 +++ .../main/resources/META-INF/spring.factories | 10 +- .../logging/log4j.properties | 0 .../{bootstrap => zero}/logging/logback.xml | 0 .../logging/logging.properties | 0 .../bootstrap/BeanDefinitionLoaderTests.java | 109 --- .../bootstrap/SpringApplicationTests.java | 446 ------------ .../springframework/bootstrap/TestUtils.java | 43 -- .../PropertiesConfigurationFactoryTests.java | 135 ---- .../PropertySourcesPropertyValuesTests.java | 103 --- .../bind/RelaxedDataBinderTests.java | 377 ---------- .../bind/YamlConfigurationFactoryTests.java | 89 --- .../bootstrap/config/JacksonParserTests.java | 28 - .../config/SimpleJsonParserTests.java | 73 -- .../config/YamlMapFactoryBeanTests.java | 90 --- .../bootstrap/config/YamlParserTests.java | 28 - .../YamlPropertiesFactoryBeanTests.java | 212 ------ .../EnableConfigurationPropertiesTests.java | 229 ------- .../NotWebApplicationConditionTests.java | 67 -- .../annotation/OnBeanConditionTests.java | 114 ---- .../annotation/OnClassConditionTests.java | 105 --- .../OnExpressionConditionTests.java | 67 -- .../OnMissingBeanConditionTests.java | 143 ---- .../OnMissingClassConditionTests.java | 77 --- .../annotation/OnResourceConditionTests.java | 67 -- .../WebApplicationConditionTests.java | 70 -- ...tEmbeddedServletContainerFactoryTests.java | 256 ------- ...figEmbeddedWebApplicationContextTests.java | 164 ----- ...edServletContainerMvcIntegrationTests.java | 170 ----- .../EmbeddedWebApplicationContextTests.java | 364 ---------- .../context/embedded/ExampleFilter.java | 50 -- .../context/embedded/ExampleServlet.java | 39 -- .../embedded/FilterRegistrationBeanTests.java | 221 ------ .../MockEmbeddedServletContainerFactory.java | 221 ------ .../context/embedded/MockFilter.java | 47 -- .../context/embedded/MockServlet.java | 38 -- .../ServletRegistrationBeanTests.java | 207 ------ ...XmlEmbeddedWebApplicationContextTests.java | 91 --- ...leEmbeddedWebApplicationConfiguration.java | 47 -- ...yEmbeddedServletContainerFactoryTests.java | 61 -- ...tEmbeddedServletContainerFactoryTests.java | 64 -- ...ileApplicationContextInitializerTests.java | 122 ---- ...tIdApplicationContextInitializerTests.java | 77 --- ...gateApplicationContextInitializerTest.java | 139 ---- ...capApplicationContextInitializerTests.java | 56 -- .../EnableConfigurationPropertiesTests.java | 135 ---- .../logging/JavaLoggerConfigurerTests.java | 83 --- .../logging/LogbackConfigurerTests.java | 83 --- .../logging/LoggingInitializerTests.java | 144 ---- .../bootstrap/logging/TestFormatter.java | 33 - .../properties/ServerPropertiesTests.java | 71 -- .../bootstrap/sampleconfig/MyComponent.java | 24 - .../zero/BeanDefinitionLoaderTests.java | 109 +++ .../zero/SpringApplicationTests.java | 450 ++++++++++++ .../org/springframework/zero/TestUtils.java | 43 ++ .../PropertiesConfigurationFactoryTests.java | 136 ++++ .../PropertySourcesPropertyValuesTests.java | 104 +++ .../zero/bind/RelaxedDataBinderTests.java | 378 ++++++++++ .../bind/YamlConfigurationFactoryTests.java | 90 +++ .../zero/config/JacksonParserTests.java | 31 + .../zero/config/SimpleJsonParserTests.java | 75 ++ .../zero/config/YamlMapFactoryBeanTests.java | 91 +++ .../zero/config/YamlParserTests.java | 31 + .../YamlPropertiesFactoryBeanTests.java | 213 ++++++ .../EnableConfigurationPropertiesTests.java | 229 +++++++ .../NotWebApplicationConditionTests.java | 69 ++ .../annotation/OnBeanConditionTests.java | 114 ++++ .../annotation/OnClassConditionTests.java | 105 +++ .../OnExpressionConditionTests.java | 68 ++ .../OnMissingBeanConditionTests.java | 145 ++++ .../OnMissingClassConditionTests.java | 77 +++ .../annotation/OnResourceConditionTests.java | 68 ++ .../WebApplicationConditionTests.java | 72 ++ ...tEmbeddedServletContainerFactoryTests.java | 262 +++++++ ...figEmbeddedWebApplicationContextTests.java | 166 +++++ ...edServletContainerMvcIntegrationTests.java | 170 +++++ .../EmbeddedWebApplicationContextTests.java | 368 ++++++++++ .../zero/context/embedded/ExampleFilter.java | 50 ++ .../zero/context/embedded/ExampleServlet.java | 39 ++ .../embedded/FilterRegistrationBeanTests.java | 221 ++++++ .../MockEmbeddedServletContainerFactory.java | 225 ++++++ .../zero/context/embedded/MockFilter.java | 47 ++ .../zero/context/embedded/MockServlet.java | 38 ++ .../ServletRegistrationBeanTests.java | 207 ++++++ ...XmlEmbeddedWebApplicationContextTests.java | 91 +++ ...leEmbeddedWebApplicationConfiguration.java | 47 ++ ...yEmbeddedServletContainerFactoryTests.java | 61 ++ ...tEmbeddedServletContainerFactoryTests.java | 64 ++ ...ileApplicationContextInitializerTests.java | 122 ++++ ...tIdApplicationContextInitializerTests.java | 78 +++ ...gateApplicationContextInitializerTest.java | 140 ++++ ...capApplicationContextInitializerTests.java | 57 ++ .../EnableConfigurationPropertiesTests.java | 135 ++++ .../logging/JavaLoggerConfigurerTests.java | 84 +++ .../zero/logging/LogbackConfigurerTests.java | 83 +++ .../zero/logging/LoggingInitializerTests.java | 144 ++++ .../zero/logging/TestFormatter.java | 33 + .../properties/ServerPropertiesTests.java | 72 ++ .../zero/sampleconfig/MyComponent.java | 24 + .../src/test/resources/logback-nondefault.xml | 2 +- .../src/test/resources/logback-test.xml | 6 +- .../bootstrap/context/annotation/foo.xml | 10 - .../context/annotation/testProperties.xml | 12 - .../context/embedded/conf.properties | 1 - ...pleEmbeddedWebApplicationConfiguration.xml | 11 - .../bootstrap/sample-beans.xml | 9 - .../zero}/context/annotation/foo.xml | 0 .../context/annotation/testProperties.xml | 12 + .../zero}/context/embedded/conf.properties | 0 ...pleEmbeddedWebApplicationConfiguration.xml | 11 + .../org/springframework/zero/sample-beans.xml | 9 + spring-zero-intergration-tests/build.log | 495 -------------- .../bootstrap/launcher/JarLauncher.java | 47 -- .../bootstrap/launcher/Launcher.java | 203 ------ .../bootstrap/launcher/MainMethodRunner.java | 60 -- .../bootstrap/launcher/WarLauncher.java | 76 --- .../launcher/data/RandomAccessData.java | 51 -- .../launcher/data/RandomAccessDataFile.java | 252 ------- .../bootstrap/launcher/data/package-info.java | 23 - .../launcher/jar/JarEntryFilter.java | 38 -- .../jar/RandomAccessDataZipEntry.java | 49 -- .../jar/RandomAccessDataZipInputStream.java | 122 ---- .../launcher/jar/RandomAccessJarFile.java | 468 ------------- .../bootstrap/launcher/jar/package-info.java | 21 - .../bootstrap/launcher/package-info.java | 27 - .../zero/launcher/JarLauncher.java | 47 ++ .../zero/launcher/Launcher.java | 203 ++++++ .../zero/launcher/MainMethodRunner.java | 60 ++ .../zero/launcher/WarLauncher.java | 76 +++ .../zero/launcher/data/RandomAccessData.java | 51 ++ .../launcher/data/RandomAccessDataFile.java | 252 +++++++ .../zero/launcher/data/package-info.java | 23 + .../zero/launcher/jar/JarEntryFilter.java | 38 ++ .../jar/RandomAccessDataZipEntry.java | 49 ++ .../jar/RandomAccessDataZipInputStream.java | 122 ++++ .../launcher/jar/RandomAccessJarFile.java | 468 +++++++++++++ .../zero/launcher/jar/package-info.java | 21 + .../zero/launcher/package-info.java | 27 + .../launcher/ByteArrayStartsWith.java | 53 -- .../data/RandomAccessDataFileTest.java | 313 --------- .../RandomAccessDataZipInputStreamTest.java | 91 --- .../launcher/jar/RandomAccessJarFileTest.java | 338 --------- .../zero/launcher/ByteArrayStartsWith.java | 53 ++ .../data/RandomAccessDataFileTest.java | 315 +++++++++ .../RandomAccessDataZipInputStreamTest.java | 93 +++ .../launcher/jar/RandomAccessJarFileTest.java | 340 +++++++++ .../src/it/executable-jar/verify.groovy | 2 +- .../src/it/executable-war/verify.groovy | 2 +- .../maven/AbstractExecutableArchiveMojo.java | 330 --------- .../bootstrap/maven/ExecutableJarMojo.java | 61 -- .../bootstrap/maven/ExecutableWarMojo.java | 90 --- .../bootstrap/maven/MainClassFinder.java | 156 ----- .../PropertiesMergingResourceTransformer.java | 87 --- .../maven/AbstractExecutableArchiveMojo.java | 330 +++++++++ .../zero/maven/ExecutableJarMojo.java | 61 ++ .../zero/maven/ExecutableWarMojo.java | 90 +++ .../zero/maven/MainClassFinder.java | 156 +++++ .../PropertiesMergingResourceTransformer.java | 87 +++ .../bootstrap/maven/MainClassFinderTests.java | 94 --- ...ertiesMergingResourceTransformerTests.java | 68 -- .../bootstrap/maven/Verify.java | 158 ----- .../maven/sample/ClassWithMainMethod.java | 29 - .../maven/sample/ClassWithoutMainMethod.java | 25 - .../zero/maven/MainClassFinderTests.java | 95 +++ ...ertiesMergingResourceTransformerTests.java | 69 ++ .../springframework/zero/maven/Verify.java | 149 ++++ .../maven/sample/ClassWithMainMethod.java | 29 + .../maven/sample/ClassWithoutMainMethod.java | 25 + .../ui/ActuatorUiBootstrapApplication.java | 38 -- .../ui/SampleActuatorUiApplication.java | 38 ++ .../ActuatorUiBootstrapApplicationTests.java | 113 --- ...ementServiceBootstrapApplicationTests.java | 97 --- .../SampleActuatorUiApplicationPortTests.java | 98 +++ .../ui/SampleActuatorUiApplicationTests.java | 112 +++ .../src/test/resources/logging.properties | 4 +- .../sample/service/HelloWorldService.java | 32 - .../sample/service/SampleController.java | 45 -- .../service/ServiceBootstrapApplication.java | 35 - .../sample/service/ServiceProperties.java | 36 - .../sample/actuator/HelloWorldService.java | 32 + .../actuator/SampleActuatorApplication.java | 35 + .../sample/actuator/SampleController.java | 45 ++ .../sample/actuator/ServiceProperties.java | 36 + .../src/main/resources/logging.properties | 2 +- ...rtiesServiceBootstrapApplicationTests.java | 112 --- ...dressServiceBootstrapApplicationTests.java | 151 ---- ...ementServiceBootstrapApplicationTests.java | 88 --- ...ementServiceBootstrapApplicationTests.java | 121 ---- .../ServiceBootstrapApplicationTests.java | 193 ------ ...tdownServiceBootstrapApplicationTests.java | 121 ---- ...ecureServiceBootstrapApplicationTests.java | 81 --- ...pertiesSampleActuatorApplicationTests.java | 112 +++ ...AddressSampleActuatorApplicationTests.java | 151 ++++ ...agementSampleActuatorApplicationTests.java | 88 +++ ...agementSampleActuatorApplicationTests.java | 121 ++++ .../SampleActuatorApplicationTests.java | 193 ++++++ ...hutdownSampleActuatorApplicationTests.java | 121 ++++ ...nsecureSampleActuatorApplicationTests.java | 79 +++ .../spring-zero-sample-actuator/start.groovy | 6 +- .../batch/BatchBootstrapApplication.java | 74 -- .../sample/batch/SampleBatchApplication.java | 74 ++ .../batch/BatchBootstrapApplicationTests.java | 60 -- .../batch/SampleBatchApplicationTests.java | 61 ++ .../sample/data/DataBootstrapApplication.java | 33 - .../bootstrap/sample/data/domain/City.java | 76 --- .../bootstrap/sample/data/domain/Hotel.java | 81 --- .../sample/data/domain/HotelSummary.java | 63 -- .../bootstrap/sample/data/domain/Rating.java | 21 - .../sample/data/domain/RatingCount.java | 41 -- .../bootstrap/sample/data/domain/Review.java | 129 ---- .../sample/data/domain/ReviewDetails.java | 86 --- .../sample/data/domain/TripType.java | 21 - .../domain/repository/CityRepository.java | 33 - .../domain/repository/HotelRepository.java | 27 - .../repository/HotelSummaryRepository.java | 106 --- .../domain/repository/ReviewRepository.java | 31 - .../data/service/CitySearchCriteria.java | 44 -- .../sample/data/service/CityService.java | 32 - .../sample/data/service/HotelService.java | 38 -- .../sample/data/service/ReviewsSummary.java | 25 - .../data/service/impl/CityServiceImpl.java | 84 --- .../data/service/impl/HotelServiceImpl.java | 118 ---- .../sample/data/web/SampleController.java | 36 - .../data/jpa/SampleDataJpaApplication.java | 33 + .../zero/sample/data/jpa/domain/City.java | 76 +++ .../zero/sample/data/jpa/domain/Hotel.java | 81 +++ .../sample/data/jpa/domain/HotelSummary.java | 63 ++ .../zero/sample/data/jpa/domain/Rating.java | 21 + .../sample/data/jpa/domain/RatingCount.java | 41 ++ .../zero/sample/data/jpa/domain/Review.java | 129 ++++ .../sample/data/jpa/domain/ReviewDetails.java | 86 +++ .../zero/sample/data/jpa/domain/TripType.java | 21 + .../jpa/domain/repository/CityRepository.java | 33 + .../domain/repository/HotelRepository.java | 27 + .../repository/HotelSummaryRepository.java | 106 +++ .../domain/repository/ReviewRepository.java | 31 + .../data/jpa/service/CitySearchCriteria.java | 44 ++ .../sample/data/jpa/service/CityService.java | 32 + .../sample/data/jpa/service/HotelService.java | 38 ++ .../data/jpa/service/ReviewsSummary.java | 25 + .../jpa/service/impl/CityServiceImpl.java | 84 +++ .../jpa/service/impl/HotelServiceImpl.java | 118 ++++ .../sample/data/jpa/web/SampleController.java | 36 + .../data/DataBootstrapApplicationTests.java | 71 -- .../jpa/SampleDataJpaApplicationTests.java | 72 ++ .../sample/consumer/HelloWorldService.java | 32 - .../IntegrationBootstrapApplication.java | 37 - .../sample/consumer/SampleEndpoint.java | 41 -- .../sample/consumer/ServiceProperties.java | 34 - .../sample/integration/HelloWorldService.java | 32 + .../sample/integration/SampleEndpoint.java | 41 ++ .../SampleIntegrationApplication.java | 37 + .../sample/integration/ServiceProperties.java | 34 + .../IntegrationBootstrapApplicationTests.java | 72 -- .../sample/producer/ProducerApplication.java | 29 - .../SampleIntegrationApplicationTests.java | 73 ++ .../producer/ProducerApplication.java | 31 + .../jetty/JettyBootstrapApplication.java | 33 - .../jetty/service/HelloWorldService.java | 32 - .../sample/jetty/web/SampleController.java | 36 - .../sample/jetty/SampleJettyApplication.java | 33 + .../jetty/service/HelloWorldService.java | 32 + .../sample/jetty/web/SampleController.java | 36 + .../jetty/JettyBootstrapApplicationTests.java | 72 -- .../jetty/SampleJettyApplicationTests.java | 71 ++ .../simple/ProfileBootstrapApplication.java | 47 -- .../simple/service/GoodbyeWorldService.java | 35 - .../simple/service/HelloWorldService.java | 35 - .../sample/simple/service/MessageService.java | 26 - .../profile/SampleProfileApplication.java | 47 ++ .../profile/service/GoodbyeWorldService.java | 35 + .../profile/service/HelloWorldService.java | 35 + .../profile/service/MessageService.java | 26 + .../ProfileBootstrapApplicationTests.java | 73 -- .../SampleProfileApplicationTests.java | 74 ++ .../simple/SimpleBootstrapApplication.java | 47 -- .../simple/service/HelloWorldService.java | 32 - .../simple/SampleSimpleApplication.java | 47 ++ .../simple/service/HelloWorldService.java | 32 + .../SimpleBootstrapApplicationTests.java | 54 -- .../simple/SampleSimpleApplicationTests.java | 62 ++ .../tomcat/TomcatBootstrapApplication.java | 33 - .../tomcat/service/HelloWorldService.java | 32 - .../sample/tomcat/web/SampleController.java | 36 - .../tomcat/SampleTomcatApplication.java | 33 + .../tomcat/service/HelloWorldService.java | 32 + .../sample/tomcat/web/SampleController.java | 36 + ...onfigurationBootstrapApplicationTests.java | 92 --- .../TomcatBootstrapApplicationTests.java | 72 -- ...igurationSampleTomcatApplicationTests.java | 92 +++ .../tomcat/SampleTomcatApplicationTests.java | 71 ++ .../sample/trad/TradBootstrapApplication.java | 33 - .../sample/trad/config/WebConfig.java | 56 -- .../SampleTraditionalApplication.java | 33 + .../sample/traditional/config/WebConfig.java | 56 ++ .../trad/TradBootstrapApplicationTests.java | 84 --- .../SampleTraditionalApplicationTests.java | 85 +++ .../sample/ui/InMemoryMessageRespository.java | 52 -- .../bootstrap/sample/ui/Message.java | 66 -- .../sample/ui/MessageRepository.java | 27 - .../sample/ui/UiBootstrapApplication.java | 50 -- .../sample/ui/mvc/MessageController.java | 69 -- .../web/ui/InMemoryMessageRespository.java | 52 ++ .../zero/sample/web/ui/Message.java | 66 ++ .../zero/sample/web/ui/MessageRepository.java | 27 + .../sample/web/ui/SampleWebUiApplication.java | 50 ++ .../sample/web/ui/mvc/MessageController.java | 69 ++ .../ui/UiBootstrapApplicationTests.java | 98 --- .../web/ui/SampleWebUiApplicationTests.java | 97 +++ .../src/test/resources/logging.properties | 2 +- .../sample/xml/XmlBootstrapApplication.java | 38 -- .../sample/xml/service/HelloWorldService.java | 32 - .../xml/SampleSpringXmlApplication.java | 38 ++ .../sample/xml/service/HelloWorldService.java | 32 + .../META-INF/application-context.xml | 4 +- .../xml/XmlBootstrapApplicationTests.java | 40 -- .../xml/SampleSpringXmlApplicationTests.java | 41 ++ 842 files changed, 36769 insertions(+), 37182 deletions(-) delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java delete mode 100644 spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEvent.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEventRepository.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/InMemoryAuditEventRepository.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/listener/AuditApplicationEvent.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/listener/AuditListener.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/AuditAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ErrorMvcAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/AbstractEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ActionEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/BeansEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/DumpEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/Endpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/EnvironmentEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/HealthEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/InfoEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/MetricsEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/PublicMetrics.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ShutdownEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/TraceEndpoint.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/VanillaPublicMetrics.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapter.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerMapping.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/fixme/ManagementServerConfiguration.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/health/HealthIndicator.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/health/VanillaHealthIndicator.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/CounterService.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultCounterService.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultGaugeService.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/GaugeService.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepository.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/Measurement.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/Metric.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/MetricRepository.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/properties/ManagementServerProperties.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/properties/SecurityProperties.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthenticationAuditListener.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthorizationAuditListener.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/InMemoryTraceRepository.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/Trace.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/TraceRepository.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/WebRequestTraceFilter.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/BasicErrorController.java create mode 100644 spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/ErrorController.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java delete mode 100644 spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/TestUtils.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/AuditEventTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/InMemoryAuditEventRepositoryTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/listener/AuditListenerTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/AuditAutoConfigurationTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointAutoConfigurationTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfigurationTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/AbstractEndpointTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/BeansEndpointTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/DumpEndpointTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/EnvironmentEndpointTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/HealthEndpointTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/InfoEndpointTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/MetricsEndpointTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/ShutdownEndpointTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/TraceEndpointTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/VanillaPublicMetricsTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerMappingTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/fixme/ErrorConfigurationTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/health/VanillaHealthIndicatorTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/DefaultCounterServiceTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/DefaultGaugeServiceTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepositoryTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/properties/SecurityPropertiesTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/security/AuthenticationAuditListenerTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/security/AuthorizationAuditListenerTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/trace/InMemoryTraceRepositoryTests.java create mode 100644 spring-zero-actuator/src/test/java/org/springframework/zero/actuate/trace/WebRequestTraceFilterTests.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java delete mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/main/Spring.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/AutoConfigurationUtils.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/MessageSourceAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/PropertyPlaceholderAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/BatchAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/BatchDatabaseInitializer.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobExecutionEvent.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobExecutionExitCodeGenerator.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobLauncherCommandLineRunner.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/AbstractDataSourceConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/DataSourceAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/TomcatDataSourceConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/JpaAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/MultipartAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/ServerPropertiesAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigurationSorter.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigureAfter.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/ComponentScanDetector.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfiguration.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfigurationImportSelector.java create mode 100644 spring-zero-autoconfigure/src/main/java/org/springframework/zero/main/Spring.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/AdhocTestSuite.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/SpringJUnitTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java delete mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/AdhocTestSuite.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/MessageSourceAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/SpringJUnitTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/batch/BatchAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/JpaWebAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/test/City.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/test/CityRepository.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/orm/jpa/test/City.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/MultipartAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/ServerPropertiesConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfigurationTests.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/context/annotation/AutoConfigurationSorterTest.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/context/annotation/ComponentScanDetectorConfiguration.java create mode 100644 spring-zero-autoconfigure/src/test/java/org/springframework/zero/main/SimpleMainTests.java delete mode 100644 spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/annotation/testProperties.xml delete mode 100644 spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml delete mode 100644 spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/sample-beans.xml delete mode 100644 spring-zero-autoconfigure/src/test/resources/fixme/static/css/style.css delete mode 100644 spring-zero-autoconfigure/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql rename spring-zero-autoconfigure/src/test/resources/{fixme/org/springframework/bootstrap => org/springframework/zero}/autoconfigure/jdbc/schema.sql (100%) delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/Command.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/CommandFactory.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/NoSuchCommandException.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/AbstractCommand.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/CleanCommand.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/CreateCommand.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/DefaultCommandFactory.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionHandler.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/OptionParsingCommand.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/RunCommand.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCommand.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/ScriptCompilationCustomizer.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/command/VersionCommand.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/AstUtils.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/CompilerAutoConfiguration.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/DependencyCustomizer.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/ExtendedGroovyClassLoader.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompiler.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompilerConfiguration.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunner.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunnerConfiguration.java delete mode 100644 spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/template/GroovyTemplate.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/Command.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/CommandFactory.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/NoSuchCommandException.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/SpringZeroCli.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/SpringZeroCliException.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/AbstractCommand.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/CleanCommand.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/CreateCommand.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/DefaultCommandFactory.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/OptionHandler.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/OptionParsingCommand.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/RunCommand.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/ScriptCommand.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/ScriptCompilationCustomizer.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/command/VersionCommand.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/AstUtils.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/CompilerAutoConfiguration.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/DependencyCustomizer.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/ExtendedGroovyClassLoader.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/GroovyCompiler.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/GroovyCompilerConfiguration.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/autoconfigure/SpringZeroCompilerAutoConfiguration.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/runner/SpringZeroRunner.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/runner/SpringZeroRunnerConfiguration.java create mode 100644 spring-zero-cli/src/main/java/org/springframework/zero/cli/template/GroovyTemplate.java delete mode 100644 spring-zero-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.CommandFactory delete mode 100644 spring-zero-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration create mode 100644 spring-zero-cli/src/main/resources/META-INF/services/org.springframework.zero.cli.CommandFactory create mode 100644 spring-zero-cli/src/main/resources/META-INF/services/org.springframework.zero.cli.compiler.CompilerAutoConfiguration delete mode 100644 spring-zero-cli/src/test/java/org/springframework/bootstrap/cli/SampleIntegrationTests.java delete mode 100644 spring-zero-cli/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java delete mode 100644 spring-zero-cli/src/test/java/org/springframework/bootstrap/cli/command/ScriptCommandTests.java create mode 100644 spring-zero-cli/src/test/java/org/springframework/zero/cli/SampleIntegrationTests.java create mode 100644 spring-zero-cli/src/test/java/org/springframework/zero/cli/SpringZeroCliTests.java create mode 100644 spring-zero-cli/src/test/java/org/springframework/zero/cli/command/ScriptCommandTests.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/Banner.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/CommandLineRunner.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/ExitCodeGenerator.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/SpringApplication.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/config/JsonParser.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBean.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/AbstractOnBeanCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBean.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBeanCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionLogUtils.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnBean.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnClass.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnExpression.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingBean.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingClass.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnNotWebApplication.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnResource.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnWebApplication.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationProperties.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationPropertiesBindingConfiguration.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationProperties.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesImportSelector.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnBeanCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnClassCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnExpressionCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingBeanCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingClassCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnNotWebApplicationCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnResourceCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/OnWebApplicationCondition.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/annotation/PropertySourcesBindingPostProcessor.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ConfigurableEmbeddedServletContainerFactory.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerException.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerFactory.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ErrorPage.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/RegistrationBean.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ServletContextInitializer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/WebApplicationContextServletContextAwareProcessor.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/ServletContextInitializerConfiguration.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/jetty/package-info.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/package-info.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/package-info.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java delete mode 100644 spring-zero-core/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/Banner.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/BeanDefinitionLoader.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/CommandLineRunner.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/ExitCodeGenerator.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/SpringApplication.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/bind/CustomPropertyConstructor.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/bind/InetAddressEditor.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/bind/PropertiesConfigurationFactory.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/bind/PropertySourcesPropertyValues.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/bind/RelaxedDataBinder.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/bind/YamlConfigurationFactory.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/config/JacksonJsonParser.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/config/JsonParser.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/config/JsonParserFactory.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/config/SimpleJsonParser.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/config/YamlJsonParser.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/config/YamlMapFactoryBean.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/config/YamlProcessor.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/config/YamlPropertiesFactoryBean.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/AbstractOnBeanCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/AssertMissingBean.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/AssertMissingBeanCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConditionLogUtils.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConditionalOnBean.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConditionalOnClass.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConditionalOnExpression.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConditionalOnMissingBean.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConditionalOnMissingClass.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConditionalOnNotWebApplication.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConditionalOnResource.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConditionalOnWebApplication.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConfigurationProperties.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConfigurationPropertiesBindingConfiguration.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/EnableConfigurationProperties.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/EnableConfigurationPropertiesImportSelector.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/OnBeanCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/OnClassCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/OnExpressionCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/OnMissingBeanCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/OnMissingClassCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/OnNotWebApplicationCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/OnResourceCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/OnWebApplicationCondition.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/annotation/PropertySourcesBindingPostProcessor.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/AbstractEmbeddedServletContainerFactory.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/ConfigurableEmbeddedServletContainerFactory.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/EmbeddedServletContainer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/EmbeddedServletContainerCustomizer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/EmbeddedServletContainerException.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/EmbeddedServletContainerFactory.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/EmbeddedWebApplicationContext.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/ErrorPage.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/FilterRegistrationBean.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/RegistrationBean.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/ServletContextInitializer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/ServletRegistrationBean.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/WebApplicationContextServletContextAwareProcessor.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/XmlEmbeddedWebApplicationContext.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/jetty/JettyEmbeddedServletContainer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/jetty/ServletContextInitializerConfiguration.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/jetty/package-info.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/package-info.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/TomcatEmbeddedServletContainer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/package-info.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/initializer/ConfigFileApplicationContextInitializer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/initializer/ContextIdApplicationContextInitializer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/initializer/EnvironmentDelegateApplicationContextInitializer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/initializer/LoggingApplicationContextInitializer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/context/initializer/VcapApplicationContextInitializer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/logging/JavaLoggerConfigurer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/logging/LogbackConfigurer.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/properties/ServerProperties.java create mode 100644 spring-zero-core/src/main/java/org/springframework/zero/web/SpringServletInitializer.java rename spring-zero-core/src/main/resources/org/springframework/{bootstrap => zero}/logging/log4j.properties (100%) rename spring-zero-core/src/main/resources/org/springframework/{bootstrap => zero}/logging/logback.xml (100%) rename spring-zero-core/src/main/resources/org/springframework/{bootstrap => zero}/logging/logging.properties (100%) delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/BeanDefinitionLoaderTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/SpringApplicationTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/TestUtils.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/config/YamlParserTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/NotWebApplicationConditionTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnBeanConditionTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnClassConditionTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnExpressionConditionTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingBeanConditionTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingClassConditionTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/OnResourceConditionTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/annotation/WebApplicationConditionTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/ExampleFilter.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/ExampleServlet.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBeanTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/MockFilter.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/MockServlet.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContextTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/config/ExampleEmbeddedWebApplicationConfiguration.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializerTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java delete mode 100644 spring-zero-core/src/test/java/org/springframework/bootstrap/sampleconfig/MyComponent.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/BeanDefinitionLoaderTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/SpringApplicationTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/TestUtils.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/bind/PropertiesConfigurationFactoryTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/bind/PropertySourcesPropertyValuesTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/bind/RelaxedDataBinderTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/bind/YamlConfigurationFactoryTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/config/JacksonParserTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/config/SimpleJsonParserTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/config/YamlMapFactoryBeanTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/config/YamlParserTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/config/YamlPropertiesFactoryBeanTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/annotation/EnableConfigurationPropertiesTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/annotation/NotWebApplicationConditionTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/annotation/OnBeanConditionTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/annotation/OnClassConditionTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/annotation/OnExpressionConditionTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/annotation/OnMissingBeanConditionTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/annotation/OnMissingClassConditionTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/annotation/OnResourceConditionTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/annotation/WebApplicationConditionTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/EmbeddedWebApplicationContextTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/ExampleFilter.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/ExampleServlet.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/FilterRegistrationBeanTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/MockEmbeddedServletContainerFactory.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/MockFilter.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/MockServlet.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/ServletRegistrationBeanTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/XmlEmbeddedWebApplicationContextTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/config/ExampleEmbeddedWebApplicationConfiguration.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/initializer/ConfigFileApplicationContextInitializerTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/initializer/ContextIdApplicationContextInitializerTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/initializer/VcapApplicationContextInitializerTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/context/test/EnableConfigurationPropertiesTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/logging/JavaLoggerConfigurerTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/logging/LogbackConfigurerTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/logging/LoggingInitializerTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/logging/TestFormatter.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/properties/ServerPropertiesTests.java create mode 100644 spring-zero-core/src/test/java/org/springframework/zero/sampleconfig/MyComponent.java delete mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/foo.xml delete mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml delete mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/conf.properties delete mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml delete mode 100644 spring-zero-core/src/test/resources/org/springframework/bootstrap/sample-beans.xml rename {spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap => spring-zero-core/src/test/resources/org/springframework/zero}/context/annotation/foo.xml (100%) create mode 100644 spring-zero-core/src/test/resources/org/springframework/zero/context/annotation/testProperties.xml rename {spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap => spring-zero-core/src/test/resources/org/springframework/zero}/context/embedded/conf.properties (100%) create mode 100644 spring-zero-core/src/test/resources/org/springframework/zero/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml create mode 100644 spring-zero-core/src/test/resources/org/springframework/zero/sample-beans.xml delete mode 100644 spring-zero-intergration-tests/build.log delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/JarLauncher.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/Launcher.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/MainMethodRunner.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/WarLauncher.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessData.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFile.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/data/package-info.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/JarEntryFilter.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipEntry.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStream.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFile.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/package-info.java delete mode 100644 spring-zero-launcher/src/main/java/org/springframework/bootstrap/launcher/package-info.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/JarLauncher.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/Launcher.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/MainMethodRunner.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/WarLauncher.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/data/RandomAccessData.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/data/RandomAccessDataFile.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/data/package-info.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/jar/JarEntryFilter.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/jar/RandomAccessDataZipEntry.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/jar/RandomAccessDataZipInputStream.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/jar/RandomAccessJarFile.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/jar/package-info.java create mode 100644 spring-zero-launcher/src/main/java/org/springframework/zero/launcher/package-info.java delete mode 100644 spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/ByteArrayStartsWith.java delete mode 100644 spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFileTest.java delete mode 100644 spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStreamTest.java delete mode 100644 spring-zero-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java create mode 100644 spring-zero-launcher/src/test/java/org/springframework/zero/launcher/ByteArrayStartsWith.java create mode 100644 spring-zero-launcher/src/test/java/org/springframework/zero/launcher/data/RandomAccessDataFileTest.java create mode 100644 spring-zero-launcher/src/test/java/org/springframework/zero/launcher/jar/RandomAccessDataZipInputStreamTest.java create mode 100644 spring-zero-launcher/src/test/java/org/springframework/zero/launcher/jar/RandomAccessJarFileTest.java delete mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java delete mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableJarMojo.java delete mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableWarMojo.java delete mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/MainClassFinder.java delete mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformer.java create mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/zero/maven/AbstractExecutableArchiveMojo.java create mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/zero/maven/ExecutableJarMojo.java create mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/zero/maven/ExecutableWarMojo.java create mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/zero/maven/MainClassFinder.java create mode 100644 spring-zero-maven-plugin/src/main/java/org/springframework/zero/maven/PropertiesMergingResourceTransformer.java delete mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/MainClassFinderTests.java delete mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java delete mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/Verify.java delete mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithMainMethod.java delete mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithoutMainMethod.java create mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/zero/maven/MainClassFinderTests.java create mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/zero/maven/PropertiesMergingResourceTransformerTests.java create mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/zero/maven/Verify.java create mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/zero/maven/sample/ClassWithMainMethod.java create mode 100644 spring-zero-maven-plugin/src/test/java/org/springframework/zero/maven/sample/ClassWithoutMainMethod.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator-ui/src/main/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator-ui/src/main/java/org/springframework/zero/sample/actuator/ui/SampleActuatorUiApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator-ui/src/test/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator-ui/src/test/java/org/springframework/bootstrap/sample/ui/ManagementServiceBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator-ui/src/test/java/org/springframework/zero/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator-ui/src/test/java/org/springframework/zero/sample/actuator/ui/SampleActuatorUiApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/HelloWorldService.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/SampleController.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/ServiceBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/bootstrap/sample/service/ServiceProperties.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/zero/sample/actuator/HelloWorldService.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/zero/sample/actuator/SampleActuatorApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/zero/sample/actuator/SampleController.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/main/java/org/springframework/zero/sample/actuator/ServiceProperties.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/EndpointsPropertiesServiceBootstrapApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ManagementAddressServiceBootstrapApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ManagementServiceBootstrapApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/NoManagementServiceBootstrapApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ServiceBootstrapApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/ShutdownServiceBootstrapApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/bootstrap/sample/test/UnsecureServiceBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/zero/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/zero/sample/actuator/ManagementAddressSampleActuatorApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/zero/sample/actuator/ManagementSampleActuatorApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/zero/sample/actuator/NoManagementSampleActuatorApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/zero/sample/actuator/SampleActuatorApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/zero/sample/actuator/ShutdownSampleActuatorApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-actuator/src/test/java/org/springframework/zero/sample/actuator/UnsecureSampleActuatorApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-batch/src/main/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-batch/src/main/java/org/springframework/zero/sample/batch/SampleBatchApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-batch/src/test/java/org/springframework/bootstrap/sample/batch/BatchBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-batch/src/test/java/org/springframework/zero/sample/batch/SampleBatchApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/DataBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/City.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/Hotel.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/HotelSummary.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/Rating.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/RatingCount.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/Review.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/ReviewDetails.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/TripType.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/CityRepository.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelRepository.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/HotelSummaryRepository.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/domain/repository/ReviewRepository.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/CitySearchCriteria.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/CityService.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/HotelService.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/ReviewsSummary.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/impl/CityServiceImpl.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/service/impl/HotelServiceImpl.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/bootstrap/sample/data/web/SampleController.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/SampleDataJpaApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/City.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/Hotel.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/HotelSummary.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/Rating.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/RatingCount.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/Review.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/ReviewDetails.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/TripType.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/repository/CityRepository.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/repository/HotelRepository.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/repository/HotelSummaryRepository.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/repository/ReviewRepository.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/service/CitySearchCriteria.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/service/CityService.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/service/HotelService.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/service/ReviewsSummary.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/service/impl/CityServiceImpl.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/service/impl/HotelServiceImpl.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/web/SampleController.java delete mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/test/java/org/springframework/bootstrap/sample/data/DataBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-data-jpa/src/test/java/org/springframework/zero/sample/data/jpa/SampleDataJpaApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/HelloWorldService.java delete mode 100644 spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/SampleEndpoint.java delete mode 100644 spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/bootstrap/sample/consumer/ServiceProperties.java create mode 100644 spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/zero/sample/integration/HelloWorldService.java create mode 100644 spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/zero/sample/integration/SampleEndpoint.java create mode 100644 spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/zero/sample/integration/SampleIntegrationApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-integration/src/main/java/org/springframework/zero/sample/integration/ServiceProperties.java delete mode 100644 spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/consumer/IntegrationBootstrapApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/zero/sample/integration/consumer/SampleIntegrationApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/zero/sample/integration/producer/ProducerApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/bootstrap/sample/jetty/service/HelloWorldService.java delete mode 100644 spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/bootstrap/sample/jetty/web/SampleController.java create mode 100644 spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/zero/sample/jetty/SampleJettyApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/zero/sample/jetty/service/HelloWorldService.java create mode 100644 spring-zero-samples/spring-zero-sample-jetty/src/main/java/org/springframework/zero/sample/jetty/web/SampleController.java delete mode 100644 spring-zero-samples/spring-zero-sample-jetty/src/test/java/org/springframework/bootstrap/sample/jetty/JettyBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-jetty/src/test/java/org/springframework/zero/sample/jetty/SampleJettyApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/service/GoodbyeWorldService.java delete mode 100644 spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java delete mode 100644 spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/bootstrap/sample/simple/service/MessageService.java create mode 100644 spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/zero/sample/profile/SampleProfileApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/zero/sample/profile/service/GoodbyeWorldService.java create mode 100644 spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/zero/sample/profile/service/HelloWorldService.java create mode 100644 spring-zero-samples/spring-zero-sample-profile/src/main/java/org/springframework/zero/sample/profile/service/MessageService.java delete mode 100644 spring-zero-samples/spring-zero-sample-profile/src/test/java/org/springframework/bootstrap/sample/simple/ProfileBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-profile/src/test/java/org/springframework/zero/sample/profile/SampleProfileApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-simple/src/main/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-simple/src/main/java/org/springframework/bootstrap/sample/simple/service/HelloWorldService.java create mode 100644 spring-zero-samples/spring-zero-sample-simple/src/main/java/org/springframework/zero/sample/simple/SampleSimpleApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-simple/src/main/java/org/springframework/zero/sample/simple/service/HelloWorldService.java delete mode 100644 spring-zero-samples/spring-zero-sample-simple/src/test/java/org/springframework/bootstrap/sample/simple/SimpleBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-simple/src/test/java/org/springframework/zero/sample/simple/SampleSimpleApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/bootstrap/sample/tomcat/service/HelloWorldService.java delete mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/bootstrap/sample/tomcat/web/SampleController.java create mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/zero/sample/tomcat/SampleTomcatApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/zero/sample/tomcat/service/HelloWorldService.java create mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/main/java/org/springframework/zero/sample/tomcat/web/SampleController.java delete mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/NonAutoConfigurationBootstrapApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/bootstrap/sample/tomcat/TomcatBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/zero/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-tomcat/src/test/java/org/springframework/zero/sample/tomcat/SampleTomcatApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-traditional/src/main/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-traditional/src/main/java/org/springframework/bootstrap/sample/trad/config/WebConfig.java create mode 100644 spring-zero-samples/spring-zero-sample-traditional/src/main/java/org/springframework/zero/sample/traditional/SampleTraditionalApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-traditional/src/main/java/org/springframework/zero/sample/traditional/config/WebConfig.java delete mode 100644 spring-zero-samples/spring-zero-sample-traditional/src/test/java/org/springframework/bootstrap/sample/trad/TradBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-traditional/src/test/java/org/springframework/zero/sample/traditional/SampleTraditionalApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/InMemoryMessageRespository.java delete mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/Message.java delete mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/MessageRepository.java delete mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/bootstrap/sample/ui/mvc/MessageController.java create mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/zero/sample/web/ui/InMemoryMessageRespository.java create mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/zero/sample/web/ui/Message.java create mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/zero/sample/web/ui/MessageRepository.java create mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/zero/sample/web/ui/SampleWebUiApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/main/java/org/springframework/zero/sample/web/ui/mvc/MessageController.java delete mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/test/java/org/springframework/bootstrap/sample/ui/UiBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-web-ui/src/test/java/org/springframework/zero/sample/web/ui/SampleWebUiApplicationTests.java delete mode 100644 spring-zero-samples/spring-zero-sample-xml/src/main/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplication.java delete mode 100644 spring-zero-samples/spring-zero-sample-xml/src/main/java/org/springframework/bootstrap/sample/xml/service/HelloWorldService.java create mode 100644 spring-zero-samples/spring-zero-sample-xml/src/main/java/org/springframework/zero/sample/xml/SampleSpringXmlApplication.java create mode 100644 spring-zero-samples/spring-zero-sample-xml/src/main/java/org/springframework/zero/sample/xml/service/HelloWorldService.java delete mode 100644 spring-zero-samples/spring-zero-sample-xml/src/test/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplicationTests.java create mode 100644 spring-zero-samples/spring-zero-sample-xml/src/test/java/org/springframework/zero/sample/xml/SampleSpringXmlApplicationTests.java diff --git a/eclipse/eclipse-code-formatter.xml b/eclipse/eclipse-code-formatter.xml index 8f4b3eb5f3f..b390beb53b8 100644 --- a/eclipse/eclipse-code-formatter.xml +++ b/eclipse/eclipse-code-formatter.xml @@ -1,6 +1,6 @@ - + diff --git a/spring-zero-actuator/README.md b/spring-zero-actuator/README.md index 109a8ae69b6..aac0cb5bc61 100644 --- a/spring-zero-actuator/README.md +++ b/spring-zero-actuator/README.md @@ -1,4 +1,4 @@ -# Spring Bootstrap Actuator +# Spring Zero Actuator Minimum fuss for getting applications up and running in production, and in other environments. There is a strong emphasis on implementing @@ -23,8 +23,8 @@ RESTful web services but many features are more generic than that. For a quick introduction and to get started quickly with a new project, carry on reading. For more in depth coverage of the features -of Spring Bootstrap Actuator, go to the -[Feature Guide](https://github.com/SpringSource/spring-bootstrap/tree/master/spring-bootstrap-actuator/docs/Features.md). +of Spring Zero Actuator, go to the +[Feature Guide](https://github.com/SpringSource/spring-bootstrap/tree/master/spring-zero-actuator/docs/Features.md). # Getting Started @@ -47,18 +47,18 @@ If you are using Maven create a really simple `pom.xml` with 2 dependencies: 1.0.0-SNAPSHOT jar - org.springframework.bootstrap - spring-bootstrap-applications + org.springframework.zero + spring-zero-starter 0.0.1-SNAPSHOT - org.springframework.bootstrap - spring-bootstrap-web-application + org.springframework.zero + spring-zero-web-starter - org.springframework.bootstrap - spring-bootstrap-service + org.springframework.zero + spring-zero-service @@ -72,7 +72,7 @@ If you are using Maven create a really simple `pom.xml` with 2 dependencies: If you like Gradle, that's fine, and you will know what to do with -those dependencies. The first dependency adds Spring Bootstrap auto +those dependencies. The first dependency adds Spring Zero auto configuration and the Jetty container to your application, and the second one adds some more opinionated stuff like the default management endpoints. If you prefer Tomcat you can just add the @@ -89,7 +89,7 @@ Then in another terminal ok $ curl localhost:8080/metrics {"counter.status.200.health":1.0,"gauge.response.health":10.0,"mem":120768.0,"mem.free":105012.0,"processors":4.0} - + `/health` is the default location for the health endpoint - it tells you if the application is running and healthy. `/metrics` is the default location for the metrics endpoint - it gives you basic counts and @@ -121,14 +121,14 @@ endpoint. An endpoint can be implemented as a Spring MVC public Map helloWorld() { return Collections.singletonMap("message", "Hello World"); } - + public static void main(String[] args) throws Exception { SpringApplication.run(SampleController.class, args); } } -You can launch that straight away using the Spring Bootstrap CLI +You can launch that straight away using the Spring Zero CLI (without the `@EnableAutoConfiguration` and even without the import statements that your IDE will add if you are using one), or you can use the main method to launch it from your project jar. Just add a @@ -155,7 +155,7 @@ which are more convenient at development time. Here are a few: 1. Use the Maven exec plugin, e.g. $ mvn exec:java - + 2. Run directly in your IDE, e.g. Eclipse or IDEA let you right click on a class and run it. @@ -167,7 +167,7 @@ on a class and run it. ## Externalizing configuration -Spring Bootstrap likes you to externalize your configuration so you +Spring Zero likes you to externalize your configuration so you can work with the same application code in different environments. To get started with this you create a file in the root of your classpath (`src/main/resources` if using Maven) - if you like YAML you can call @@ -187,7 +187,7 @@ or if you like Java `Properties` files, you can call it management.port: 9001 logging.file: target/log.out -Those examples are properties that Spring Bootstrap itself binds to +Those examples are properties that Spring Zero itself binds to out of the box, so if you make that change and run the app again, you will find the home page on port 9000 instead of 8080: @@ -217,7 +217,7 @@ that is to simply refer to it in an `@Value` annotation, e.g. @Controller @EnableAutoConfiguration public class SampleController { - + @Value("${service.message:Hello World}") private String value = "Goodbye Everypone" @@ -226,7 +226,7 @@ that is to simply refer to it in an `@Value` annotation, e.g. public Map helloWorld() { return Collections.singletonMap("message", message); } - + ... } @@ -251,13 +251,13 @@ automatically in a separate value object. For instance: private int value = 0; ... getters and setters } - + // SampleController.java @Controller @EnableAutoConfiguration @EnableConfigurationProperties(ServiceProperties.class) public class SampleController { - + @Autowired private ServiceProperties properties; @@ -266,10 +266,10 @@ automatically in a separate value object. For instance: public Map helloWorld() { return Collections.singletonMap("message", properties.getMessage()); } - + ... } - + When you ask to `@EnableConfigurationProperties(ServiceProperties.class)` you are saying you want a bean of type `ServiceProperties` and that you want @@ -341,9 +341,9 @@ Then you will be able to inject a `DataSource` into your controller: @EnableAutoConfiguration @EnableConfigurationProperties(ServiceProperties.class) public class SampleController { - + private JdbcTemplate jdbcTemplate; - + @Autowired public SampleController(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); @@ -354,19 +354,19 @@ Then you will be able to inject a `DataSource` into your controller: public Map helloWorld() { return jdbcTemplate.queryForMap("SELECT * FROM MESSAGES WHERE ID=?", 0); } - + ... } - + The app will run (going back to the default security configuration): - + $ curl user:password@localhost:8080/ {"error":"Internal Server Error", "status":500, "exception":...} - + but there's no data in the database yet and the `MESSAGES` table doesn't even exist, so there's an error. One easy way to fix it is to provide a `schema.sql` script in the root of the classpath, e.g. - + create table MESSAGES ( ID BIGINT NOT NULL PRIMARY KEY, MESSAGE VARCHAR(255) @@ -377,6 +377,6 @@ Now when you run the app you get a sensible response: $ curl user:password@localhost:8080/ {"ID":0, "MESSAGE":"Hello Phil"} - + Obviously, this is only the start, but hopefully you have a good grasp of the basics and are ready to try it out yourself. diff --git a/spring-zero-actuator/docs/Features.md b/spring-zero-actuator/docs/Features.md index 29528d63092..f889d0253c5 100644 --- a/spring-zero-actuator/docs/Features.md +++ b/spring-zero-actuator/docs/Features.md @@ -1,12 +1,12 @@ -# Spring Bootstrap Actuator Feature Guide +# Spring Zero Actuator Feature Guide -Here are some (most, hopefully all) the features of Spring Bootstrap +Here are some (most, hopefully all) the features of Spring Zero Actuator with some commentary to help you start using them. We recommend you first build a project with the Actuator (e.g. the getting started project from the main README), and then try each feature in turn there. -TODO: some of these are features of Spring Bootstrap (or +TODO: some of these are features of Spring Zero (or `SpringApplication`) not the Actuator. TODO: group things together and break them out into separate files. @@ -33,7 +33,7 @@ The default value comes after the first colon (":"). ## Externalized Configuration -In addition to command line option arguments, Spring Bootstrap will +In addition to command line option arguments, Spring Zero will pick up a file called `application.properties` in the root of your classpath (if there is one) and add those properties to the Spring `Environment`. The search path for `application.properties` is @@ -49,7 +49,7 @@ previously defined values (e.g. from System properties), e.g. app.name: MyApp app.description: ${app.name} is a Cool New App -Spring Bootstrap also binds the properties to any bean in your +Spring Zero also binds the properties to any bean in your application context whose type is `@ConfigurationProperties`. The Actuator provides some of those beans out of the box, so you can easily customize server and management properties (ports etc.), @@ -63,7 +63,7 @@ configuration and make it only available in certain environments. Any `@Component` that is marked with `@Profile` will only be loaded in the profile specified by the latter annotation. -Spring Bootstrap takes it a stage further. If you include in your +Spring Zero takes it a stage further. If you include in your `application.properties` a value for a property named `spring.active.profiles` then those profiles will be active by default. E.g. @@ -72,7 +72,7 @@ default. E.g. ## Profile-dependent configuration -Spring Bootstrap loads additional properties files if there are active +Spring Zero loads additional properties files if there are active profiles using a naming convention `application-{profile}.properties`. Property values from those files override trhe default ones. @@ -98,7 +98,7 @@ to one of your `@Configuration` (or `@Component`) classes. Then you can in any of your component classes to grab that configuration and use it. -Spring Bootstrap uses some relaxed rules for binding `Environment` +Spring Zero uses some relaxed rules for binding `Environment` properties to `@ConfigurationProperties` beans, so there doesn't need to be an exact match between the `Environment` property name and the bean property name. Common examples where this is useful include @@ -137,7 +137,7 @@ compiler or IDE. YAML is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data, such as that supported -by Spring Bootstrap Actuator. If you prefer to use +by Spring Zero Actuator. If you prefer to use [YAML](http://yaml.org) instead of Properties files you just need to include a file called `application.yml` in the root of your classpath @@ -217,7 +217,7 @@ properties in the application properties (see * To enable the Tomcat access log valve (very common in production environments) More fine-grained control of the Tomcat container is available if you -need it. Instead of letting Spring Bootstrap create the container for +need it. Instead of letting Spring Zero create the container for you, just create a bean of type `TomcatEmbeddedServletContainerFactory` and override one of its methods, or inject some customizations, e.g. @@ -261,7 +261,7 @@ this. ## Customizing Logging -Spring Bootstrap uses SLF4J for logging, but leaves the implementation +Spring Zero uses SLF4J for logging, but leaves the implementation open. The Starter projects and the Actuator use JDK native logging by default, purely because it is always available. A default configuration file is provided for JDK logging, and also for log4j and @@ -290,12 +290,12 @@ from the Spring `Environment` to System properties: |PID |PID | The current process ID is discovered if possible and not already provided | All the logging systems supported can consult System properties when -parsing their configuration files. See the defailt configurations in -`spring-bootstrap.jar` for examples. +parsing their configuration files. See the default configurations in +`spring-zero-core.jar` for examples. ## Application Context Initializers -To add additional application context initializers to the Bootstrap +To add additional application context initializers to the Zero startup process, add a comma-delimited list of class names to the `Environment` property `context.initializer.classes` (can be specified via `application.properties`). diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java deleted file mode 100644 index 0d6cec47242..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.audit; - -import java.io.Serializable; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.security.authentication.AuthenticationEventPublisher; -import org.springframework.util.Assert; - -/** - * A value object representing an audit event: at a particular time, a particular user or - * agent carried out an action of a particular type. This object records the details of - * such an event. - * - *

- * Users can inject a {@link AuditEventRepository} to publish their own events or - * alternatively use Springs {@link AuthenticationEventPublisher} (usually obtained by - * implementing {@link ApplicationEventPublisherAware}). - * - * @author Dave Syer - * @see AuditEventRepository - */ -public class AuditEvent implements Serializable { - - private final Date timestamp; - - private final String principal; - - private final String type; - - private final Map data; - - /** - * Create a new audit event for the current time. - * @param principal The user principal responsible - * @param type the event type - * @param data The event data - */ - public AuditEvent(String principal, String type, Map data) { - this(new Date(), principal, type, data); - } - - /** - * Create a new audit event for the current time from data provided as name-value - * pairs - * @param principal The user principal responsible - * @param type the event type - * @param data The event data in the form 'key=value' or simply 'key' - */ - public AuditEvent(String principal, String type, String... data) { - this(new Date(), principal, type, convert(data)); - } - - /** - * Create a new audit event. - * @param timestamp The date/time of the event - * @param principal The user principal responsible - * @param type the event type - * @param data The event data - */ - public AuditEvent(Date timestamp, String principal, String type, - Map data) { - Assert.notNull(timestamp, "Timestamp must not be null"); - Assert.notNull(type, "Type must not be null"); - this.timestamp = timestamp; - this.principal = principal; - this.type = type; - this.data = Collections.unmodifiableMap(data); - } - - private static Map convert(String[] data) { - Map result = new HashMap(); - for (String entry : data) { - if (entry.contains("=")) { - int index = entry.indexOf("="); - result.put(entry.substring(0, index), entry.substring(index + 1)); - } else { - result.put(entry, null); - } - } - return result; - } - - /** - * Returns the date/time that the even was logged. - */ - public Date getTimestamp() { - return this.timestamp; - } - - /** - * Returns the user principal responsible for the event or {@code null}. - */ - public String getPrincipal() { - return this.principal; - } - - /** - * Returns the type of event. - */ - public String getType() { - return this.type; - } - - /** - * Returns the event data. - */ - public Map getData() { - return this.data; - } - - @Override - public String toString() { - return "AuditEvent [timestamp=" + this.timestamp + ", principal=" - + this.principal + ", type=" + this.type + ", data=" + this.data + "]"; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java deleted file mode 100644 index 839f03494d4..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.audit; - -import java.util.Date; -import java.util.List; - -/** - * Repository for {@link AuditEvent}s. - * - * @author Dave Syer - */ -public interface AuditEventRepository { - - /** - * Find audit events relating to the specified principal since the time provided. - * - * @param principal the principal name to search for - * @param after timestamp of earliest result required - * @return audit events relating to the principal - */ - List find(String principal, Date after); - - /** - * Log an event. - * - * @param event the audit event to log - */ - void add(AuditEvent event); - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java deleted file mode 100644 index f7d8ff97b6d..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.audit; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * In-memory {@link AuditEventRepository} implementation. - * - * @author Dave Syer - */ -public class InMemoryAuditEventRepository implements AuditEventRepository { - - private int capacity = 100; - - private Map> events = new HashMap>(); - - /** - * @param capacity the capacity to set - */ - public void setCapacity(int capacity) { - this.capacity = capacity; - } - - @Override - public List find(String principal, Date after) { - synchronized (this.events) { - return Collections.unmodifiableList(getEvents(principal)); - } - } - - private List getEvents(String principal) { - if (!this.events.containsKey(principal)) { - this.events.put(principal, new ArrayList()); - } - return this.events.get(principal); - } - - @Override - public void add(AuditEvent event) { - synchronized (this.events) { - List list = getEvents(event.getPrincipal()); - while (list.size() >= this.capacity) { - list.remove(0); - } - list.add(event); - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java deleted file mode 100644 index 08141f95b8d..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.audit.listener; - -import java.util.Date; -import java.util.Map; - -import org.springframework.bootstrap.actuate.audit.AuditEvent; -import org.springframework.context.ApplicationEvent; -import org.springframework.util.Assert; - -/** - * Spring {@link ApplicationEvent} to encapsulate {@link AuditEvent}s. - * - * @author Dave Syer - */ -public class AuditApplicationEvent extends ApplicationEvent { - - private AuditEvent auditEvent; - - /** - * Create a new {@link AuditApplicationEvent} that wraps a newly created - * {@link AuditEvent}. - * @see AuditEvent#AuditEvent(String, String, Map) - */ - public AuditApplicationEvent(String principal, String type, Map data) { - this(new AuditEvent(principal, type, data)); - } - - /** - * Create a new {@link AuditApplicationEvent} that wraps a newly created - * {@link AuditEvent}. - * @see AuditEvent#AuditEvent(String, String, String...) - */ - public AuditApplicationEvent(String principal, String type, String... data) { - this(new AuditEvent(principal, type, data)); - } - - /** - * Create a new {@link AuditApplicationEvent} that wraps a newly created - * {@link AuditEvent}. - * @see AuditEvent#AuditEvent(Date, String, String, Map) - */ - public AuditApplicationEvent(Date timestamp, String principal, String type, - Map data) { - this(new AuditEvent(timestamp, principal, type, data)); - } - - /** - * Create a new {@link AuditApplicationEvent} that wraps the specified - * {@link AuditEvent}. - * @param auditEvent the source of this event - */ - public AuditApplicationEvent(AuditEvent auditEvent) { - super(auditEvent); - Assert.notNull(auditEvent, "AuditEvent must not be null"); - this.auditEvent = auditEvent; - } - - /** - * @return the audit event - */ - public AuditEvent getAuditEvent() { - return this.auditEvent; - } -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java deleted file mode 100644 index 169eccf3819..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.audit.listener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.bootstrap.actuate.audit.AuditEvent; -import org.springframework.bootstrap.actuate.audit.AuditEventRepository; -import org.springframework.context.ApplicationListener; - -/** - * {@link ApplicationListener} that listens for {@link AuditEvent}s and stores them in a - * {@link AuditEventRepository}. - * - * @author Dave Syer - */ -public class AuditListener implements ApplicationListener { - - private static Log logger = LogFactory.getLog(AuditListener.class); - - private final AuditEventRepository auditEventRepository; - - public AuditListener(AuditEventRepository auditEventRepository) { - this.auditEventRepository = auditEventRepository; - } - - @Override - public void onApplicationEvent(AuditApplicationEvent event) { - logger.info(event.getAuditEvent()); - this.auditEventRepository.add(event.getAuditEvent()); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java deleted file mode 100644 index 1775234d2a4..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.actuate.audit.AuditEvent; -import org.springframework.bootstrap.actuate.audit.AuditEventRepository; -import org.springframework.bootstrap.actuate.audit.InMemoryAuditEventRepository; -import org.springframework.bootstrap.actuate.audit.listener.AuditListener; -import org.springframework.bootstrap.actuate.security.AuthenticationAuditListener; -import org.springframework.bootstrap.actuate.security.AuthorizationAuditListener; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for {@link AuditEvent}s. - * - * @author Dave Syer - */ -@Configuration -public class AuditAutoConfiguration { - - @Autowired(required = false) - private AuditEventRepository auditEventRepository = new InMemoryAuditEventRepository(); - - @Bean - public AuditListener auditListener() throws Exception { - return new AuditListener(this.auditEventRepository); - } - - @Bean - @ConditionalOnClass(name = "org.springframework.security.authentication.event.AbstractAuthenticationEvent") - public AuthenticationAuditListener authenticationAuditListener() throws Exception { - return new AuthenticationAuditListener(); - } - - @Bean - @ConditionalOnClass(name = "org.springframework.security.access.event.AbstractAuthorizationEvent") - public AuthorizationAuditListener authorizationAuditListener() throws Exception { - return new AuthorizationAuditListener(); - } - - @ConditionalOnMissingBean(AuditEventRepository.class) - protected static class AuditEventRepositoryConfiguration { - @Bean - public AuditEventRepository auditEventRepository() throws Exception { - return new InMemoryAuditEventRepository(); - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java deleted file mode 100644 index f4f00830bdc..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.autoconfigure; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Properties; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.actuate.endpoint.BeansEndpoint; -import org.springframework.bootstrap.actuate.endpoint.DumpEndpoint; -import org.springframework.bootstrap.actuate.endpoint.Endpoint; -import org.springframework.bootstrap.actuate.endpoint.EnvironmentEndpoint; -import org.springframework.bootstrap.actuate.endpoint.HealthEndpoint; -import org.springframework.bootstrap.actuate.endpoint.InfoEndpoint; -import org.springframework.bootstrap.actuate.endpoint.MetricsEndpoint; -import org.springframework.bootstrap.actuate.endpoint.PublicMetrics; -import org.springframework.bootstrap.actuate.endpoint.ShutdownEndpoint; -import org.springframework.bootstrap.actuate.endpoint.TraceEndpoint; -import org.springframework.bootstrap.actuate.endpoint.VanillaPublicMetrics; -import org.springframework.bootstrap.actuate.health.HealthIndicator; -import org.springframework.bootstrap.actuate.health.VanillaHealthIndicator; -import org.springframework.bootstrap.actuate.metrics.InMemoryMetricRepository; -import org.springframework.bootstrap.actuate.metrics.MetricRepository; -import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository; -import org.springframework.bootstrap.actuate.trace.TraceRepository; -import org.springframework.bootstrap.bind.PropertiesConfigurationFactory; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.StandardEnvironment; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PropertiesLoaderUtils; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for common management - * {@link Endpoint}s. - * - * @author Dave Syer - * @author Phillip Webb - */ -@Configuration -public class EndpointAutoConfiguration { - - @Autowired(required = false) - private HealthIndicator healthIndicator = new VanillaHealthIndicator(); - - @Autowired - private InfoPropertiesConfiguration properties; - - @Autowired(required = false) - private MetricRepository metricRepository = new InMemoryMetricRepository(); - - @Autowired(required = false) - private PublicMetrics metrics; - - @Autowired(required = false) - private TraceRepository traceRepository = new InMemoryTraceRepository(); - - @Bean - @ConditionalOnMissingBean - public EnvironmentEndpoint environmentEndpoint() { - return new EnvironmentEndpoint(); - } - - @Bean - @ConditionalOnMissingBean - public HealthEndpoint healthEndpoint() { - return new HealthEndpoint(this.healthIndicator); - } - - @Bean - @ConditionalOnMissingBean - public BeansEndpoint beansEndpoint() { - return new BeansEndpoint(); - } - - @Bean - @ConditionalOnMissingBean - public InfoEndpoint infoEndpoint() throws Exception { - LinkedHashMap info = new LinkedHashMap(); - info.putAll(this.properties.infoMap()); - GitInfo gitInfo = this.properties.gitInfo(); - if (gitInfo.getBranch() != null) { - info.put("git", gitInfo); - } - return new InfoEndpoint(info); - } - - @Bean - @ConditionalOnMissingBean - public MetricsEndpoint metricsEndpoint() { - if (this.metrics == null) { - this.metrics = new VanillaPublicMetrics(this.metricRepository); - } - return new MetricsEndpoint(this.metrics); - } - - @Bean - @ConditionalOnMissingBean - public TraceEndpoint traceEndpoint() { - return new TraceEndpoint(this.traceRepository); - } - - @Bean - @ConditionalOnMissingBean - public DumpEndpoint dumpEndpoint() { - return new DumpEndpoint(); - } - - @Bean - @ConditionalOnMissingBean - public ShutdownEndpoint shutdownEndpoint() { - return new ShutdownEndpoint(); - } - - @Configuration - protected static class InfoPropertiesConfiguration { - - @Autowired - private ConfigurableEnvironment environment = new StandardEnvironment(); - - @Value("${spring.git.properties:classpath:git.properties}") - private Resource gitProperties; - - public GitInfo gitInfo() throws Exception { - PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory( - new GitInfo()); - factory.setTargetName("git"); - Properties properties = new Properties(); - if (this.gitProperties.exists()) { - properties = PropertiesLoaderUtils.loadProperties(this.gitProperties); - } - factory.setProperties(properties); - return factory.getObject(); - } - - public Map infoMap() throws Exception { - PropertiesConfigurationFactory> factory = new PropertiesConfigurationFactory>( - new LinkedHashMap()); - factory.setTargetName("info"); - factory.setPropertySources(this.environment.getPropertySources()); - return factory.getObject(); - } - - } - - public static class GitInfo { - private String branch; - private Commit commit = new Commit(); - - public String getBranch() { - return this.branch; - } - - public void setBranch(String branch) { - this.branch = branch; - } - - public Commit getCommit() { - return this.commit; - } - - public static class Commit { - private String id; - private String time; - - public String getId() { - return this.id == null ? "" : (this.id.length() > 7 ? this.id.substring( - 0, 7) : this.id); - } - - public void setId(String id) { - this.id = id; - } - - public String getTime() { - return this.time; - } - - public void setTime(String time) { - this.time = time; - } - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java deleted file mode 100644 index aa3731398b8..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import javax.servlet.Servlet; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.actuate.endpoint.Endpoint; -import org.springframework.bootstrap.actuate.endpoint.mvc.EndpointHandlerAdapter; -import org.springframework.bootstrap.actuate.endpoint.mvc.EndpointHandlerMapping; -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.web.WebMvcAutoConfiguration; -import org.springframework.bootstrap.context.annotation.AutoConfigureAfter; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; -import org.springframework.bootstrap.properties.ServerProperties; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.ApplicationListener; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.event.ContextClosedEvent; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.web.servlet.DispatcherServlet; - -/** - * {@link EnableAutoConfiguration Auto-configuration} to enable Spring MVC to handle - * {@link Endpoint} requests. If the {@link ManagementServerProperties} specifies a - * different port to {@link ServerProperties} a new child context is created, otherwise it - * is assumed that endpoint requests will be mapped and handled via an already registered - * {@link DispatcherServlet}. - * - * @author Dave Syer - * @author Phillip Webb - */ -@Configuration -@ConditionalOnClass({ Servlet.class, DispatcherServlet.class }) -@AutoConfigureAfter({ PropertyPlaceholderAutoConfiguration.class, - EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class, - ManagementServerPropertiesAutoConfiguration.class }) -public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, - ApplicationListener { - - private static final Integer DISABLED_PORT = Integer.valueOf(0); - - private ApplicationContext applicationContext; - - @Autowired(required = false) - private ServerProperties serverProperties = new ServerProperties(); - - @Autowired(required = false) - private ManagementServerProperties managementServerProperties = new ManagementServerProperties(); - - @Bean - @ConditionalOnMissingBean - public EndpointHandlerMapping endpointHandlerMapping() { - EndpointHandlerMapping mapping = new EndpointHandlerMapping(); - mapping.setDisabled(ManagementServerPort.get(this.applicationContext) != ManagementServerPort.SAME); - mapping.setPrefix(this.managementServerProperties.getContextPath()); - return mapping; - } - - @Bean - @ConditionalOnMissingBean - public EndpointHandlerAdapter endpointHandlerAdapter() { - return new EndpointHandlerAdapter(); - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) - throws BeansException { - this.applicationContext = applicationContext; - } - - @Override - public void onApplicationEvent(ContextRefreshedEvent event) { - if (event.getApplicationContext() == this.applicationContext) { - if (ManagementServerPort.get(this.applicationContext) == ManagementServerPort.DIFFERENT) { - createChildManagementContext(); - } - } - } - - private void createChildManagementContext() { - - final AnnotationConfigEmbeddedWebApplicationContext childContext = new AnnotationConfigEmbeddedWebApplicationContext(); - childContext.setParent(this.applicationContext); - childContext.setId(this.applicationContext.getId() + ":management"); - - // Register the ManagementServerChildContextConfiguration first followed - // by various specific AutoConfiguration classes. NOTE: The child context - // is intentionally not completely auto-configured. - childContext.register(EndpointWebMvcChildContextConfiguration.class, - PropertyPlaceholderAutoConfiguration.class, - EmbeddedServletContainerAutoConfiguration.class); - - // 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(); - } - } - }); - } - childContext.refresh(); - } - - private enum ManagementServerPort { - - DISABLE, SAME, DIFFERENT; - - public static ManagementServerPort get(BeanFactory beanFactory) { - - ServerProperties serverProperties; - try { - serverProperties = beanFactory.getBean(ServerProperties.class); - } catch (NoSuchBeanDefinitionException ex) { - serverProperties = new ServerProperties(); - } - - ManagementServerProperties managementServerProperties; - try { - managementServerProperties = beanFactory - .getBean(ManagementServerProperties.class); - } catch (NoSuchBeanDefinitionException ex) { - managementServerProperties = new ManagementServerProperties(); - } - - if (DISABLED_PORT.equals(managementServerProperties.getPort())) { - return DISABLE; - } - return managementServerProperties.getPort() == null - || serverProperties.getPort() == managementServerProperties.getPort() ? SAME - : DIFFERENT; - } - }; -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java deleted file mode 100644 index f7100904299..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.autoconfigure; - -import javax.servlet.Filter; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.HierarchicalBeanFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.actuate.endpoint.mvc.EndpointHandlerAdapter; -import org.springframework.bootstrap.actuate.endpoint.mvc.EndpointHandlerMapping; -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; -import org.springframework.bootstrap.context.annotation.ConditionalOnBean; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainer; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.web.servlet.DispatcherServlet; -import org.springframework.web.servlet.HandlerAdapter; -import org.springframework.web.servlet.HandlerMapping; - -/** - * Configuration for triggered from {@link EndpointWebMvcAutoConfiguration} when a new - * {@link EmbeddedServletContainer} running on a different port is required. - * - * @see EndpointWebMvcAutoConfiguration - */ -@Configuration -public class EndpointWebMvcChildContextConfiguration implements - EmbeddedServletContainerCustomizer { - - @Autowired - private ManagementServerProperties managementServerProperties; - - @Override - public void customize(ConfigurableEmbeddedServletContainerFactory factory) { - factory.setPort(this.managementServerProperties.getPort()); - factory.setAddress(this.managementServerProperties.getAddress()); - factory.setContextPath(this.managementServerProperties.getContextPath()); - } - - @Bean - public DispatcherServlet dispatcherServlet() { - DispatcherServlet dispatcherServlet = new DispatcherServlet(); - - // Ensure the parent configuration does not leak down to us - dispatcherServlet.setDetectAllHandlerAdapters(false); - dispatcherServlet.setDetectAllHandlerExceptionResolvers(false); - dispatcherServlet.setDetectAllHandlerMappings(false); - dispatcherServlet.setDetectAllViewResolvers(false); - - return dispatcherServlet; - } - - @Bean - public HandlerMapping handlerMapping() { - return new EndpointHandlerMapping(); - } - - @Bean - public HandlerAdapter handlerAdapter() { - return new EndpointHandlerAdapter(); - } - - @Configuration - @ConditionalOnClass({ EnableWebSecurity.class, Filter.class }) - public static class EndpointWebMvcChildContextSecurityConfiguration { - - // FIXME reuse of security filter here is not good. What if totally different - // security config is required. Perhaps we can just drop it on the management - // port? - - @Bean - @ConditionalOnBean(name = "springSecurityFilterChain") - public Filter springSecurityFilterChain(HierarchicalBeanFactory beanFactory) { - BeanFactory parent = beanFactory.getParentBeanFactory(); - return parent.getBean("springSecurityFilterChain", Filter.class); - } - - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java deleted file mode 100644 index b95a8f0730b..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import javax.servlet.Servlet; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.actuate.web.BasicErrorController; -import org.springframework.bootstrap.actuate.web.ErrorController; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; -import org.springframework.bootstrap.context.embedded.ErrorPage; -import org.springframework.context.annotation.Bean; -import org.springframework.web.servlet.DispatcherServlet; - -/** - * {@link EnableAutoConfiguration Auto-configuration} to render errors via a MVC error - * controller. - * - * @author Dave Syer - */ -@ConditionalOnClass({ Servlet.class, DispatcherServlet.class }) -public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustomizer { - - @Value("${error.path:/error}") - private String errorPath = "/error"; - - @Bean - @ConditionalOnMissingBean(ErrorController.class) - public BasicErrorController basicErrorController() { - return new BasicErrorController(); - } - - @Override - public void customize(ConfigurableEmbeddedServletContainerFactory factory) { - factory.addErrorPages(new ErrorPage(this.errorPath)); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java deleted file mode 100644 index b0eb62af8c4..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; -import org.springframework.bootstrap.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.bootstrap.context.annotation.AutoConfigureAfter; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for the - * {@link ManagementServerPropertiesAutoConfiguration} bean. - * - * @author Dave Syer - */ -@Configuration -@AutoConfigureAfter(ServerPropertiesAutoConfiguration.class) -@EnableConfigurationProperties -public class ManagementServerPropertiesAutoConfiguration { - - @Bean(name = "org.springframework.bootstrap.actuate.properties.ManagementServerProperties") - @ConditionalOnMissingBean - public ManagementServerProperties serverProperties() { - return new ManagementServerProperties(); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java deleted file mode 100644 index a7d6ef87151..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.actuate.metrics.CounterService; -import org.springframework.bootstrap.actuate.metrics.GaugeService; -import org.springframework.bootstrap.context.annotation.AutoConfigureAfter; -import org.springframework.bootstrap.context.annotation.ConditionalOnBean; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.util.StopWatch; -import org.springframework.web.filter.GenericFilterBean; -import org.springframework.web.util.UrlPathHelper; - -/** - * {@link EnableAutoConfiguration Auto-configuration} that records Servlet interactions - * with a {@link CounterService} and {@link GaugeService}. - * - * @author Dave Syer - * @author Phillip Webb - */ -@Configuration -@ConditionalOnBean({ CounterService.class, GaugeService.class }) -@ConditionalOnClass({ Servlet.class }) -@AutoConfigureAfter(MetricRepositoryAutoConfiguration.class) -public class MetricFilterAutoConfiguration { - - private static final int UNDEFINED_HTTP_STATUS = 999; - - @Autowired - private CounterService counterService; - - @Autowired - private GaugeService gaugeService; - - @Bean - public Filter metricFilter() { - return new MetricsFilter(); - } - - /** - * Filter that counts requests and measures processing times. - */ - @Order(Ordered.HIGHEST_PRECEDENCE) - private final class MetricsFilter extends GenericFilterBean { - - // FIXME parameterize the order (ideally it runs before any other filter) - - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - if ((request instanceof HttpServletRequest) - && (response instanceof HttpServletResponse)) { - doFilter((HttpServletRequest) request, (HttpServletResponse) response, - chain); - } else { - chain.doFilter(request, response); - } - } - - public void doFilter(HttpServletRequest request, HttpServletResponse response, - FilterChain chain) throws IOException, ServletException { - UrlPathHelper helper = new UrlPathHelper(); - String suffix = helper.getPathWithinApplication(request); - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); - try { - chain.doFilter(request, response); - } finally { - stopWatch.stop(); - String gaugeKey = getKey("response" + suffix); - MetricFilterAutoConfiguration.this.gaugeService.set(gaugeKey, - stopWatch.getTotalTimeMillis()); - String counterKey = getKey("status." + getStatus(response) + suffix); - MetricFilterAutoConfiguration.this.counterService.increment(counterKey); - } - } - - private int getStatus(HttpServletResponse response) { - try { - return response.getStatus(); - } catch (Exception e) { - return UNDEFINED_HTTP_STATUS; - } - } - - private String getKey(String string) { - // graphite compatible metric names - String value = string.replace("/", "."); - value = value.replace("..", "."); - if (value.endsWith(".")) { - value = value + "root"; - } - if (value.startsWith("_")) { - value = value.substring(1); - } - return value; - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java deleted file mode 100644 index 5a369b10634..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.springframework.bootstrap.actuate.metrics.CounterService; -import org.springframework.bootstrap.actuate.metrics.DefaultCounterService; -import org.springframework.bootstrap.actuate.metrics.DefaultGaugeService; -import org.springframework.bootstrap.actuate.metrics.GaugeService; -import org.springframework.bootstrap.actuate.metrics.InMemoryMetricRepository; -import org.springframework.bootstrap.actuate.metrics.MetricRepository; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for metrics services. - * - * @author Dave Syer - */ -@Configuration -public class MetricRepositoryAutoConfiguration { - - @Bean - @ConditionalOnMissingBean - public CounterService counterService() { - return new DefaultCounterService(metricRepository()); - } - - @Bean - @ConditionalOnMissingBean - public GaugeService gaugeService() { - return new DefaultGaugeService(metricRepository()); - } - - @Bean - @ConditionalOnMissingBean - protected MetricRepository metricRepository() { - return new InMemoryMetricRepository(); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java deleted file mode 100644 index e232eccc3ed..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.actuate.endpoint.Endpoint; -import org.springframework.bootstrap.actuate.endpoint.mvc.EndpointHandlerMapping; -import org.springframework.bootstrap.actuate.properties.SecurityProperties; -import org.springframework.bootstrap.actuate.web.ErrorController; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.security.authentication.AuthenticationEventPublisher; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication.DefaultAuthenticationEventPublisher; -import org.springframework.security.authentication.ProviderManager; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.builders.WebSecurity; -import org.springframework.security.config.annotation.web.builders.WebSecurity.IgnoredRequestConfigurer; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.web.AuthenticationEntryPoint; -import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for security of a web application or - * service. By default everything is secured with HTTP Basic authentication except the - * {@link SecurityProperties#getIgnored() explicitly ignored} paths (defaults to - * /css/**, /js/**, /images/**, /**/favicon.ico - * ). Many aspects of the behavior can be controller with {@link SecurityProperties} via - * externalized application properties (or via an bean definition of that type to set the - * defaults). The user details for authentication are just placeholders - * (username=user, - * password=password) but can easily be customized by providing a bean definition - * of type {@link AuthenticationManager}. Also provides audit logging of authentication - * events. - * - *

- * The framework {@link Endpoint}s (used to expose application information to operations) - * include a {@link Endpoint#isSensitive() sensitive} configuration option which will be - * used as a security hint by the filter created here. - * - *

- * Some common simple customizations: - *

    - *
  • Switch off security completely and permanently: remove Spring Security from the - * classpath or {@link EnableAutoConfiguration#exclude() exclude} this configuration.
  • - *
  • Switch off security temporarily (e.g. for a dev environment): set - * security.basic.enabled: false
  • - *
  • Customize the user details: add an AuthenticationManager bean
  • - *
  • Add form login for user facing resources: add a - * {@link WebSecurityConfigurerAdapter} and use {@link HttpSecurity#formLogin()}
  • - *
- * - * @author Dave Syer - */ -@Configuration -@ConditionalOnClass({ EnableWebSecurity.class }) -@EnableWebSecurity -@EnableConfigurationProperties -public class SecurityAutoConfiguration { - - @Bean(name = "org.springframework.bootstrap.actuate.properties.SecurityProperties") - @ConditionalOnMissingBean - public SecurityProperties securityProperties() { - return new SecurityProperties(); - } - - @Bean - @ConditionalOnMissingBean - public AuthenticationEventPublisher authenticationEventPublisher() { - return new DefaultAuthenticationEventPublisher(); - } - - @Bean - @ConditionalOnMissingBean({ BoostrapWebSecurityConfigurerAdapter.class }) - public WebSecurityConfigurerAdapter webSecurityConfigurerAdapter() { - return new BoostrapWebSecurityConfigurerAdapter(); - } - - // Give user-supplied filters a chance to be last in line - @Order(Ordered.LOWEST_PRECEDENCE - 10) - private static class BoostrapWebSecurityConfigurerAdapter extends - WebSecurityConfigurerAdapter { - - private static final String[] NO_PATHS = new String[0]; - - @Autowired - private SecurityProperties security; - - @Autowired(required = false) - private EndpointHandlerMapping endpointHandlerMapping; - - @Autowired - private AuthenticationEventPublisher authenticationEventPublisher; - - @Autowired(required = false) - private ErrorController errorController; - - @Override - protected void configure(HttpSecurity http) throws Exception { - - if (this.security.isRequireSsl()) { - http.requiresChannel().anyRequest().requiresSecure(); - } - - if (this.security.getBasic().isEnabled()) { - String[] paths = getSecurePaths(); - http.exceptionHandling().authenticationEntryPoint(entryPoint()).and() - .requestMatchers().antMatchers(paths); - http.httpBasic().and().anonymous().disable(); - http.authorizeUrls().anyRequest() - .hasRole(this.security.getBasic().getRole()); - } - - // No cookies for service endpoints by default - http.sessionManagement().sessionCreationPolicy(this.security.getSessions()); - } - - private String[] getSecurePaths() { - List list = new ArrayList(); - for (String path : this.security.getBasic().getPath()) { - path = (path == null ? "" : path.trim()); - if (path.equals("/**")) { - return new String[] { path }; - } - if (!path.equals("")) { - list.add(path); - } - } - // FIXME makes more sense to secure endpoints with a different role - list.addAll(Arrays.asList(getEndpointPaths(true))); - return list.toArray(new String[list.size()]); - } - - private AuthenticationEntryPoint entryPoint() { - BasicAuthenticationEntryPoint entryPoint = new BasicAuthenticationEntryPoint(); - entryPoint.setRealmName(this.security.getBasic().getRealm()); - return entryPoint; - } - - @Override - public void configure(WebSecurity builder) throws Exception { - IgnoredRequestConfigurer ignoring = builder.ignoring(); - ignoring.antMatchers(this.security.getIgnored()); - ignoring.antMatchers(getEndpointPaths(false)); - if (this.errorController != null) { - ignoring.antMatchers(this.errorController.getErrorPath()); - } - } - - private String[] getEndpointPaths(boolean secure) { - if (this.endpointHandlerMapping == null) { - return NO_PATHS; - } - - // FIXME this will still open up paths on the server when a management port is - // being used. - - List> endpoints = this.endpointHandlerMapping.getEndpoints(); - List paths = new ArrayList(endpoints.size()); - for (Endpoint endpoint : endpoints) { - if (endpoint.isSensitive() == secure) { - paths.add(endpoint.getPath()); - } - } - return paths.toArray(new String[paths.size()]); - } - - @Override - protected AuthenticationManager authenticationManager() throws Exception { - AuthenticationManager manager = super.authenticationManager(); - if (manager instanceof ProviderManager) { - ((ProviderManager) manager) - .setAuthenticationEventPublisher(this.authenticationEventPublisher); - } - return manager; - } - - } - - @ConditionalOnMissingBean(AuthenticationManager.class) - @Configuration - public static class AuthenticationManagerConfiguration { - - @Bean - public AuthenticationManager authenticationManager() throws Exception { - return new AuthenticationManagerBuilder().inMemoryAuthentication() - .withUser("user").password("password").roles("USER").and().and() - .build(); - } - - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java deleted file mode 100644 index 7375df5792f..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository; -import org.springframework.bootstrap.actuate.trace.TraceRepository; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for {@link TraceRepository tracing}. - * - * @author Dave Syer - */ -@Configuration -public class TraceRepositoryAutoConfiguration { - - @ConditionalOnMissingBean - @Bean - public TraceRepository traceRepository() { - return new InMemoryTraceRepository(); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java deleted file mode 100644 index 1c79e2b234c..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.autoconfigure; - -import javax.servlet.Servlet; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.actuate.trace.TraceRepository; -import org.springframework.bootstrap.actuate.trace.WebRequestTraceFilter; -import org.springframework.bootstrap.context.annotation.AutoConfigureAfter; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.web.servlet.DispatcherServlet; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for {@link WebRequestTraceFilter - * tracing}. - * - * @author Dave Syer - */ -@ConditionalOnClass({ Servlet.class, DispatcherServlet.class }) -@AutoConfigureAfter(TraceRepositoryAutoConfiguration.class) -public class TraceWebFilterAutoConfiguration { - - @Autowired - private TraceRepository traceRepository; - - @Value("${management.dump_requests:false}") - private boolean dumpRequests; - - @Bean - public WebRequestTraceFilter webRequestLoggingFilter(BeanFactory beanFactory) { - WebRequestTraceFilter filter = new WebRequestTraceFilter(this.traceRepository); - filter.setDumpRequests(this.dumpRequests); - return filter; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java deleted file mode 100644 index 4d4030d12e5..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -import org.springframework.http.MediaType; - -/** - * Abstract base for {@link Endpoint} implementations. - * - * @author Phillip Webb - */ -public abstract class AbstractEndpoint implements Endpoint { - - private static final MediaType[] NO_MEDIA_TYPES = new MediaType[0]; - - @NotNull - @Pattern(regexp = "/[^/]*", message = "Path must start with /") - private String path; - - private boolean sensitive; - - public AbstractEndpoint(String path) { - this(path, true); - } - - public AbstractEndpoint(String path, boolean sensitive) { - this.path = path; - this.sensitive = sensitive; - } - - @Override - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - @Override - public boolean isSensitive() { - return this.sensitive; - } - - public void setSensitive(boolean sensitive) { - this.sensitive = sensitive; - } - - @Override - public MediaType[] getProduces() { - return NO_MEDIA_TYPES; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java deleted file mode 100644 index f82aa338ec9..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -/** - * Tagging interface used to indicate that {@link Endpoint} that performs some action. - * Allows mappings to refine the types of request supported. - * - * @author Phillip Webb - */ -public interface ActionEndpoint extends Endpoint { - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java deleted file mode 100644 index 922c7a0ce30..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import org.springframework.beans.BeansException; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.support.LiveBeansView; -import org.springframework.core.env.Environment; -import org.springframework.http.MediaType; - -/** - * Exposes JSON view of Spring beans. If the {@link Environment} contains a key setting - * the {@link LiveBeansView#MBEAN_DOMAIN_PROPERTY_NAME} then all application contexts in - * the JVM will be shown (and the corresponding MBeans will be registered per the standard - * behavior of LiveBeansView). Otherwise only the current application context. - * - * @author Dave Syer - */ -@ConfigurationProperties(name = "endpoints.beans", ignoreUnknownFields = false) -public class BeansEndpoint extends AbstractEndpoint implements - ApplicationContextAware { - - private LiveBeansView liveBeansView = new LiveBeansView(); - - public BeansEndpoint() { - super("/beans"); - } - - @Override - public void setApplicationContext(ApplicationContext context) throws BeansException { - if (context.getEnvironment() - .getProperty(LiveBeansView.MBEAN_DOMAIN_PROPERTY_NAME) == null) { - this.liveBeansView.setApplicationContext(context); - } - } - - @Override - public MediaType[] getProduces() { - return new MediaType[] { MediaType.APPLICATION_JSON }; - } - - @Override - public String invoke() { - return this.liveBeansView.getSnapshotAsJson(); - } -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java deleted file mode 100644 index 887bc10fbc3..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.lang.management.ManagementFactory; -import java.lang.management.ThreadInfo; -import java.util.Arrays; -import java.util.List; - -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; - -/** - * {@link Endpoint} to expose thread info. - * - * @author Dave Syer - */ -@ConfigurationProperties(name = "endpoints.dump", ignoreUnknownFields = false) -public class DumpEndpoint extends AbstractEndpoint> { - - /** - * Create a new {@link DumpEndpoint} instance. - */ - public DumpEndpoint() { - super("/dump"); - } - - @Override - public List invoke() { - return Arrays.asList(ManagementFactory.getThreadMXBean().dumpAllThreads(true, - true)); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java deleted file mode 100644 index ada04a4f66e..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import org.springframework.http.MediaType; - -/** - * An endpoint that can be used to expose useful information to operations. Usually - * exposed via Spring MVC but could also be exposed using some other technique. - * - * @author Phillip Webb - * @author Dave Syer - */ -public interface Endpoint { - - /** - * Returns the path of the endpoint. Must start with '/' and should not include - * wildcards. - */ - String getPath(); - - /** - * Returns if the endpoint is sensitive, i.e. may return data that the average user - * should not see. Mappings can use this as a security hint. - */ - boolean isSensitive(); - - /** - * Returns the {@link MediaType}s that this endpoint produces or {@code null}. - */ - MediaType[] getProduces(); - - /** - * Called to invoke the endpoint. - * @return the results of the invocation - */ - T invoke(); - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java deleted file mode 100644 index ab948c7caf6..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.context.EnvironmentAware; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.EnumerablePropertySource; -import org.springframework.core.env.Environment; -import org.springframework.core.env.PropertySource; -import org.springframework.core.env.StandardEnvironment; - -/** - * {@link Endpoint} to expose {@link ConfigurableEnvironment environment} information. - * - * @author Dave Syer - * @author Phillip Webb - */ -@ConfigurationProperties(name = "endpoints.env", ignoreUnknownFields = false) -public class EnvironmentEndpoint extends AbstractEndpoint> implements - EnvironmentAware { - - private Environment environment; - - /** - * Create a new {@link EnvironmentEndpoint} instance. - */ - public EnvironmentEndpoint() { - super("/env"); - } - - @Override - public Map invoke() { - Map result = new LinkedHashMap(); - for (PropertySource source : getPropertySources()) { - if (source instanceof EnumerablePropertySource) { - EnumerablePropertySource enumerable = (EnumerablePropertySource) source; - Map map = new LinkedHashMap(); - for (String name : enumerable.getPropertyNames()) { - map.put(name, sanitize(name, enumerable.getProperty(name))); - } - result.put(source.getName(), map); - } - } - return result; - } - - private Iterable> getPropertySources() { - if (this.environment != null - && this.environment instanceof ConfigurableEnvironment) { - return ((ConfigurableEnvironment) this.environment).getPropertySources(); - } - return new StandardEnvironment().getPropertySources(); - } - - private Object sanitize(String name, Object object) { - if (name.toLowerCase().endsWith("password") - || name.toLowerCase().endsWith("secret")) { - return object == null ? null : "******"; - } - return object; - } - - @Override - public void setEnvironment(Environment environment) { - this.environment = environment; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java deleted file mode 100644 index 122cc9f6589..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import org.springframework.bootstrap.actuate.health.HealthIndicator; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.util.Assert; - -/** - * {@link Endpoint} to expose application health. - * - * @author Dave Syer - */ -@ConfigurationProperties(name = "endpoints.health", ignoreUnknownFields = false) -public class HealthEndpoint extends AbstractEndpoint { - - private HealthIndicator indicator; - - /** - * Create a new {@link HealthIndicator} instance. - * - * @param indicator the health indicator - */ - public HealthEndpoint(HealthIndicator indicator) { - super("/health", false); - Assert.notNull(indicator, "Indicator must not be null"); - this.indicator = indicator; - } - - @Override - public T invoke() { - return this.indicator.health(); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java deleted file mode 100644 index c2a3e81f355..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.util.Assert; - -/** - * {@link Endpoint} to expose arbitrary application information. - * - * @author Dave Syer - */ -@ConfigurationProperties(name = "endpoints.info", ignoreUnknownFields = false) -public class InfoEndpoint extends AbstractEndpoint> { - - private Map info; - - /** - * Create a new {@link InfoEndpoint} instance. - * - * @param info the info to expose - */ - public InfoEndpoint(Map info) { - super("/info", true); - Assert.notNull(info, "Info must not be null"); - this.info = info; - } - - @Override - public Map invoke() { - Map info = new LinkedHashMap(this.info); - info.putAll(getAdditionalInfo()); - return info; - } - - protected Map getAdditionalInfo() { - return Collections.emptyMap(); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java deleted file mode 100644 index 3af5cfa7965..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.springframework.bootstrap.actuate.metrics.Metric; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.util.Assert; - -/** - * {@link Endpoint} to expose {@link PublicMetrics}. - * - * @author Dave Syer - */ -@ConfigurationProperties(name = "endpoints.metrics", ignoreUnknownFields = false) -public class MetricsEndpoint extends AbstractEndpoint> { - - private PublicMetrics metrics; - - /** - * Create a new {@link MetricsEndpoint} instance. - * - * @param metrics the metrics to expose - */ - public MetricsEndpoint(PublicMetrics metrics) { - super("/metrics"); - Assert.notNull(metrics, "Metrics must not be null"); - this.metrics = metrics; - } - - @Override - public Map invoke() { - Map result = new LinkedHashMap(); - for (Metric metric : this.metrics.metrics()) { - result.put(metric.getName(), metric.getValue()); - } - return result; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java deleted file mode 100644 index c99b624ee2f..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.Collection; - -import org.springframework.bootstrap.actuate.metrics.Metric; - -/** - * Interface to expose specific {@link Metric}s via a {@link MetricsEndpoint}. - * - * @author Dave Syer - * @see VanillaPublicMetrics - */ -public interface PublicMetrics { - - /** - * @return an indication of current state through metrics - */ - Collection metrics(); - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java deleted file mode 100644 index e57f4208c3b..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.Collections; -import java.util.Map; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.ConfigurableApplicationContext; - -/** - * {@link ActionEndpoint} to shutdown the {@link ApplicationContext}. - * - * @author Dave Syer - */ -@ConfigurationProperties(name = "endpoints.shutdown", ignoreUnknownFields = false) -public class ShutdownEndpoint extends AbstractEndpoint> implements - ApplicationContextAware, ActionEndpoint> { - - private ConfigurableApplicationContext context; - - @Autowired(required = false) - private ManagementServerProperties configuration = new ManagementServerProperties(); - - /** - * Create a new {@link ShutdownEndpoint} instance. - */ - public ShutdownEndpoint() { - super("/shutdown"); - } - - @Override - public Map invoke() { - if (this.configuration == null || !this.configuration.isAllowShutdown() - || this.context == null) { - return Collections. singletonMap("message", - "Shutdown not enabled, sorry."); - } - - new Thread(new Runnable() { - @Override - public void run() { - try { - Thread.sleep(500L); - } catch (InterruptedException e) { - } - ShutdownEndpoint.this.context.close(); - } - }).start(); - - return Collections. singletonMap("message", - "Shutting down, bye..."); - } - - @Override - public void setApplicationContext(ApplicationContext context) throws BeansException { - if (context instanceof ConfigurableApplicationContext) { - this.context = (ConfigurableApplicationContext) context; - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java deleted file mode 100644 index 632cd6e3b73..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.List; - -import org.springframework.bootstrap.actuate.trace.Trace; -import org.springframework.bootstrap.actuate.trace.TraceRepository; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.util.Assert; - -/** - * {@link Endpoint} to expose {@link Trace} information. - * - * @author Dave Syer - */ -@ConfigurationProperties(name = "endpoints.trace", ignoreUnknownFields = false) -public class TraceEndpoint extends AbstractEndpoint> { - - private TraceRepository repository; - - /** - * Create a new {@link TraceEndpoint} instance. - * - * @param repository the trace repository - */ - public TraceEndpoint(TraceRepository repository) { - super("/trace"); - Assert.notNull(repository, "Repository must not be null"); - this.repository = repository; - } - - @Override - public List invoke() { - return this.repository.findAll(); - } -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java deleted file mode 100644 index a7c81471507..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.Collection; -import java.util.LinkedHashSet; - -import org.springframework.bootstrap.actuate.metrics.Metric; -import org.springframework.bootstrap.actuate.metrics.MetricRepository; -import org.springframework.util.Assert; - -/** - * Default implementation of {@link PublicMetrics} that exposes all metrics from the - * {@link MetricRepository} along with memory information. - * - * @author Dave Syer - */ -public class VanillaPublicMetrics implements PublicMetrics { - - private MetricRepository metricRepository; - - public VanillaPublicMetrics(MetricRepository metricRepository) { - Assert.notNull(metricRepository, "MetricRepository must not be null"); - this.metricRepository = metricRepository; - } - - @Override - public Collection metrics() { - Collection result = new LinkedHashSet( - this.metricRepository.findAll()); - result.add(new Metric("mem", new Long(Runtime.getRuntime().totalMemory()) / 1024)); - result.add(new Metric("mem.free", - new Long(Runtime.getRuntime().freeMemory()) / 1024)); - result.add(new Metric("processors", Runtime.getRuntime().availableProcessors())); - return result; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java deleted file mode 100644 index e75e16e3de1..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint.mvc; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.bootstrap.actuate.endpoint.Endpoint; -import org.springframework.http.MediaType; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.http.server.ServletServerHttpResponse; -import org.springframework.web.HttpMediaTypeNotAcceptableException; -import org.springframework.web.accept.ContentNegotiationManager; -import org.springframework.web.context.request.ServletWebRequest; -import org.springframework.web.servlet.HandlerAdapter; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -import org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor; - -import com.fasterxml.jackson.databind.SerializationFeature; - -/** - * MVC {@link HandlerAdapter} for {@link Endpoint}s. Similar in may respects to - * {@link AbstractMessageConverterMethodProcessor} but not tied to annotated methods. - * - * @author Phillip Webb - * @see EndpointHandlerMapping - */ -public class EndpointHandlerAdapter implements HandlerAdapter { - - private static final Log logger = LogFactory.getLog(EndpointHandlerAdapter.class); - - private static final MediaType MEDIA_TYPE_APPLICATION = new MediaType("application"); - - private ContentNegotiationManager contentNegotiationManager = new ContentNegotiationManager(); - - private List> messageConverters; - - private List allSupportedMediaTypes; - - public EndpointHandlerAdapter() { - WebMvcConfigurationSupportConventions conventions = new WebMvcConfigurationSupportConventions(); - setMessageConverters(conventions.getDefaultHttpMessageConverters()); - } - - @Override - public boolean supports(Object handler) { - return handler instanceof Endpoint; - } - - @Override - public long getLastModified(HttpServletRequest request, Object handler) { - return -1; - } - - @Override - public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, - Object handler) throws Exception { - handle(request, response, (Endpoint) handler); - return null; - } - - @SuppressWarnings("unchecked") - private void handle(HttpServletRequest request, HttpServletResponse response, - Endpoint endpoint) throws Exception { - - Object result = endpoint.invoke(); - Class resultClass = result.getClass(); - - List mediaTypes = getMediaTypes(request, endpoint, resultClass); - MediaType selectedMediaType = selectMediaType(mediaTypes); - - ServletServerHttpResponse outputMessage = new ServletServerHttpResponse(response); - try { - if (selectedMediaType != null) { - selectedMediaType = selectedMediaType.removeQualityValue(); - for (HttpMessageConverter messageConverter : this.messageConverters) { - if (messageConverter.canWrite(resultClass, selectedMediaType)) { - ((HttpMessageConverter) messageConverter).write(result, - selectedMediaType, outputMessage); - if (logger.isDebugEnabled()) { - logger.debug("Written [" + result + "] as \"" - + selectedMediaType + "\" using [" + messageConverter - + "]"); - } - return; - } - } - } - throw new HttpMediaTypeNotAcceptableException(this.allSupportedMediaTypes); - } finally { - outputMessage.close(); - } - } - - private List getMediaTypes(HttpServletRequest request, - Endpoint endpoint, Class resultClass) - throws HttpMediaTypeNotAcceptableException { - List requested = getAcceptableMediaTypes(request); - List producible = getProducibleMediaTypes(endpoint, resultClass); - - Set compatible = new LinkedHashSet(); - for (MediaType r : requested) { - for (MediaType p : producible) { - if (r.isCompatibleWith(p)) { - compatible.add(getMostSpecificMediaType(r, p)); - } - } - } - if (compatible.isEmpty()) { - throw new HttpMediaTypeNotAcceptableException(producible); - } - List mediaTypes = new ArrayList(compatible); - MediaType.sortBySpecificityAndQuality(mediaTypes); - return mediaTypes; - } - - private List getAcceptableMediaTypes(HttpServletRequest request) - throws HttpMediaTypeNotAcceptableException { - List mediaTypes = this.contentNegotiationManager - .resolveMediaTypes(new ServletWebRequest(request)); - return mediaTypes.isEmpty() ? Collections.singletonList(MediaType.ALL) - : mediaTypes; - } - - private List getProducibleMediaTypes(Endpoint endpoint, - Class returnValueClass) { - MediaType[] mediaTypes = endpoint.getProduces(); - if (mediaTypes != null && mediaTypes.length != 0) { - return Arrays.asList(mediaTypes); - } - - if (this.allSupportedMediaTypes.isEmpty()) { - return Collections.singletonList(MediaType.ALL); - } - - List result = new ArrayList(); - for (HttpMessageConverter converter : this.messageConverters) { - if (converter.canWrite(returnValueClass, null)) { - result.addAll(converter.getSupportedMediaTypes()); - } - } - return result; - } - - private MediaType getMostSpecificMediaType(MediaType acceptType, MediaType produceType) { - produceType = produceType.copyQualityValue(acceptType); - return MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceType) <= 0 ? acceptType - : produceType; - } - - private MediaType selectMediaType(List mediaTypes) { - MediaType selectedMediaType = null; - for (MediaType mediaType : mediaTypes) { - if (mediaType.isConcrete()) { - selectedMediaType = mediaType; - break; - } else if (mediaType.equals(MediaType.ALL) - || mediaType.equals(MEDIA_TYPE_APPLICATION)) { - selectedMediaType = MediaType.APPLICATION_OCTET_STREAM; - break; - } - } - return selectedMediaType; - } - - public void setContentNegotiationManager( - ContentNegotiationManager contentNegotiationManager) { - this.contentNegotiationManager = contentNegotiationManager; - } - - public void setMessageConverters(List> messageConverters) { - this.messageConverters = messageConverters; - Set allSupportedMediaTypes = new LinkedHashSet(); - for (HttpMessageConverter messageConverter : messageConverters) { - allSupportedMediaTypes.addAll(messageConverter.getSupportedMediaTypes()); - } - this.allSupportedMediaTypes = new ArrayList(allSupportedMediaTypes); - MediaType.sortBySpecificity(this.allSupportedMediaTypes); - } - - /** - * Default conventions, taken from {@link WebMvcConfigurationSupport} with a few minor - * tweaks. - */ - private static class WebMvcConfigurationSupportConventions extends - WebMvcConfigurationSupport { - public List> getDefaultHttpMessageConverters() { - List> converters = new ArrayList>(); - addDefaultHttpMessageConverters(converters); - for (HttpMessageConverter converter : converters) { - if (converter instanceof MappingJackson2HttpMessageConverter) { - MappingJackson2HttpMessageConverter jacksonConverter = (MappingJackson2HttpMessageConverter) converter; - jacksonConverter.getObjectMapper().disable( - SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - } - } - return converters; - } - } -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java deleted file mode 100644 index 4af570b19cb..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.endpoint.mvc; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.beans.factory.BeanFactoryUtils; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.bootstrap.actuate.endpoint.ActionEndpoint; -import org.springframework.bootstrap.actuate.endpoint.Endpoint; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.util.Assert; -import org.springframework.util.StringUtils; -import org.springframework.web.servlet.HandlerExecutionChain; -import org.springframework.web.servlet.HandlerMapping; -import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping; - -/** - * {@link HandlerMapping} to map {@link Endpoint}s to URLs via {@link Endpoint#getPath()}. - * Standard {@link Endpoint}s are mapped to GET requests, {@link ActionEndpoint}s are - * mapped to POST requests. - * - * @author Phillip Webb - * @see EndpointHandlerAdapter - */ -public class EndpointHandlerMapping extends AbstractUrlHandlerMapping implements - InitializingBean, ApplicationContextAware { - - private List> endpoints; - - private String prefix = ""; - - private boolean disabled = false; - - /** - * Create a new {@link EndpointHandlerMapping} instance. All {@link Endpoint}s will be - * detected from the {@link ApplicationContext}. - */ - public EndpointHandlerMapping() { - setOrder(HIGHEST_PRECEDENCE); - } - - /** - * Create a new {@link EndpointHandlerMapping} with the specified endpoints. - * @param endpoints the endpoints - */ - public EndpointHandlerMapping(Collection> endpoints) { - Assert.notNull(endpoints, "Endpoints must not be null"); - this.endpoints = new ArrayList>(endpoints); - } - - @Override - public void afterPropertiesSet() throws Exception { - if (this.endpoints == null) { - this.endpoints = findEndpointBeans(); - } - if (!this.disabled) { - for (Endpoint endpoint : this.endpoints) { - registerHandler(this.prefix + endpoint.getPath(), endpoint); - } - } - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - private List> findEndpointBeans() { - return new ArrayList(BeanFactoryUtils.beansOfTypeIncludingAncestors( - getApplicationContext(), Endpoint.class).values()); - } - - @Override - protected Object lookupHandler(String urlPath, HttpServletRequest request) - throws Exception { - Object handler = super.lookupHandler(urlPath, request); - if (handler != null) { - Object endpoint = (handler instanceof HandlerExecutionChain ? ((HandlerExecutionChain) handler) - .getHandler() : handler); - String method = (endpoint instanceof ActionEndpoint ? "POST" : "GET"); - if (request.getMethod().equals(method)) { - return endpoint; - } - } - return null; - } - - /** - * @param prefix the prefix to set - */ - public void setPrefix(String prefix) { - Assert.isTrue("".equals(prefix) || StringUtils.startsWithIgnoreCase(prefix, "/"), - "prefix must start with '/'"); - this.prefix = prefix; - } - - /** - * Sets if this mapping is disabled. - */ - public void setDisabled(boolean disabled) { - this.disabled = disabled; - } - - /** - * Returns if this mapping is disabled. - */ - public boolean isDisabled() { - return this.disabled; - } - - /** - * Return the endpoints - */ - public List> getEndpoints() { - return Collections.unmodifiableList(this.endpoints); - } -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java deleted file mode 100644 index 55d86a25f68..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.fixme; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.HierarchicalBeanFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; -import org.springframework.bootstrap.actuate.web.BasicErrorController; -import org.springframework.bootstrap.context.annotation.ConditionalOnBean; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.ErrorPage; -import org.springframework.bootstrap.context.embedded.jetty.JettyEmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.web.filter.GenericFilterBean; -import org.springframework.web.servlet.DispatcherServlet; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; - -/** - * Configuration for creating a new container (e.g. tomcat) for the management endpoints. - * - * @author Dave Syer - */ -@Configuration -@EnableWebMvc -@Import(ManagementSecurityConfiguration.class) -public class ManagementServerConfiguration { - - // FIXME delete when security works - - @Bean - public DispatcherServlet dispatcherServlet() { - return new DispatcherServlet(); - } - - @Bean - public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer( - ApplicationContext context) { - return new PropertySourcesPlaceholderConfigurer(); - } - - @Bean - public BasicErrorController errorEndpoint() { - return new BasicErrorController(); - } - - @Bean - @ConditionalOnBean(TomcatEmbeddedServletContainerFactory.class) - public EmbeddedServletContainerFactory tomcatContainer( - HierarchicalBeanFactory beanFactory) { - TomcatEmbeddedServletContainerFactory factory = beanFactory - .getParentBeanFactory().getBean( - TomcatEmbeddedServletContainerFactory.class); - return factory.getChildContextFactory("Management"); - } - - @Bean - @ConditionalOnBean(JettyEmbeddedServletContainerFactory.class) - public EmbeddedServletContainerFactory jettyContainer() { - return new JettyEmbeddedServletContainerFactory(); - } - - @Configuration - protected static class ServerCustomizationConfiguration implements - EmbeddedServletContainerCustomizer { - - @Value("${endpoints.error.path:/error}") - private String errorPath = "/error"; - - @Autowired - private ApplicationContext beanFactory; - - @Override - public void customize(ConfigurableEmbeddedServletContainerFactory factory) { - ManagementServerProperties configuration = this.beanFactory - .getBean(ManagementServerProperties.class); - factory.setPort(configuration.getPort()); - factory.setAddress(configuration.getAddress()); - factory.setContextPath(configuration.getContextPath()); - factory.addErrorPages(new ErrorPage(this.errorPath)); - } - - } - -} - -@Configuration -@ConditionalOnClass(name = { - "org.springframework.security.config.annotation.web.EnableWebSecurity", - "javax.servlet.Filter" }) -class ManagementSecurityConfiguration { - - @Bean - // TODO: enable and get rid of the empty filter when @ConditionalOnBean works - // @ConditionalOnBean(name = "springSecurityFilterChain") - public Filter springSecurityFilterChain(HierarchicalBeanFactory beanFactory) { - BeanFactory parent = beanFactory.getParentBeanFactory(); - if (parent != null && parent.containsBean("springSecurityFilterChain")) { - return parent.getBean("springSecurityFilterChain", Filter.class); - } - return new GenericFilterBean() { - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - chain.doFilter(request, response); - } - }; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java deleted file mode 100644 index cfddd81751f..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.health; - -/** - * Strategy interface used to provide an indication of application health. - * - * @author Dave Syer - * @see VanillaHealthIndicator - */ -public interface HealthIndicator { - - /** - * @return an indication of health - */ - T health(); - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java deleted file mode 100644 index afb22b9e914..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.health; - -/** - * Default implementation of {@link HealthIndicator} that simply returns "ok". - * - * @author Dave Syer - */ -public class VanillaHealthIndicator implements HealthIndicator { - - @Override - public String health() { - return "ok"; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java deleted file mode 100644 index 767161dd049..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -/** - * A service that can be used to increment, decrement and reset a {@link Metric}. - * - * @author Dave Syer - */ -public interface CounterService { - - /** - * Increment the specified metric by 1. - * @param metricName the name of the metric - */ - void increment(String metricName); - - /** - * Decrement the specified metric by 1. - * @param metricName the name of the metric - */ - void decrement(String metricName); - - /** - * Reset the specified metric to 0. - * @param metricName the name of the metric - */ - void reset(String metricName); - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java deleted file mode 100644 index 905c313d84e..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -import java.util.Date; - -/** - * Default implementation of {@link CounterService}. - * - * @author Dave Syer - */ -public class DefaultCounterService implements CounterService { - - private MetricRepository repository; - - /** - * Create a {@link DefaultCounterService} instance. - * @param repository the underlying repository used to manage metrics - */ - public DefaultCounterService(MetricRepository repository) { - super(); - this.repository = repository; - } - - @Override - public void increment(String metricName) { - this.repository.increment(wrap(metricName), 1, new Date()); - } - - @Override - public void decrement(String metricName) { - this.repository.increment(wrap(metricName), -1, new Date()); - } - - @Override - public void reset(String metricName) { - this.repository.set(wrap(metricName), 0, new Date()); - } - - private String wrap(String metricName) { - if (metricName.startsWith("counter")) { - return metricName; - } else { - return "counter." + metricName; - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java deleted file mode 100644 index 139afb28f91..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -import java.util.Date; - -/** - * Default implementation of {@link GaugeService}. - * - * @author Dave Syer - */ -public class DefaultGaugeService implements GaugeService { - - private MetricRepository metricRepository; - - /** - * @param counterRepository - */ - public DefaultGaugeService(MetricRepository counterRepository) { - super(); - this.metricRepository = counterRepository; - } - - @Override - public void set(String metricName, double value) { - this.metricRepository.set(wrap(metricName), value, new Date()); - } - - private String wrap(String metricName) { - if (metricName.startsWith("gauge")) { - return metricName; - } else { - return "gauge." + metricName; - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java deleted file mode 100644 index 801ef8ef95b..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -/** - * A service that can be used to manage a {@link Metric} as a gauge. - * - * @author Dave Syer - */ -public interface GaugeService { - - /** - * Set the specified metric value - * @param metricName the metric to set - * @param value the value of the metric - */ - void set(String metricName, double value); - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java deleted file mode 100644 index 3fe196cbf70..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -/** - * @author Dave Syer - */ -public class InMemoryMetricRepository implements MetricRepository { - - private ConcurrentMap metrics = new ConcurrentHashMap(); - - @Override - public void increment(String metricName, int amount, Date timestamp) { - // FIXME this might not be thread safe - Measurement current = this.metrics.get(metricName); - if (current != null) { - Metric metric = current.getMetric(); - this.metrics.replace(metricName, current, - new Measurement(timestamp, metric.increment(amount))); - } else { - this.metrics.putIfAbsent(metricName, new Measurement(timestamp, new Metric( - metricName, amount))); - } - } - - @Override - public void set(String metricName, double value, Date timestamp) { - Measurement current = this.metrics.get(metricName); - if (current != null) { - Metric metric = current.getMetric(); - this.metrics.replace(metricName, current, - new Measurement(timestamp, metric.set(value))); - } else { - this.metrics.putIfAbsent(metricName, new Measurement(timestamp, new Metric( - metricName, value))); - } - } - - @Override - public void delete(String metricName) { - this.metrics.remove(metricName); - } - - @Override - public Metric findOne(String metricName) { - if (this.metrics.containsKey(metricName)) { - return this.metrics.get(metricName).getMetric(); - } - return new Metric(metricName, 0); - } - - @Override - public Collection findAll() { - ArrayList result = new ArrayList(); - for (Measurement measurement : this.metrics.values()) { - result.add(measurement.getMetric()); - } - return result; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java deleted file mode 100644 index 5401927f774..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -import java.util.Date; - -import org.springframework.util.ObjectUtils; - -/** - * A {@link Metric} at a given point in time. - * - * @author Dave Syer - */ -public final class Measurement { - - private Date timestamp; - - private Metric metric; - - public Measurement(Date timestamp, Metric metric) { - this.timestamp = timestamp; - this.metric = metric; - } - - public Date getTimestamp() { - return this.timestamp; - } - - public Metric getMetric() { - return this.metric; - } - - @Override - public String toString() { - return "Measurement [dateTime=" + this.timestamp + ", metric=" + this.metric - + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ObjectUtils.nullSafeHashCode(this.timestamp); - result = prime * result + ObjectUtils.nullSafeHashCode(this.metric); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() == obj.getClass()) { - Measurement other = (Measurement) obj; - boolean result = ObjectUtils.nullSafeEquals(this.timestamp, other.timestamp); - result &= ObjectUtils.nullSafeEquals(this.metric, other.metric); - return result; - } - return super.equals(obj); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java deleted file mode 100644 index f92cbb3d9ea..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -import org.springframework.util.Assert; -import org.springframework.util.ObjectUtils; - -/** - * Immutable class that can be used to hold any arbitrary system measurement value. For - * example a metric might record the number of active connections. - * - * @author Dave Syer - * @see MetricRepository - * @see CounterService - */ -public final class Metric { - - private final String name; - - private final double value; - - /** - * Create a new {@link Metric} instance. - * @param name the name of the metric - * @param value the value of the metric - */ - public Metric(String name, double value) { - super(); - Assert.notNull(name, "Name must not be null"); - this.name = name; - this.value = value; - } - - /** - * Returns the name of the metric. - */ - public String getName() { - return this.name; - } - - /** - * Returns the value of the metric. - */ - public double getValue() { - return this.value; - } - - /** - * Create a new {@link Metric} with an incremented value. - * @param amount the amount that the new metric will differ from this one - * @return a new {@link Metric} instance - */ - public Metric increment(int amount) { - return new Metric(this.name, new Double(((int) this.value) + amount)); - } - - /** - * Create a new {@link Metric} with a different value. - * @param value the value of the new metric - * @return a new {@link Metric} instance - */ - public Metric set(double value) { - return new Metric(this.name, value); - } - - @Override - public String toString() { - return "Metric [name=" + this.name + ", value=" + this.value + "]"; - } - - @Override - public int hashCode() { - int valueHashCode = ObjectUtils.hashCode(this.value); - final int prime = 31; - int result = 1; - result = prime * result + ObjectUtils.nullSafeHashCode(this.name); - result = prime * result + (valueHashCode ^ (valueHashCode >>> 32)); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() == obj.getClass()) { - Metric other = (Metric) obj; - boolean result = ObjectUtils.nullSafeEquals(this.name, other.name); - result &= Double.doubleToLongBits(this.value) == Double - .doubleToLongBits(other.value); - return result; - } - return super.equals(obj); - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java deleted file mode 100644 index 6a54b893a79..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -import java.util.Collection; -import java.util.Date; - -/** - * A Repository used to manage {@link Metric}s. - * - * @author Dave Syer - */ -public interface MetricRepository { - - // FIXME perhaps revisit this, there is no way to get timestamps - // could also simply, leaving increment to counter service - - // Perhaps findAll, findOne should return Measurements - // put(String name, Callback -> process(Metric) - - void increment(String metricName, int amount, Date timestamp); - - void set(String metricName, double value, Date timestamp); - - void delete(String metricName); - - Metric findOne(String metricName); - - Collection findAll(); - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java deleted file mode 100644 index 6d6ac346dfa..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.properties; - -import java.net.InetAddress; - -import javax.validation.constraints.NotNull; - -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.bootstrap.properties.ServerProperties; - -/** - * Properties for the management server (e.g. port and path settings). - * - * @author Dave Syer - * @see ServerProperties - */ -@ConfigurationProperties(name = "management", ignoreUnknownFields = false) -public class ManagementServerProperties { - - private Integer port; - - private InetAddress address; - - @NotNull - private String contextPath = ""; - - private boolean allowShutdown = false; - - public boolean isAllowShutdown() { - return this.allowShutdown; - } - - public void setAllowShutdown(boolean allowShutdown) { - this.allowShutdown = allowShutdown; - } - - /** - * Returns the management port or {@code null} if the - * {@link ServerProperties#getPort() server port} should be used. - * @see #setPort(Integer) - */ - public Integer getPort() { - return this.port; - } - - /** - * Sets the port of the management server, use {@code null} if the - * {@link ServerProperties#getPort() server port} should be used. To disable use 0. - */ - public void setPort(Integer port) { - this.port = port; - } - - public InetAddress getAddress() { - return this.address; - } - - public void setAddress(InetAddress address) { - this.address = address; - } - - public String getContextPath() { - return this.contextPath; - } - - public void setContextPath(String contextPath) { - this.contextPath = contextPath; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java deleted file mode 100644 index 1ea56222c41..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.properties; - -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.security.config.annotation.web.configurers.SessionCreationPolicy; - -/** - * Properties for the security aspects of an application. - * - * @author Dave Syer - */ -@ConfigurationProperties(name = "security", ignoreUnknownFields = false) -public class SecurityProperties { - - private boolean requireSsl; - - private Basic basic = new Basic(); - - private SessionCreationPolicy sessions = SessionCreationPolicy.stateless; - - private String[] ignored = new String[] { "/css/**", "/js/**", "/images/**", - "/**/favicon.ico" }; - - public SessionCreationPolicy getSessions() { - return this.sessions; - } - - public void setSessions(SessionCreationPolicy sessions) { - this.sessions = sessions; - } - - public Basic getBasic() { - return this.basic; - } - - public void setBasic(Basic basic) { - this.basic = basic; - } - - public boolean isRequireSsl() { - return this.requireSsl; - } - - public void setRequireSsl(boolean requireSsl) { - this.requireSsl = requireSsl; - } - - public void setIgnored(String... ignored) { - this.ignored = ignored; - } - - public String[] getIgnored() { - return this.ignored; - } - - public static class Basic { - - private boolean enabled = true; - - private String realm = "Spring"; - - private String[] path = new String[] { "/**" }; - - private String role = "USER"; - - public boolean isEnabled() { - return this.enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public String getRealm() { - return this.realm; - } - - public void setRealm(String realm) { - this.realm = realm; - } - - public String[] getPath() { - return this.path; - } - - public void setPath(String... paths) { - this.path = paths; - } - - public String getRole() { - return this.role; - } - - public void setRole(String role) { - this.role = role; - } - - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java deleted file mode 100644 index 26e4431cc85..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.security; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.bootstrap.actuate.audit.AuditEvent; -import org.springframework.bootstrap.actuate.audit.listener.AuditApplicationEvent; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.context.ApplicationListener; -import org.springframework.security.authentication.event.AbstractAuthenticationEvent; -import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent; -import org.springframework.security.web.authentication.switchuser.AuthenticationSwitchUserEvent; - -/** - * {@link ApplicationListener} expose Spring Security {@link AbstractAuthenticationEvent - * authentication events} as {@link AuditEvent}s. - * - * @author Dave Syer - */ -public class AuthenticationAuditListener implements - ApplicationListener, ApplicationEventPublisherAware { - - private ApplicationEventPublisher publisher; - - @Override - public void setApplicationEventPublisher(ApplicationEventPublisher publisher) { - this.publisher = publisher; - } - - @Override - public void onApplicationEvent(AbstractAuthenticationEvent event) { - if (event instanceof AbstractAuthenticationFailureEvent) { - onAuthenticationFailureEvent((AbstractAuthenticationFailureEvent) event); - } else if (event instanceof AuthenticationSwitchUserEvent) { - onAuthenticationSwitchUserEvent((AuthenticationSwitchUserEvent) event); - } else { - onAuthenticationEvent(event); - } - } - - private void onAuthenticationFailureEvent(AbstractAuthenticationFailureEvent event) { - Map data = new HashMap(); - data.put("type", event.getException().getClass().getName()); - data.put("message", event.getException().getMessage()); - publish(new AuditEvent(event.getAuthentication().getName(), - "AUTHENTICATION_FAILURE", data)); - } - - private void onAuthenticationSwitchUserEvent(AuthenticationSwitchUserEvent event) { - Map data = new HashMap(); - if (event.getAuthentication().getDetails() != null) { - data.put("details", event.getAuthentication().getDetails()); - } - data.put("target", event.getTargetUser().getUsername()); - publish(new AuditEvent(event.getAuthentication().getName(), - "AUTHENTICATION_SWITCH", data)); - } - - private void onAuthenticationEvent(AbstractAuthenticationEvent event) { - Map data = new HashMap(); - if (event.getAuthentication().getDetails() != null) { - data.put("details", event.getAuthentication().getDetails()); - } - publish(new AuditEvent(event.getAuthentication().getName(), - "AUTHENTICATION_SUCCESS", data)); - } - - private void publish(AuditEvent event) { - if (this.publisher != null) { - this.publisher.publishEvent(new AuditApplicationEvent(event)); - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java deleted file mode 100644 index 816d384bcb5..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.security; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.bootstrap.actuate.audit.AuditEvent; -import org.springframework.bootstrap.actuate.audit.listener.AuditApplicationEvent; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.context.ApplicationListener; -import org.springframework.security.access.event.AbstractAuthorizationEvent; -import org.springframework.security.access.event.AuthenticationCredentialsNotFoundEvent; -import org.springframework.security.access.event.AuthorizationFailureEvent; - -/** - * {@link ApplicationListener} expose Spring Security {@link AbstractAuthorizationEvent - * authorization events} as {@link AuditEvent}s. - * - * @author Dave Syer - */ -public class AuthorizationAuditListener implements - ApplicationListener, ApplicationEventPublisherAware { - - private ApplicationEventPublisher publisher; - - @Override - public void setApplicationEventPublisher(ApplicationEventPublisher publisher) { - this.publisher = publisher; - } - - @Override - public void onApplicationEvent(AbstractAuthorizationEvent event) { - if (event instanceof AuthenticationCredentialsNotFoundEvent) { - onAuthenticationCredentialsNotFoundEvent((AuthenticationCredentialsNotFoundEvent) event); - } else if (event instanceof AuthorizationFailureEvent) { - onAuthorizationFailureEvent((AuthorizationFailureEvent) event); - } - } - - private void onAuthenticationCredentialsNotFoundEvent( - AuthenticationCredentialsNotFoundEvent event) { - Map data = new HashMap(); - data.put("type", event.getCredentialsNotFoundException().getClass().getName()); - data.put("message", event.getCredentialsNotFoundException().getMessage()); - publish(new AuditEvent("", "AUTHENTICATION_FAILURE", data)); - } - - private void onAuthorizationFailureEvent(AuthorizationFailureEvent event) { - Map data = new HashMap(); - data.put("type", event.getAccessDeniedException().getClass().getName()); - data.put("message", event.getAccessDeniedException().getMessage()); - publish(new AuditEvent(event.getAuthentication().getName(), - "AUTHORIZATION_FAILURE", data)); - } - - private void publish(AuditEvent event) { - if (this.publisher != null) { - this.publisher.publishEvent(new AuditApplicationEvent(event)); - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java deleted file mode 100644 index 7e4e71fe67b..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.trace; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; - -/** - * In-memory implementation of {@link TraceRepository}. - * - * @author Dave Syer - */ -public class InMemoryTraceRepository implements TraceRepository { - - private int capacity = 100; - - private List traces = new ArrayList(); - - /** - * @param capacity the capacity to set - */ - public void setCapacity(int capacity) { - this.capacity = capacity; - } - - @Override - public List findAll() { - synchronized (this.traces) { - return Collections.unmodifiableList(this.traces); - } - } - - @Override - public void add(Map map) { - Trace trace = new Trace(new Date(), map); - synchronized (this.traces) { - while (this.traces.size() >= this.capacity) { - this.traces.remove(0); - } - this.traces.add(trace); - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java deleted file mode 100644 index 4f211420044..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.trace; - -import java.util.Date; -import java.util.Map; - -import org.springframework.util.Assert; - -/** - * A value object representing a trace event: at a particular time with a simple (map) - * information. Can be used for analyzing contextual information such as HTTP headers. - * - * @author Dave Syer - */ -public final class Trace { - - private Date timestamp; - - private Map info; - - public Trace(Date timestamp, Map info) { - super(); - Assert.notNull(timestamp, "Timestamp must not be null"); - Assert.notNull(info, "Info must not be null"); - this.timestamp = timestamp; - this.info = info; - } - - public Date getTimestamp() { - return this.timestamp; - } - - public Map getInfo() { - return this.info; - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java deleted file mode 100644 index 78d8f189eb2..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.trace; - -import java.util.List; -import java.util.Map; - -/** - * A repository for {@link Trace}s. - * - * @author Dave Syer - */ -public interface TraceRepository { - - /** - * Find all {@link Trace} objects contained in the repository. - */ - List findAll(); - - /** - * Add a new {@link Trace} object at the current time. - * @param traceInfo trace information - */ - void add(Map traceInfo); - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java deleted file mode 100644 index 2f0ba219f23..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.trace; - -import java.io.IOException; -import java.util.Collections; -import java.util.Enumeration; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.core.Ordered; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * Servlet {@link Filter} that logs all requests to a {@link TraceRepository}. - * - * @author Dave Syer - */ -public class WebRequestTraceFilter implements Filter, Ordered { - - final Log logger = LogFactory.getLog(WebRequestTraceFilter.class); - - private boolean dumpRequests = false; - - private final TraceRepository traceRepository; - - private int order = Integer.MAX_VALUE; - - private ObjectMapper objectMapper = new ObjectMapper(); - - /** - * @param traceRepository - */ - public WebRequestTraceFilter(TraceRepository traceRepository) { - this.traceRepository = traceRepository; - } - - /** - * @param order the order to set - */ - public void setOrder(int order) { - this.order = order; - } - - @Override - public int getOrder() { - return this.order; - } - - /** - * Debugging feature. If enabled, and trace logging is enabled then web request - * headers will be logged. - */ - public void setDumpRequests(boolean dumpRequests) { - this.dumpRequests = dumpRequests; - } - - @Override - public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) - throws IOException, ServletException { - HttpServletRequest request = (HttpServletRequest) req; - HttpServletResponse response = (HttpServletResponse) res; - - Map trace = getTrace(request); - this.traceRepository.add(trace); - if (this.logger.isTraceEnabled()) { - this.logger.trace("Processing request " + request.getMethod() + " " - + request.getRequestURI()); - if (this.dumpRequests) { - try { - @SuppressWarnings("unchecked") - Map headers = (Map) trace - .get("headers"); - this.logger.trace("Headers: " - + this.objectMapper.writeValueAsString(headers)); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Cannot create JSON", e); - } - } - } - - chain.doFilter(request, response); - } - - protected Map getTrace(HttpServletRequest request) { - - Map map = new LinkedHashMap(); - Enumeration names = request.getHeaderNames(); - - while (names.hasMoreElements()) { - String name = names.nextElement(); - List values = Collections.list(request.getHeaders(name)); - Object value = values; - if (values.size() == 1) { - value = values.get(0); - } else if (values.isEmpty()) { - value = ""; - } - map.put(name, value); - - } - Map trace = new LinkedHashMap(); - trace.put("method", request.getMethod()); - trace.put("path", request.getRequestURI()); - trace.put("headers", map); - return trace; - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - } - - @Override - public void destroy() { - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java deleted file mode 100644 index 2497ec58bd9..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.web; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.context.embedded.AbstractEmbeddedServletContainerFactory; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -/** - * Basic global error {@link Controller}, rendering servlet container error codes and - * messages where available. More specific errors can be handled either using Spring MVC - * abstractions (e.g. {@code @ExceptionHandler}) or by adding servlet - * {@link AbstractEmbeddedServletContainerFactory#setErrorPages(java.util.Set) container - * error pages}. - * - * @author Dave Syer - */ -@Controller -public class BasicErrorController implements ErrorController { - - private Log logger = LogFactory.getLog(BasicErrorController.class); - - @Value("${error.path:/error}") - private String errorPath; - - @Override - public String getErrorPath() { - return this.errorPath; - } - - @RequestMapping(value = "${error.path:/error}", produces = "text/html") - public ModelAndView errorHtml(HttpServletRequest request) { - Map map = error(request); - return new ModelAndView("error", map); - } - - @RequestMapping(value = "${error.path:/error}") - @ResponseBody - public Map error(HttpServletRequest request) { - Map map = new LinkedHashMap(); - map.put("timestamp", new Date()); - try { - Throwable error = (Throwable) request - .getAttribute("javax.servlet.error.exception"); - Object obj = request.getAttribute("javax.servlet.error.status_code"); - int status = 999; - if (obj != null) { - status = (Integer) obj; - map.put("error", HttpStatus.valueOf(status).getReasonPhrase()); - } else { - map.put("error", "None"); - } - map.put("status", status); - if (error != null) { - while (error instanceof ServletException) { - error = ((ServletException) error).getCause(); - } - map.put("exception", error.getClass().getName()); - map.put("message", error.getMessage()); - String trace = request.getParameter("trace"); - if (trace != null && !"false".equals(trace.toLowerCase())) { - StringWriter stackTrace = new StringWriter(); - error.printStackTrace(new PrintWriter(stackTrace)); - stackTrace.flush(); - map.put("trace", stackTrace.toString()); - } - this.logger.error(error); - } else { - Object message = request.getAttribute("javax.servlet.error.message"); - map.put("message", message == null ? "No message available" : message); - } - return map; - } catch (Exception e) { - map.put("error", e.getClass().getName()); - map.put("message", e.getMessage()); - this.logger.error(e); - return map; - } - } - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java b/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java deleted file mode 100644 index d7f3973c5c7..00000000000 --- a/spring-zero-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.web; - -import org.springframework.stereotype.Controller; - -/** - * Marker interface used to indicate that a {@link Controller @Controller} is used to - * render errors. - * - * @author Phillip Webb - */ -public interface ErrorController { - - public String getErrorPath(); - -} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEvent.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEvent.java new file mode 100644 index 00000000000..69fea7e24f2 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEvent.java @@ -0,0 +1,137 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.audit; + +import java.io.Serializable; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.springframework.context.ApplicationEventPublisherAware; +import org.springframework.security.authentication.AuthenticationEventPublisher; +import org.springframework.util.Assert; + +/** + * A value object representing an audit event: at a particular time, a particular user or + * agent carried out an action of a particular type. This object records the details of + * such an event. + * + *

+ * Users can inject a {@link AuditEventRepository} to publish their own events or + * alternatively use Springs {@link AuthenticationEventPublisher} (usually obtained by + * implementing {@link ApplicationEventPublisherAware}). + * + * @author Dave Syer + * @see AuditEventRepository + */ +public class AuditEvent implements Serializable { + + private final Date timestamp; + + private final String principal; + + private final String type; + + private final Map data; + + /** + * Create a new audit event for the current time. + * @param principal The user principal responsible + * @param type the event type + * @param data The event data + */ + public AuditEvent(String principal, String type, Map data) { + this(new Date(), principal, type, data); + } + + /** + * Create a new audit event for the current time from data provided as name-value + * pairs + * @param principal The user principal responsible + * @param type the event type + * @param data The event data in the form 'key=value' or simply 'key' + */ + public AuditEvent(String principal, String type, String... data) { + this(new Date(), principal, type, convert(data)); + } + + /** + * Create a new audit event. + * @param timestamp The date/time of the event + * @param principal The user principal responsible + * @param type the event type + * @param data The event data + */ + public AuditEvent(Date timestamp, String principal, String type, + Map data) { + Assert.notNull(timestamp, "Timestamp must not be null"); + Assert.notNull(type, "Type must not be null"); + this.timestamp = timestamp; + this.principal = principal; + this.type = type; + this.data = Collections.unmodifiableMap(data); + } + + private static Map convert(String[] data) { + Map result = new HashMap(); + for (String entry : data) { + if (entry.contains("=")) { + int index = entry.indexOf("="); + result.put(entry.substring(0, index), entry.substring(index + 1)); + } else { + result.put(entry, null); + } + } + return result; + } + + /** + * Returns the date/time that the even was logged. + */ + public Date getTimestamp() { + return this.timestamp; + } + + /** + * Returns the user principal responsible for the event or {@code null}. + */ + public String getPrincipal() { + return this.principal; + } + + /** + * Returns the type of event. + */ + public String getType() { + return this.type; + } + + /** + * Returns the event data. + */ + public Map getData() { + return this.data; + } + + @Override + public String toString() { + return "AuditEvent [timestamp=" + this.timestamp + ", principal=" + + this.principal + ", type=" + this.type + ", data=" + this.data + "]"; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEventRepository.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEventRepository.java new file mode 100644 index 00000000000..6349f6ae7b8 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEventRepository.java @@ -0,0 +1,45 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.audit; + +import java.util.Date; +import java.util.List; + +/** + * Repository for {@link AuditEvent}s. + * + * @author Dave Syer + */ +public interface AuditEventRepository { + + /** + * Find audit events relating to the specified principal since the time provided. + * + * @param principal the principal name to search for + * @param after timestamp of earliest result required + * @return audit events relating to the principal + */ + List find(String principal, Date after); + + /** + * Log an event. + * + * @param event the audit event to log + */ + void add(AuditEvent event); + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/InMemoryAuditEventRepository.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/InMemoryAuditEventRepository.java new file mode 100644 index 00000000000..5a564094d68 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/InMemoryAuditEventRepository.java @@ -0,0 +1,69 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.audit; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * In-memory {@link AuditEventRepository} implementation. + * + * @author Dave Syer + */ +public class InMemoryAuditEventRepository implements AuditEventRepository { + + private int capacity = 100; + + private Map> events = new HashMap>(); + + /** + * @param capacity the capacity to set + */ + public void setCapacity(int capacity) { + this.capacity = capacity; + } + + @Override + public List find(String principal, Date after) { + synchronized (this.events) { + return Collections.unmodifiableList(getEvents(principal)); + } + } + + private List getEvents(String principal) { + if (!this.events.containsKey(principal)) { + this.events.put(principal, new ArrayList()); + } + return this.events.get(principal); + } + + @Override + public void add(AuditEvent event) { + synchronized (this.events) { + List list = getEvents(event.getPrincipal()); + while (list.size() >= this.capacity) { + list.remove(0); + } + list.add(event); + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/listener/AuditApplicationEvent.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/listener/AuditApplicationEvent.java new file mode 100644 index 00000000000..a2034b8f60e --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/listener/AuditApplicationEvent.java @@ -0,0 +1,80 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.audit.listener; + +import java.util.Date; +import java.util.Map; + +import org.springframework.context.ApplicationEvent; +import org.springframework.util.Assert; +import org.springframework.zero.actuate.audit.AuditEvent; + +/** + * Spring {@link ApplicationEvent} to encapsulate {@link AuditEvent}s. + * + * @author Dave Syer + */ +public class AuditApplicationEvent extends ApplicationEvent { + + private AuditEvent auditEvent; + + /** + * Create a new {@link AuditApplicationEvent} that wraps a newly created + * {@link AuditEvent}. + * @see AuditEvent#AuditEvent(String, String, Map) + */ + public AuditApplicationEvent(String principal, String type, Map data) { + this(new AuditEvent(principal, type, data)); + } + + /** + * Create a new {@link AuditApplicationEvent} that wraps a newly created + * {@link AuditEvent}. + * @see AuditEvent#AuditEvent(String, String, String...) + */ + public AuditApplicationEvent(String principal, String type, String... data) { + this(new AuditEvent(principal, type, data)); + } + + /** + * Create a new {@link AuditApplicationEvent} that wraps a newly created + * {@link AuditEvent}. + * @see AuditEvent#AuditEvent(Date, String, String, Map) + */ + public AuditApplicationEvent(Date timestamp, String principal, String type, + Map data) { + this(new AuditEvent(timestamp, principal, type, data)); + } + + /** + * Create a new {@link AuditApplicationEvent} that wraps the specified + * {@link AuditEvent}. + * @param auditEvent the source of this event + */ + public AuditApplicationEvent(AuditEvent auditEvent) { + super(auditEvent); + Assert.notNull(auditEvent, "AuditEvent must not be null"); + this.auditEvent = auditEvent; + } + + /** + * @return the audit event + */ + public AuditEvent getAuditEvent() { + return this.auditEvent; + } +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/listener/AuditListener.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/listener/AuditListener.java new file mode 100644 index 00000000000..8f1707c86f2 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/listener/AuditListener.java @@ -0,0 +1,47 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.audit.listener; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.context.ApplicationListener; +import org.springframework.zero.actuate.audit.AuditEvent; +import org.springframework.zero.actuate.audit.AuditEventRepository; + +/** + * {@link ApplicationListener} that listens for {@link AuditEvent}s and stores them in a + * {@link AuditEventRepository}. + * + * @author Dave Syer + */ +public class AuditListener implements ApplicationListener { + + private static Log logger = LogFactory.getLog(AuditListener.class); + + private final AuditEventRepository auditEventRepository; + + public AuditListener(AuditEventRepository auditEventRepository) { + this.auditEventRepository = auditEventRepository; + } + + @Override + public void onApplicationEvent(AuditApplicationEvent event) { + logger.info(event.getAuditEvent()); + this.auditEventRepository.add(event.getAuditEvent()); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/AuditAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/AuditAutoConfiguration.java new file mode 100644 index 00000000000..684c59fa102 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/AuditAutoConfiguration.java @@ -0,0 +1,68 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.audit.AuditEvent; +import org.springframework.zero.actuate.audit.AuditEventRepository; +import org.springframework.zero.actuate.audit.InMemoryAuditEventRepository; +import org.springframework.zero.actuate.audit.listener.AuditListener; +import org.springframework.zero.actuate.security.AuthenticationAuditListener; +import org.springframework.zero.actuate.security.AuthorizationAuditListener; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for {@link AuditEvent}s. + * + * @author Dave Syer + */ +@Configuration +public class AuditAutoConfiguration { + + @Autowired(required = false) + private AuditEventRepository auditEventRepository = new InMemoryAuditEventRepository(); + + @Bean + public AuditListener auditListener() throws Exception { + return new AuditListener(this.auditEventRepository); + } + + @Bean + @ConditionalOnClass(name = "org.springframework.security.authentication.event.AbstractAuthenticationEvent") + public AuthenticationAuditListener authenticationAuditListener() throws Exception { + return new AuthenticationAuditListener(); + } + + @Bean + @ConditionalOnClass(name = "org.springframework.security.access.event.AbstractAuthorizationEvent") + public AuthorizationAuditListener authorizationAuditListener() throws Exception { + return new AuthorizationAuditListener(); + } + + @ConditionalOnMissingBean(AuditEventRepository.class) + protected static class AuditEventRepositoryConfiguration { + @Bean + public AuditEventRepository auditEventRepository() throws Exception { + return new InMemoryAuditEventRepository(); + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointAutoConfiguration.java new file mode 100644 index 00000000000..83c6f531f7f --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointAutoConfiguration.java @@ -0,0 +1,203 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.autoconfigure; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Properties; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.StandardEnvironment; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PropertiesLoaderUtils; +import org.springframework.zero.actuate.endpoint.BeansEndpoint; +import org.springframework.zero.actuate.endpoint.DumpEndpoint; +import org.springframework.zero.actuate.endpoint.Endpoint; +import org.springframework.zero.actuate.endpoint.EnvironmentEndpoint; +import org.springframework.zero.actuate.endpoint.HealthEndpoint; +import org.springframework.zero.actuate.endpoint.InfoEndpoint; +import org.springframework.zero.actuate.endpoint.MetricsEndpoint; +import org.springframework.zero.actuate.endpoint.PublicMetrics; +import org.springframework.zero.actuate.endpoint.ShutdownEndpoint; +import org.springframework.zero.actuate.endpoint.TraceEndpoint; +import org.springframework.zero.actuate.endpoint.VanillaPublicMetrics; +import org.springframework.zero.actuate.health.HealthIndicator; +import org.springframework.zero.actuate.health.VanillaHealthIndicator; +import org.springframework.zero.actuate.metrics.InMemoryMetricRepository; +import org.springframework.zero.actuate.metrics.MetricRepository; +import org.springframework.zero.actuate.trace.InMemoryTraceRepository; +import org.springframework.zero.actuate.trace.TraceRepository; +import org.springframework.zero.bind.PropertiesConfigurationFactory; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for common management + * {@link Endpoint}s. + * + * @author Dave Syer + * @author Phillip Webb + */ +@Configuration +public class EndpointAutoConfiguration { + + @Autowired(required = false) + private HealthIndicator healthIndicator = new VanillaHealthIndicator(); + + @Autowired + private InfoPropertiesConfiguration properties; + + @Autowired(required = false) + private MetricRepository metricRepository = new InMemoryMetricRepository(); + + @Autowired(required = false) + private PublicMetrics metrics; + + @Autowired(required = false) + private TraceRepository traceRepository = new InMemoryTraceRepository(); + + @Bean + @ConditionalOnMissingBean + public EnvironmentEndpoint environmentEndpoint() { + return new EnvironmentEndpoint(); + } + + @Bean + @ConditionalOnMissingBean + public HealthEndpoint healthEndpoint() { + return new HealthEndpoint(this.healthIndicator); + } + + @Bean + @ConditionalOnMissingBean + public BeansEndpoint beansEndpoint() { + return new BeansEndpoint(); + } + + @Bean + @ConditionalOnMissingBean + public InfoEndpoint infoEndpoint() throws Exception { + LinkedHashMap info = new LinkedHashMap(); + info.putAll(this.properties.infoMap()); + GitInfo gitInfo = this.properties.gitInfo(); + if (gitInfo.getBranch() != null) { + info.put("git", gitInfo); + } + return new InfoEndpoint(info); + } + + @Bean + @ConditionalOnMissingBean + public MetricsEndpoint metricsEndpoint() { + if (this.metrics == null) { + this.metrics = new VanillaPublicMetrics(this.metricRepository); + } + return new MetricsEndpoint(this.metrics); + } + + @Bean + @ConditionalOnMissingBean + public TraceEndpoint traceEndpoint() { + return new TraceEndpoint(this.traceRepository); + } + + @Bean + @ConditionalOnMissingBean + public DumpEndpoint dumpEndpoint() { + return new DumpEndpoint(); + } + + @Bean + @ConditionalOnMissingBean + public ShutdownEndpoint shutdownEndpoint() { + return new ShutdownEndpoint(); + } + + @Configuration + protected static class InfoPropertiesConfiguration { + + @Autowired + private ConfigurableEnvironment environment = new StandardEnvironment(); + + @Value("${spring.git.properties:classpath:git.properties}") + private Resource gitProperties; + + public GitInfo gitInfo() throws Exception { + PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory( + new GitInfo()); + factory.setTargetName("git"); + Properties properties = new Properties(); + if (this.gitProperties.exists()) { + properties = PropertiesLoaderUtils.loadProperties(this.gitProperties); + } + factory.setProperties(properties); + return factory.getObject(); + } + + public Map infoMap() throws Exception { + PropertiesConfigurationFactory> factory = new PropertiesConfigurationFactory>( + new LinkedHashMap()); + factory.setTargetName("info"); + factory.setPropertySources(this.environment.getPropertySources()); + return factory.getObject(); + } + + } + + public static class GitInfo { + private String branch; + private Commit commit = new Commit(); + + public String getBranch() { + return this.branch; + } + + public void setBranch(String branch) { + this.branch = branch; + } + + public Commit getCommit() { + return this.commit; + } + + public static class Commit { + private String id; + private String time; + + public String getId() { + return this.id == null ? "" : (this.id.length() > 7 ? this.id.substring( + 0, 7) : this.id); + } + + public void setId(String id) { + this.id = id; + } + + public String getTime() { + return this.time; + } + + public void setTime(String time) { + this.time = time; + } + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java new file mode 100644 index 00000000000..f6535f3c4f6 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java @@ -0,0 +1,163 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import javax.servlet.Servlet; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.ApplicationListener; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.event.ContextClosedEvent; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.zero.actuate.endpoint.Endpoint; +import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerAdapter; +import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerMapping; +import org.springframework.zero.actuate.properties.ManagementServerProperties; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.zero.autoconfigure.web.WebMvcAutoConfiguration; +import org.springframework.zero.context.annotation.AutoConfigureAfter; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; +import org.springframework.zero.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; +import org.springframework.zero.properties.ServerProperties; + +/** + * {@link EnableAutoConfiguration Auto-configuration} to enable Spring MVC to handle + * {@link Endpoint} requests. If the {@link ManagementServerProperties} specifies a + * different port to {@link ServerProperties} a new child context is created, otherwise it + * is assumed that endpoint requests will be mapped and handled via an already registered + * {@link DispatcherServlet}. + * + * @author Dave Syer + * @author Phillip Webb + */ +@Configuration +@ConditionalOnClass({ Servlet.class, DispatcherServlet.class }) +@AutoConfigureAfter({ PropertyPlaceholderAutoConfiguration.class, + EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class, + ManagementServerPropertiesAutoConfiguration.class }) +public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, + ApplicationListener { + + private static final Integer DISABLED_PORT = Integer.valueOf(0); + + private ApplicationContext applicationContext; + + @Autowired(required = false) + private ServerProperties serverProperties = new ServerProperties(); + + @Autowired(required = false) + private ManagementServerProperties managementServerProperties = new ManagementServerProperties(); + + @Bean + @ConditionalOnMissingBean + public EndpointHandlerMapping endpointHandlerMapping() { + EndpointHandlerMapping mapping = new EndpointHandlerMapping(); + mapping.setDisabled(ManagementServerPort.get(this.applicationContext) != ManagementServerPort.SAME); + mapping.setPrefix(this.managementServerProperties.getContextPath()); + return mapping; + } + + @Bean + @ConditionalOnMissingBean + public EndpointHandlerAdapter endpointHandlerAdapter() { + return new EndpointHandlerAdapter(); + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + this.applicationContext = applicationContext; + } + + @Override + public void onApplicationEvent(ContextRefreshedEvent event) { + if (event.getApplicationContext() == this.applicationContext) { + if (ManagementServerPort.get(this.applicationContext) == ManagementServerPort.DIFFERENT) { + createChildManagementContext(); + } + } + } + + private void createChildManagementContext() { + + final AnnotationConfigEmbeddedWebApplicationContext childContext = new AnnotationConfigEmbeddedWebApplicationContext(); + childContext.setParent(this.applicationContext); + childContext.setId(this.applicationContext.getId() + ":management"); + + // Register the ManagementServerChildContextConfiguration first followed + // by various specific AutoConfiguration classes. NOTE: The child context + // is intentionally not completely auto-configured. + childContext.register(EndpointWebMvcChildContextConfiguration.class, + PropertyPlaceholderAutoConfiguration.class, + EmbeddedServletContainerAutoConfiguration.class); + + // 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(); + } + } + }); + } + childContext.refresh(); + } + + private enum ManagementServerPort { + + DISABLE, SAME, DIFFERENT; + + public static ManagementServerPort get(BeanFactory beanFactory) { + + ServerProperties serverProperties; + try { + serverProperties = beanFactory.getBean(ServerProperties.class); + } catch (NoSuchBeanDefinitionException ex) { + serverProperties = new ServerProperties(); + } + + ManagementServerProperties managementServerProperties; + try { + managementServerProperties = beanFactory + .getBean(ManagementServerProperties.class); + } catch (NoSuchBeanDefinitionException ex) { + managementServerProperties = new ManagementServerProperties(); + } + + if (DISABLED_PORT.equals(managementServerProperties.getPort())) { + return DISABLE; + } + return managementServerProperties.getPort() == null + || serverProperties.getPort() == managementServerProperties.getPort() ? SAME + : DIFFERENT; + } + }; +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java new file mode 100644 index 00000000000..4f65cc2d653 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java @@ -0,0 +1,98 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.autoconfigure; + +import javax.servlet.Filter; + +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.HierarchicalBeanFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.web.servlet.HandlerAdapter; +import org.springframework.web.servlet.HandlerMapping; +import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerAdapter; +import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerMapping; +import org.springframework.zero.actuate.properties.ManagementServerProperties; +import org.springframework.zero.context.annotation.ConditionalOnBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.EmbeddedServletContainer; +import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer; + +/** + * Configuration for triggered from {@link EndpointWebMvcAutoConfiguration} when a new + * {@link EmbeddedServletContainer} running on a different port is required. + * + * @see EndpointWebMvcAutoConfiguration + */ +@Configuration +public class EndpointWebMvcChildContextConfiguration implements + EmbeddedServletContainerCustomizer { + + @Autowired + private ManagementServerProperties managementServerProperties; + + @Override + public void customize(ConfigurableEmbeddedServletContainerFactory factory) { + factory.setPort(this.managementServerProperties.getPort()); + factory.setAddress(this.managementServerProperties.getAddress()); + factory.setContextPath(this.managementServerProperties.getContextPath()); + } + + @Bean + public DispatcherServlet dispatcherServlet() { + DispatcherServlet dispatcherServlet = new DispatcherServlet(); + + // Ensure the parent configuration does not leak down to us + dispatcherServlet.setDetectAllHandlerAdapters(false); + dispatcherServlet.setDetectAllHandlerExceptionResolvers(false); + dispatcherServlet.setDetectAllHandlerMappings(false); + dispatcherServlet.setDetectAllViewResolvers(false); + + return dispatcherServlet; + } + + @Bean + public HandlerMapping handlerMapping() { + return new EndpointHandlerMapping(); + } + + @Bean + public HandlerAdapter handlerAdapter() { + return new EndpointHandlerAdapter(); + } + + @Configuration + @ConditionalOnClass({ EnableWebSecurity.class, Filter.class }) + public static class EndpointWebMvcChildContextSecurityConfiguration { + + // FIXME reuse of security filter here is not good. What if totally different + // security config is required. Perhaps we can just drop it on the management + // port? + + @Bean + @ConditionalOnBean(name = "springSecurityFilterChain") + public Filter springSecurityFilterChain(HierarchicalBeanFactory beanFactory) { + BeanFactory parent = beanFactory.getParentBeanFactory(); + return parent.getBean("springSecurityFilterChain", Filter.class); + } + + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ErrorMvcAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ErrorMvcAutoConfiguration.java new file mode 100644 index 00000000000..ff9a434384a --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ErrorMvcAutoConfiguration.java @@ -0,0 +1,56 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import javax.servlet.Servlet; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.zero.actuate.web.BasicErrorController; +import org.springframework.zero.actuate.web.ErrorController; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; +import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer; +import org.springframework.zero.context.embedded.ErrorPage; + +/** + * {@link EnableAutoConfiguration Auto-configuration} to render errors via a MVC error + * controller. + * + * @author Dave Syer + */ +@ConditionalOnClass({ Servlet.class, DispatcherServlet.class }) +public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustomizer { + + @Value("${error.path:/error}") + private String errorPath = "/error"; + + @Bean + @ConditionalOnMissingBean(ErrorController.class) + public BasicErrorController basicErrorController() { + return new BasicErrorController(); + } + + @Override + public void customize(ConfigurableEmbeddedServletContainerFactory factory) { + factory.addErrorPages(new ErrorPage(this.errorPath)); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java new file mode 100644 index 00000000000..903abcc8bcc --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java @@ -0,0 +1,44 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.autoconfigure; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.properties.ManagementServerProperties; +import org.springframework.zero.autoconfigure.web.ServerPropertiesAutoConfiguration; +import org.springframework.zero.context.annotation.AutoConfigureAfter; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for the + * {@link ManagementServerPropertiesAutoConfiguration} bean. + * + * @author Dave Syer + */ +@Configuration +@AutoConfigureAfter(ServerPropertiesAutoConfiguration.class) +@EnableConfigurationProperties +public class ManagementServerPropertiesAutoConfiguration { + + @Bean(name = "org.springframework.zero.actuate.properties.ManagementServerProperties") + @ConditionalOnMissingBean + public ManagementServerProperties serverProperties() { + return new ManagementServerProperties(); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfiguration.java new file mode 100644 index 00000000000..0cb300d5484 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfiguration.java @@ -0,0 +1,131 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.Servlet; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.util.StopWatch; +import org.springframework.web.filter.GenericFilterBean; +import org.springframework.web.util.UrlPathHelper; +import org.springframework.zero.actuate.metrics.CounterService; +import org.springframework.zero.actuate.metrics.GaugeService; +import org.springframework.zero.context.annotation.AutoConfigureAfter; +import org.springframework.zero.context.annotation.ConditionalOnBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} that records Servlet interactions + * with a {@link CounterService} and {@link GaugeService}. + * + * @author Dave Syer + * @author Phillip Webb + */ +@Configuration +@ConditionalOnBean({ CounterService.class, GaugeService.class }) +@ConditionalOnClass({ Servlet.class }) +@AutoConfigureAfter(MetricRepositoryAutoConfiguration.class) +public class MetricFilterAutoConfiguration { + + private static final int UNDEFINED_HTTP_STATUS = 999; + + @Autowired + private CounterService counterService; + + @Autowired + private GaugeService gaugeService; + + @Bean + public Filter metricFilter() { + return new MetricsFilter(); + } + + /** + * Filter that counts requests and measures processing times. + */ + @Order(Ordered.HIGHEST_PRECEDENCE) + private final class MetricsFilter extends GenericFilterBean { + + // FIXME parameterize the order (ideally it runs before any other filter) + + @Override + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + if ((request instanceof HttpServletRequest) + && (response instanceof HttpServletResponse)) { + doFilter((HttpServletRequest) request, (HttpServletResponse) response, + chain); + } else { + chain.doFilter(request, response); + } + } + + public void doFilter(HttpServletRequest request, HttpServletResponse response, + FilterChain chain) throws IOException, ServletException { + UrlPathHelper helper = new UrlPathHelper(); + String suffix = helper.getPathWithinApplication(request); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + try { + chain.doFilter(request, response); + } finally { + stopWatch.stop(); + String gaugeKey = getKey("response" + suffix); + MetricFilterAutoConfiguration.this.gaugeService.set(gaugeKey, + stopWatch.getTotalTimeMillis()); + String counterKey = getKey("status." + getStatus(response) + suffix); + MetricFilterAutoConfiguration.this.counterService.increment(counterKey); + } + } + + private int getStatus(HttpServletResponse response) { + try { + return response.getStatus(); + } catch (Exception e) { + return UNDEFINED_HTTP_STATUS; + } + } + + private String getKey(String string) { + // graphite compatible metric names + String value = string.replace("/", "."); + value = value.replace("..", "."); + if (value.endsWith(".")) { + value = value + "root"; + } + if (value.startsWith("_")) { + value = value.substring(1); + } + return value; + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java new file mode 100644 index 00000000000..be5764a8de8 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java @@ -0,0 +1,56 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.metrics.CounterService; +import org.springframework.zero.actuate.metrics.DefaultCounterService; +import org.springframework.zero.actuate.metrics.DefaultGaugeService; +import org.springframework.zero.actuate.metrics.GaugeService; +import org.springframework.zero.actuate.metrics.InMemoryMetricRepository; +import org.springframework.zero.actuate.metrics.MetricRepository; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for metrics services. + * + * @author Dave Syer + */ +@Configuration +public class MetricRepositoryAutoConfiguration { + + @Bean + @ConditionalOnMissingBean + public CounterService counterService() { + return new DefaultCounterService(metricRepository()); + } + + @Bean + @ConditionalOnMissingBean + public GaugeService gaugeService() { + return new DefaultGaugeService(metricRepository()); + } + + @Bean + @ConditionalOnMissingBean + protected MetricRepository metricRepository() { + return new InMemoryMetricRepository(); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfiguration.java new file mode 100644 index 00000000000..8ffe02d6cbe --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfiguration.java @@ -0,0 +1,219 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.security.authentication.AuthenticationEventPublisher; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.DefaultAuthenticationEventPublisher; +import org.springframework.security.authentication.ProviderManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity.IgnoredRequestConfigurer; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint; +import org.springframework.zero.actuate.endpoint.Endpoint; +import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerMapping; +import org.springframework.zero.actuate.properties.SecurityProperties; +import org.springframework.zero.actuate.web.ErrorController; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for security of a web application or + * service. By default everything is secured with HTTP Basic authentication except the + * {@link SecurityProperties#getIgnored() explicitly ignored} paths (defaults to + * /css/**, /js/**, /images/**, /**/favicon.ico + * ). Many aspects of the behavior can be controller with {@link SecurityProperties} via + * externalized application properties (or via an bean definition of that type to set the + * defaults). The user details for authentication are just placeholders + * (username=user, + * password=password) but can easily be customized by providing a bean definition + * of type {@link AuthenticationManager}. Also provides audit logging of authentication + * events. + * + *

+ * The framework {@link Endpoint}s (used to expose application information to operations) + * include a {@link Endpoint#isSensitive() sensitive} configuration option which will be + * used as a security hint by the filter created here. + * + *

+ * Some common simple customizations: + *

    + *
  • Switch off security completely and permanently: remove Spring Security from the + * classpath or {@link EnableAutoConfiguration#exclude() exclude} this configuration.
  • + *
  • Switch off security temporarily (e.g. for a dev environment): set + * security.basic.enabled: false
  • + *
  • Customize the user details: add an AuthenticationManager bean
  • + *
  • Add form login for user facing resources: add a + * {@link WebSecurityConfigurerAdapter} and use {@link HttpSecurity#formLogin()}
  • + *
+ * + * @author Dave Syer + */ +@Configuration +@ConditionalOnClass({ EnableWebSecurity.class }) +@EnableWebSecurity +@EnableConfigurationProperties +public class SecurityAutoConfiguration { + + @Bean(name = "org.springframework.zero.actuate.properties.SecurityProperties") + @ConditionalOnMissingBean + public SecurityProperties securityProperties() { + return new SecurityProperties(); + } + + @Bean + @ConditionalOnMissingBean + public AuthenticationEventPublisher authenticationEventPublisher() { + return new DefaultAuthenticationEventPublisher(); + } + + @Bean + @ConditionalOnMissingBean({ BoostrapWebSecurityConfigurerAdapter.class }) + public WebSecurityConfigurerAdapter webSecurityConfigurerAdapter() { + return new BoostrapWebSecurityConfigurerAdapter(); + } + + // Give user-supplied filters a chance to be last in line + @Order(Ordered.LOWEST_PRECEDENCE - 10) + private static class BoostrapWebSecurityConfigurerAdapter extends + WebSecurityConfigurerAdapter { + + private static final String[] NO_PATHS = new String[0]; + + @Autowired + private SecurityProperties security; + + @Autowired(required = false) + private EndpointHandlerMapping endpointHandlerMapping; + + @Autowired + private AuthenticationEventPublisher authenticationEventPublisher; + + @Autowired(required = false) + private ErrorController errorController; + + @Override + protected void configure(HttpSecurity http) throws Exception { + + if (this.security.isRequireSsl()) { + http.requiresChannel().anyRequest().requiresSecure(); + } + + if (this.security.getBasic().isEnabled()) { + String[] paths = getSecurePaths(); + http.exceptionHandling().authenticationEntryPoint(entryPoint()).and() + .requestMatchers().antMatchers(paths); + http.httpBasic().and().anonymous().disable(); + http.authorizeUrls().anyRequest() + .hasRole(this.security.getBasic().getRole()); + } + + // No cookies for service endpoints by default + http.sessionManagement().sessionCreationPolicy(this.security.getSessions()); + } + + private String[] getSecurePaths() { + List list = new ArrayList(); + for (String path : this.security.getBasic().getPath()) { + path = (path == null ? "" : path.trim()); + if (path.equals("/**")) { + return new String[] { path }; + } + if (!path.equals("")) { + list.add(path); + } + } + // FIXME makes more sense to secure endpoints with a different role + list.addAll(Arrays.asList(getEndpointPaths(true))); + return list.toArray(new String[list.size()]); + } + + private AuthenticationEntryPoint entryPoint() { + BasicAuthenticationEntryPoint entryPoint = new BasicAuthenticationEntryPoint(); + entryPoint.setRealmName(this.security.getBasic().getRealm()); + return entryPoint; + } + + @Override + public void configure(WebSecurity builder) throws Exception { + IgnoredRequestConfigurer ignoring = builder.ignoring(); + ignoring.antMatchers(this.security.getIgnored()); + ignoring.antMatchers(getEndpointPaths(false)); + if (this.errorController != null) { + ignoring.antMatchers(this.errorController.getErrorPath()); + } + } + + private String[] getEndpointPaths(boolean secure) { + if (this.endpointHandlerMapping == null) { + return NO_PATHS; + } + + // FIXME this will still open up paths on the server when a management port is + // being used. + + List> endpoints = this.endpointHandlerMapping.getEndpoints(); + List paths = new ArrayList(endpoints.size()); + for (Endpoint endpoint : endpoints) { + if (endpoint.isSensitive() == secure) { + paths.add(endpoint.getPath()); + } + } + return paths.toArray(new String[paths.size()]); + } + + @Override + protected AuthenticationManager authenticationManager() throws Exception { + AuthenticationManager manager = super.authenticationManager(); + if (manager instanceof ProviderManager) { + ((ProviderManager) manager) + .setAuthenticationEventPublisher(this.authenticationEventPublisher); + } + return manager; + } + + } + + @ConditionalOnMissingBean(AuthenticationManager.class) + @Configuration + public static class AuthenticationManagerConfiguration { + + @Bean + public AuthenticationManager authenticationManager() throws Exception { + return new AuthenticationManagerBuilder().inMemoryAuthentication() + .withUser("user").password("password").roles("USER").and().and() + .build(); + } + + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java new file mode 100644 index 00000000000..d391aef36b1 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java @@ -0,0 +1,40 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.trace.InMemoryTraceRepository; +import org.springframework.zero.actuate.trace.TraceRepository; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for {@link TraceRepository tracing}. + * + * @author Dave Syer + */ +@Configuration +public class TraceRepositoryAutoConfiguration { + + @ConditionalOnMissingBean + @Bean + public TraceRepository traceRepository() { + return new InMemoryTraceRepository(); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java new file mode 100644 index 00000000000..d826886aae1 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java @@ -0,0 +1,54 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.autoconfigure; + +import javax.servlet.Servlet; + +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.zero.actuate.trace.TraceRepository; +import org.springframework.zero.actuate.trace.WebRequestTraceFilter; +import org.springframework.zero.context.annotation.AutoConfigureAfter; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for {@link WebRequestTraceFilter + * tracing}. + * + * @author Dave Syer + */ +@ConditionalOnClass({ Servlet.class, DispatcherServlet.class }) +@AutoConfigureAfter(TraceRepositoryAutoConfiguration.class) +public class TraceWebFilterAutoConfiguration { + + @Autowired + private TraceRepository traceRepository; + + @Value("${management.dump_requests:false}") + private boolean dumpRequests; + + @Bean + public WebRequestTraceFilter webRequestLoggingFilter(BeanFactory beanFactory) { + WebRequestTraceFilter filter = new WebRequestTraceFilter(this.traceRepository); + filter.setDumpRequests(this.dumpRequests); + return filter; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/AbstractEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/AbstractEndpoint.java new file mode 100644 index 00000000000..7294fbfaded --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/AbstractEndpoint.java @@ -0,0 +1,71 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; + +import org.springframework.http.MediaType; + +/** + * Abstract base for {@link Endpoint} implementations. + * + * @author Phillip Webb + */ +public abstract class AbstractEndpoint implements Endpoint { + + private static final MediaType[] NO_MEDIA_TYPES = new MediaType[0]; + + @NotNull + @Pattern(regexp = "/[^/]*", message = "Path must start with /") + private String path; + + private boolean sensitive; + + public AbstractEndpoint(String path) { + this(path, true); + } + + public AbstractEndpoint(String path, boolean sensitive) { + this.path = path; + this.sensitive = sensitive; + } + + @Override + public String getPath() { + return this.path; + } + + public void setPath(String path) { + this.path = path; + } + + @Override + public boolean isSensitive() { + return this.sensitive; + } + + public void setSensitive(boolean sensitive) { + this.sensitive = sensitive; + } + + @Override + public MediaType[] getProduces() { + return NO_MEDIA_TYPES; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ActionEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ActionEndpoint.java new file mode 100644 index 00000000000..373e99fa40d --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ActionEndpoint.java @@ -0,0 +1,27 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +/** + * Tagging interface used to indicate that {@link Endpoint} that performs some action. + * Allows mappings to refine the types of request supported. + * + * @author Phillip Webb + */ +public interface ActionEndpoint extends Endpoint { + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/BeansEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/BeansEndpoint.java new file mode 100644 index 00000000000..8669b4074ce --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/BeansEndpoint.java @@ -0,0 +1,62 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.support.LiveBeansView; +import org.springframework.core.env.Environment; +import org.springframework.http.MediaType; +import org.springframework.zero.context.annotation.ConfigurationProperties; + +/** + * Exposes JSON view of Spring beans. If the {@link Environment} contains a key setting + * the {@link LiveBeansView#MBEAN_DOMAIN_PROPERTY_NAME} then all application contexts in + * the JVM will be shown (and the corresponding MBeans will be registered per the standard + * behavior of LiveBeansView). Otherwise only the current application context. + * + * @author Dave Syer + */ +@ConfigurationProperties(name = "endpoints.beans", ignoreUnknownFields = false) +public class BeansEndpoint extends AbstractEndpoint implements + ApplicationContextAware { + + private LiveBeansView liveBeansView = new LiveBeansView(); + + public BeansEndpoint() { + super("/beans"); + } + + @Override + public void setApplicationContext(ApplicationContext context) throws BeansException { + if (context.getEnvironment() + .getProperty(LiveBeansView.MBEAN_DOMAIN_PROPERTY_NAME) == null) { + this.liveBeansView.setApplicationContext(context); + } + } + + @Override + public MediaType[] getProduces() { + return new MediaType[] { MediaType.APPLICATION_JSON }; + } + + @Override + public String invoke() { + return this.liveBeansView.getSnapshotAsJson(); + } +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/DumpEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/DumpEndpoint.java new file mode 100644 index 00000000000..72c0265f983 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/DumpEndpoint.java @@ -0,0 +1,47 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.lang.management.ManagementFactory; +import java.lang.management.ThreadInfo; +import java.util.Arrays; +import java.util.List; + +import org.springframework.zero.context.annotation.ConfigurationProperties; + +/** + * {@link Endpoint} to expose thread info. + * + * @author Dave Syer + */ +@ConfigurationProperties(name = "endpoints.dump", ignoreUnknownFields = false) +public class DumpEndpoint extends AbstractEndpoint> { + + /** + * Create a new {@link DumpEndpoint} instance. + */ + public DumpEndpoint() { + super("/dump"); + } + + @Override + public List invoke() { + return Arrays.asList(ManagementFactory.getThreadMXBean().dumpAllThreads(true, + true)); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/Endpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/Endpoint.java new file mode 100644 index 00000000000..fde590ffd44 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/Endpoint.java @@ -0,0 +1,53 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import org.springframework.http.MediaType; + +/** + * An endpoint that can be used to expose useful information to operations. Usually + * exposed via Spring MVC but could also be exposed using some other technique. + * + * @author Phillip Webb + * @author Dave Syer + */ +public interface Endpoint { + + /** + * Returns the path of the endpoint. Must start with '/' and should not include + * wildcards. + */ + String getPath(); + + /** + * Returns if the endpoint is sensitive, i.e. may return data that the average user + * should not see. Mappings can use this as a security hint. + */ + boolean isSensitive(); + + /** + * Returns the {@link MediaType}s that this endpoint produces or {@code null}. + */ + MediaType[] getProduces(); + + /** + * Called to invoke the endpoint. + * @return the results of the invocation + */ + T invoke(); + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/EnvironmentEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/EnvironmentEndpoint.java new file mode 100644 index 00000000000..4c9eb08f0dc --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/EnvironmentEndpoint.java @@ -0,0 +1,86 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.springframework.context.EnvironmentAware; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.EnumerablePropertySource; +import org.springframework.core.env.Environment; +import org.springframework.core.env.PropertySource; +import org.springframework.core.env.StandardEnvironment; +import org.springframework.zero.context.annotation.ConfigurationProperties; + +/** + * {@link Endpoint} to expose {@link ConfigurableEnvironment environment} information. + * + * @author Dave Syer + * @author Phillip Webb + */ +@ConfigurationProperties(name = "endpoints.env", ignoreUnknownFields = false) +public class EnvironmentEndpoint extends AbstractEndpoint> implements + EnvironmentAware { + + private Environment environment; + + /** + * Create a new {@link EnvironmentEndpoint} instance. + */ + public EnvironmentEndpoint() { + super("/env"); + } + + @Override + public Map invoke() { + Map result = new LinkedHashMap(); + for (PropertySource source : getPropertySources()) { + if (source instanceof EnumerablePropertySource) { + EnumerablePropertySource enumerable = (EnumerablePropertySource) source; + Map map = new LinkedHashMap(); + for (String name : enumerable.getPropertyNames()) { + map.put(name, sanitize(name, enumerable.getProperty(name))); + } + result.put(source.getName(), map); + } + } + return result; + } + + private Iterable> getPropertySources() { + if (this.environment != null + && this.environment instanceof ConfigurableEnvironment) { + return ((ConfigurableEnvironment) this.environment).getPropertySources(); + } + return new StandardEnvironment().getPropertySources(); + } + + private Object sanitize(String name, Object object) { + if (name.toLowerCase().endsWith("password") + || name.toLowerCase().endsWith("secret")) { + return object == null ? null : "******"; + } + return object; + } + + @Override + public void setEnvironment(Environment environment) { + this.environment = environment; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/HealthEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/HealthEndpoint.java new file mode 100644 index 00000000000..62d25899eab --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/HealthEndpoint.java @@ -0,0 +1,49 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import org.springframework.util.Assert; +import org.springframework.zero.actuate.health.HealthIndicator; +import org.springframework.zero.context.annotation.ConfigurationProperties; + +/** + * {@link Endpoint} to expose application health. + * + * @author Dave Syer + */ +@ConfigurationProperties(name = "endpoints.health", ignoreUnknownFields = false) +public class HealthEndpoint extends AbstractEndpoint { + + private HealthIndicator indicator; + + /** + * Create a new {@link HealthIndicator} instance. + * + * @param indicator the health indicator + */ + public HealthEndpoint(HealthIndicator indicator) { + super("/health", false); + Assert.notNull(indicator, "Indicator must not be null"); + this.indicator = indicator; + } + + @Override + public T invoke() { + return this.indicator.health(); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/InfoEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/InfoEndpoint.java new file mode 100644 index 00000000000..958c64a2dd0 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/InfoEndpoint.java @@ -0,0 +1,58 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.springframework.util.Assert; +import org.springframework.zero.context.annotation.ConfigurationProperties; + +/** + * {@link Endpoint} to expose arbitrary application information. + * + * @author Dave Syer + */ +@ConfigurationProperties(name = "endpoints.info", ignoreUnknownFields = false) +public class InfoEndpoint extends AbstractEndpoint> { + + private Map info; + + /** + * Create a new {@link InfoEndpoint} instance. + * + * @param info the info to expose + */ + public InfoEndpoint(Map info) { + super("/info", true); + Assert.notNull(info, "Info must not be null"); + this.info = info; + } + + @Override + public Map invoke() { + Map info = new LinkedHashMap(this.info); + info.putAll(getAdditionalInfo()); + return info; + } + + protected Map getAdditionalInfo() { + return Collections.emptyMap(); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/MetricsEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/MetricsEndpoint.java new file mode 100644 index 00000000000..91431e8185c --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/MetricsEndpoint.java @@ -0,0 +1,56 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.springframework.util.Assert; +import org.springframework.zero.actuate.metrics.Metric; +import org.springframework.zero.context.annotation.ConfigurationProperties; + +/** + * {@link Endpoint} to expose {@link PublicMetrics}. + * + * @author Dave Syer + */ +@ConfigurationProperties(name = "endpoints.metrics", ignoreUnknownFields = false) +public class MetricsEndpoint extends AbstractEndpoint> { + + private PublicMetrics metrics; + + /** + * Create a new {@link MetricsEndpoint} instance. + * + * @param metrics the metrics to expose + */ + public MetricsEndpoint(PublicMetrics metrics) { + super("/metrics"); + Assert.notNull(metrics, "Metrics must not be null"); + this.metrics = metrics; + } + + @Override + public Map invoke() { + Map result = new LinkedHashMap(); + for (Metric metric : this.metrics.metrics()) { + result.put(metric.getName(), metric.getValue()); + } + return result; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/PublicMetrics.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/PublicMetrics.java new file mode 100644 index 00000000000..fa6101321a6 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/PublicMetrics.java @@ -0,0 +1,36 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.Collection; + +import org.springframework.zero.actuate.metrics.Metric; + +/** + * Interface to expose specific {@link Metric}s via a {@link MetricsEndpoint}. + * + * @author Dave Syer + * @see VanillaPublicMetrics + */ +public interface PublicMetrics { + + /** + * @return an indication of current state through metrics + */ + Collection metrics(); + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ShutdownEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ShutdownEndpoint.java new file mode 100644 index 00000000000..05428e21595 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ShutdownEndpoint.java @@ -0,0 +1,81 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.Collections; +import java.util.Map; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.zero.actuate.properties.ManagementServerProperties; +import org.springframework.zero.context.annotation.ConfigurationProperties; + +/** + * {@link ActionEndpoint} to shutdown the {@link ApplicationContext}. + * + * @author Dave Syer + */ +@ConfigurationProperties(name = "endpoints.shutdown", ignoreUnknownFields = false) +public class ShutdownEndpoint extends AbstractEndpoint> implements + ApplicationContextAware, ActionEndpoint> { + + private ConfigurableApplicationContext context; + + @Autowired(required = false) + private ManagementServerProperties configuration = new ManagementServerProperties(); + + /** + * Create a new {@link ShutdownEndpoint} instance. + */ + public ShutdownEndpoint() { + super("/shutdown"); + } + + @Override + public Map invoke() { + if (this.configuration == null || !this.configuration.isAllowShutdown() + || this.context == null) { + return Collections. singletonMap("message", + "Shutdown not enabled, sorry."); + } + + new Thread(new Runnable() { + @Override + public void run() { + try { + Thread.sleep(500L); + } catch (InterruptedException e) { + } + ShutdownEndpoint.this.context.close(); + } + }).start(); + + return Collections. singletonMap("message", + "Shutting down, bye..."); + } + + @Override + public void setApplicationContext(ApplicationContext context) throws BeansException { + if (context instanceof ConfigurableApplicationContext) { + this.context = (ConfigurableApplicationContext) context; + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/TraceEndpoint.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/TraceEndpoint.java new file mode 100644 index 00000000000..8321d4ea0d9 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/TraceEndpoint.java @@ -0,0 +1,51 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.List; + +import org.springframework.util.Assert; +import org.springframework.zero.actuate.trace.Trace; +import org.springframework.zero.actuate.trace.TraceRepository; +import org.springframework.zero.context.annotation.ConfigurationProperties; + +/** + * {@link Endpoint} to expose {@link Trace} information. + * + * @author Dave Syer + */ +@ConfigurationProperties(name = "endpoints.trace", ignoreUnknownFields = false) +public class TraceEndpoint extends AbstractEndpoint> { + + private TraceRepository repository; + + /** + * Create a new {@link TraceEndpoint} instance. + * + * @param repository the trace repository + */ + public TraceEndpoint(TraceRepository repository) { + super("/trace"); + Assert.notNull(repository, "Repository must not be null"); + this.repository = repository; + } + + @Override + public List invoke() { + return this.repository.findAll(); + } +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/VanillaPublicMetrics.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/VanillaPublicMetrics.java new file mode 100644 index 00000000000..b2f3dab66eb --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/VanillaPublicMetrics.java @@ -0,0 +1,52 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.Collection; +import java.util.LinkedHashSet; + +import org.springframework.util.Assert; +import org.springframework.zero.actuate.metrics.Metric; +import org.springframework.zero.actuate.metrics.MetricRepository; + +/** + * Default implementation of {@link PublicMetrics} that exposes all metrics from the + * {@link MetricRepository} along with memory information. + * + * @author Dave Syer + */ +public class VanillaPublicMetrics implements PublicMetrics { + + private MetricRepository metricRepository; + + public VanillaPublicMetrics(MetricRepository metricRepository) { + Assert.notNull(metricRepository, "MetricRepository must not be null"); + this.metricRepository = metricRepository; + } + + @Override + public Collection metrics() { + Collection result = new LinkedHashSet( + this.metricRepository.findAll()); + result.add(new Metric("mem", new Long(Runtime.getRuntime().totalMemory()) / 1024)); + result.add(new Metric("mem.free", + new Long(Runtime.getRuntime().freeMemory()) / 1024)); + result.add(new Metric("processors", Runtime.getRuntime().availableProcessors())); + return result; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapter.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapter.java new file mode 100644 index 00000000000..19b7468b4a1 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapter.java @@ -0,0 +1,225 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint.mvc; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.http.server.ServletServerHttpResponse; +import org.springframework.web.HttpMediaTypeNotAcceptableException; +import org.springframework.web.accept.ContentNegotiationManager; +import org.springframework.web.context.request.ServletWebRequest; +import org.springframework.web.servlet.HandlerAdapter; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; +import org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor; +import org.springframework.zero.actuate.endpoint.Endpoint; + +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * MVC {@link HandlerAdapter} for {@link Endpoint}s. Similar in may respects to + * {@link AbstractMessageConverterMethodProcessor} but not tied to annotated methods. + * + * @author Phillip Webb + * @see EndpointHandlerMapping + */ +public class EndpointHandlerAdapter implements HandlerAdapter { + + private static final Log logger = LogFactory.getLog(EndpointHandlerAdapter.class); + + private static final MediaType MEDIA_TYPE_APPLICATION = new MediaType("application"); + + private ContentNegotiationManager contentNegotiationManager = new ContentNegotiationManager(); + + private List> messageConverters; + + private List allSupportedMediaTypes; + + public EndpointHandlerAdapter() { + WebMvcConfigurationSupportConventions conventions = new WebMvcConfigurationSupportConventions(); + setMessageConverters(conventions.getDefaultHttpMessageConverters()); + } + + @Override + public boolean supports(Object handler) { + return handler instanceof Endpoint; + } + + @Override + public long getLastModified(HttpServletRequest request, Object handler) { + return -1; + } + + @Override + public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, + Object handler) throws Exception { + handle(request, response, (Endpoint) handler); + return null; + } + + @SuppressWarnings("unchecked") + private void handle(HttpServletRequest request, HttpServletResponse response, + Endpoint endpoint) throws Exception { + + Object result = endpoint.invoke(); + Class resultClass = result.getClass(); + + List mediaTypes = getMediaTypes(request, endpoint, resultClass); + MediaType selectedMediaType = selectMediaType(mediaTypes); + + ServletServerHttpResponse outputMessage = new ServletServerHttpResponse(response); + try { + if (selectedMediaType != null) { + selectedMediaType = selectedMediaType.removeQualityValue(); + for (HttpMessageConverter messageConverter : this.messageConverters) { + if (messageConverter.canWrite(resultClass, selectedMediaType)) { + ((HttpMessageConverter) messageConverter).write(result, + selectedMediaType, outputMessage); + if (logger.isDebugEnabled()) { + logger.debug("Written [" + result + "] as \"" + + selectedMediaType + "\" using [" + messageConverter + + "]"); + } + return; + } + } + } + throw new HttpMediaTypeNotAcceptableException(this.allSupportedMediaTypes); + } finally { + outputMessage.close(); + } + } + + private List getMediaTypes(HttpServletRequest request, + Endpoint endpoint, Class resultClass) + throws HttpMediaTypeNotAcceptableException { + List requested = getAcceptableMediaTypes(request); + List producible = getProducibleMediaTypes(endpoint, resultClass); + + Set compatible = new LinkedHashSet(); + for (MediaType r : requested) { + for (MediaType p : producible) { + if (r.isCompatibleWith(p)) { + compatible.add(getMostSpecificMediaType(r, p)); + } + } + } + if (compatible.isEmpty()) { + throw new HttpMediaTypeNotAcceptableException(producible); + } + List mediaTypes = new ArrayList(compatible); + MediaType.sortBySpecificityAndQuality(mediaTypes); + return mediaTypes; + } + + private List getAcceptableMediaTypes(HttpServletRequest request) + throws HttpMediaTypeNotAcceptableException { + List mediaTypes = this.contentNegotiationManager + .resolveMediaTypes(new ServletWebRequest(request)); + return mediaTypes.isEmpty() ? Collections.singletonList(MediaType.ALL) + : mediaTypes; + } + + private List getProducibleMediaTypes(Endpoint endpoint, + Class returnValueClass) { + MediaType[] mediaTypes = endpoint.getProduces(); + if (mediaTypes != null && mediaTypes.length != 0) { + return Arrays.asList(mediaTypes); + } + + if (this.allSupportedMediaTypes.isEmpty()) { + return Collections.singletonList(MediaType.ALL); + } + + List result = new ArrayList(); + for (HttpMessageConverter converter : this.messageConverters) { + if (converter.canWrite(returnValueClass, null)) { + result.addAll(converter.getSupportedMediaTypes()); + } + } + return result; + } + + private MediaType getMostSpecificMediaType(MediaType acceptType, MediaType produceType) { + produceType = produceType.copyQualityValue(acceptType); + return MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceType) <= 0 ? acceptType + : produceType; + } + + private MediaType selectMediaType(List mediaTypes) { + MediaType selectedMediaType = null; + for (MediaType mediaType : mediaTypes) { + if (mediaType.isConcrete()) { + selectedMediaType = mediaType; + break; + } else if (mediaType.equals(MediaType.ALL) + || mediaType.equals(MEDIA_TYPE_APPLICATION)) { + selectedMediaType = MediaType.APPLICATION_OCTET_STREAM; + break; + } + } + return selectedMediaType; + } + + public void setContentNegotiationManager( + ContentNegotiationManager contentNegotiationManager) { + this.contentNegotiationManager = contentNegotiationManager; + } + + public void setMessageConverters(List> messageConverters) { + this.messageConverters = messageConverters; + Set allSupportedMediaTypes = new LinkedHashSet(); + for (HttpMessageConverter messageConverter : messageConverters) { + allSupportedMediaTypes.addAll(messageConverter.getSupportedMediaTypes()); + } + this.allSupportedMediaTypes = new ArrayList(allSupportedMediaTypes); + MediaType.sortBySpecificity(this.allSupportedMediaTypes); + } + + /** + * Default conventions, taken from {@link WebMvcConfigurationSupport} with a few minor + * tweaks. + */ + private static class WebMvcConfigurationSupportConventions extends + WebMvcConfigurationSupport { + public List> getDefaultHttpMessageConverters() { + List> converters = new ArrayList>(); + addDefaultHttpMessageConverters(converters); + for (HttpMessageConverter converter : converters) { + if (converter instanceof MappingJackson2HttpMessageConverter) { + MappingJackson2HttpMessageConverter jacksonConverter = (MappingJackson2HttpMessageConverter) converter; + jacksonConverter.getObjectMapper().disable( + SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + } + } + return converters; + } + } +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerMapping.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerMapping.java new file mode 100644 index 00000000000..14a680b9266 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerMapping.java @@ -0,0 +1,133 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.endpoint.mvc; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.BeanFactoryUtils; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.util.Assert; +import org.springframework.util.StringUtils; +import org.springframework.web.servlet.HandlerExecutionChain; +import org.springframework.web.servlet.HandlerMapping; +import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping; +import org.springframework.zero.actuate.endpoint.ActionEndpoint; +import org.springframework.zero.actuate.endpoint.Endpoint; + +/** + * {@link HandlerMapping} to map {@link Endpoint}s to URLs via {@link Endpoint#getPath()}. + * Standard {@link Endpoint}s are mapped to GET requests, {@link ActionEndpoint}s are + * mapped to POST requests. + * + * @author Phillip Webb + * @see EndpointHandlerAdapter + */ +public class EndpointHandlerMapping extends AbstractUrlHandlerMapping implements + InitializingBean, ApplicationContextAware { + + private List> endpoints; + + private String prefix = ""; + + private boolean disabled = false; + + /** + * Create a new {@link EndpointHandlerMapping} instance. All {@link Endpoint}s will be + * detected from the {@link ApplicationContext}. + */ + public EndpointHandlerMapping() { + setOrder(HIGHEST_PRECEDENCE); + } + + /** + * Create a new {@link EndpointHandlerMapping} with the specified endpoints. + * @param endpoints the endpoints + */ + public EndpointHandlerMapping(Collection> endpoints) { + Assert.notNull(endpoints, "Endpoints must not be null"); + this.endpoints = new ArrayList>(endpoints); + } + + @Override + public void afterPropertiesSet() throws Exception { + if (this.endpoints == null) { + this.endpoints = findEndpointBeans(); + } + if (!this.disabled) { + for (Endpoint endpoint : this.endpoints) { + registerHandler(this.prefix + endpoint.getPath(), endpoint); + } + } + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private List> findEndpointBeans() { + return new ArrayList(BeanFactoryUtils.beansOfTypeIncludingAncestors( + getApplicationContext(), Endpoint.class).values()); + } + + @Override + protected Object lookupHandler(String urlPath, HttpServletRequest request) + throws Exception { + Object handler = super.lookupHandler(urlPath, request); + if (handler != null) { + Object endpoint = (handler instanceof HandlerExecutionChain ? ((HandlerExecutionChain) handler) + .getHandler() : handler); + String method = (endpoint instanceof ActionEndpoint ? "POST" : "GET"); + if (request.getMethod().equals(method)) { + return endpoint; + } + } + return null; + } + + /** + * @param prefix the prefix to set + */ + public void setPrefix(String prefix) { + Assert.isTrue("".equals(prefix) || StringUtils.startsWithIgnoreCase(prefix, "/"), + "prefix must start with '/'"); + this.prefix = prefix; + } + + /** + * Sets if this mapping is disabled. + */ + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + + /** + * Returns if this mapping is disabled. + */ + public boolean isDisabled() { + return this.disabled; + } + + /** + * Return the endpoints + */ + public List> getEndpoints() { + return Collections.unmodifiableList(this.endpoints); + } +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/fixme/ManagementServerConfiguration.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/fixme/ManagementServerConfiguration.java new file mode 100644 index 00000000000..38276880508 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/fixme/ManagementServerConfiguration.java @@ -0,0 +1,141 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.fixme; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.HierarchicalBeanFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.web.filter.GenericFilterBean; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.zero.actuate.properties.ManagementServerProperties; +import org.springframework.zero.actuate.web.BasicErrorController; +import org.springframework.zero.context.annotation.ConditionalOnBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer; +import org.springframework.zero.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.ErrorPage; +import org.springframework.zero.context.embedded.jetty.JettyEmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; + +/** + * Configuration for creating a new container (e.g. tomcat) for the management endpoints. + * + * @author Dave Syer + */ +@Configuration +@EnableWebMvc +@Import(ManagementSecurityConfiguration.class) +public class ManagementServerConfiguration { + + // FIXME delete when security works + + @Bean + public DispatcherServlet dispatcherServlet() { + return new DispatcherServlet(); + } + + @Bean + public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer( + ApplicationContext context) { + return new PropertySourcesPlaceholderConfigurer(); + } + + @Bean + public BasicErrorController errorEndpoint() { + return new BasicErrorController(); + } + + @Bean + @ConditionalOnBean(TomcatEmbeddedServletContainerFactory.class) + public EmbeddedServletContainerFactory tomcatContainer( + HierarchicalBeanFactory beanFactory) { + TomcatEmbeddedServletContainerFactory factory = beanFactory + .getParentBeanFactory().getBean( + TomcatEmbeddedServletContainerFactory.class); + return factory.getChildContextFactory("Management"); + } + + @Bean + @ConditionalOnBean(JettyEmbeddedServletContainerFactory.class) + public EmbeddedServletContainerFactory jettyContainer() { + return new JettyEmbeddedServletContainerFactory(); + } + + @Configuration + protected static class ServerCustomizationConfiguration implements + EmbeddedServletContainerCustomizer { + + @Value("${endpoints.error.path:/error}") + private String errorPath = "/error"; + + @Autowired + private ApplicationContext beanFactory; + + @Override + public void customize(ConfigurableEmbeddedServletContainerFactory factory) { + ManagementServerProperties configuration = this.beanFactory + .getBean(ManagementServerProperties.class); + factory.setPort(configuration.getPort()); + factory.setAddress(configuration.getAddress()); + factory.setContextPath(configuration.getContextPath()); + factory.addErrorPages(new ErrorPage(this.errorPath)); + } + + } + +} + +@Configuration +@ConditionalOnClass(name = { + "org.springframework.security.config.annotation.web.EnableWebSecurity", + "javax.servlet.Filter" }) +class ManagementSecurityConfiguration { + + @Bean + // TODO: enable and get rid of the empty filter when @ConditionalOnBean works + // @ConditionalOnBean(name = "springSecurityFilterChain") + public Filter springSecurityFilterChain(HierarchicalBeanFactory beanFactory) { + BeanFactory parent = beanFactory.getParentBeanFactory(); + if (parent != null && parent.containsBean("springSecurityFilterChain")) { + return parent.getBean("springSecurityFilterChain", Filter.class); + } + return new GenericFilterBean() { + @Override + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + chain.doFilter(request, response); + } + }; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/health/HealthIndicator.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/health/HealthIndicator.java new file mode 100644 index 00000000000..ddfc96aea2a --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/health/HealthIndicator.java @@ -0,0 +1,32 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.health; + +/** + * Strategy interface used to provide an indication of application health. + * + * @author Dave Syer + * @see VanillaHealthIndicator + */ +public interface HealthIndicator { + + /** + * @return an indication of health + */ + T health(); + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/health/VanillaHealthIndicator.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/health/VanillaHealthIndicator.java new file mode 100644 index 00000000000..32369f8be03 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/health/VanillaHealthIndicator.java @@ -0,0 +1,31 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.health; + +/** + * Default implementation of {@link HealthIndicator} that simply returns "ok". + * + * @author Dave Syer + */ +public class VanillaHealthIndicator implements HealthIndicator { + + @Override + public String health() { + return "ok"; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/CounterService.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/CounterService.java new file mode 100644 index 00000000000..59fc685be9a --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/CounterService.java @@ -0,0 +1,44 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +/** + * A service that can be used to increment, decrement and reset a {@link Metric}. + * + * @author Dave Syer + */ +public interface CounterService { + + /** + * Increment the specified metric by 1. + * @param metricName the name of the metric + */ + void increment(String metricName); + + /** + * Decrement the specified metric by 1. + * @param metricName the name of the metric + */ + void decrement(String metricName); + + /** + * Reset the specified metric to 0. + * @param metricName the name of the metric + */ + void reset(String metricName); + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultCounterService.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultCounterService.java new file mode 100644 index 00000000000..763801457fc --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultCounterService.java @@ -0,0 +1,62 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +import java.util.Date; + +/** + * Default implementation of {@link CounterService}. + * + * @author Dave Syer + */ +public class DefaultCounterService implements CounterService { + + private MetricRepository repository; + + /** + * Create a {@link DefaultCounterService} instance. + * @param repository the underlying repository used to manage metrics + */ + public DefaultCounterService(MetricRepository repository) { + super(); + this.repository = repository; + } + + @Override + public void increment(String metricName) { + this.repository.increment(wrap(metricName), 1, new Date()); + } + + @Override + public void decrement(String metricName) { + this.repository.increment(wrap(metricName), -1, new Date()); + } + + @Override + public void reset(String metricName) { + this.repository.set(wrap(metricName), 0, new Date()); + } + + private String wrap(String metricName) { + if (metricName.startsWith("counter")) { + return metricName; + } else { + return "counter." + metricName; + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultGaugeService.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultGaugeService.java new file mode 100644 index 00000000000..b262f0cec34 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultGaugeService.java @@ -0,0 +1,51 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +import java.util.Date; + +/** + * Default implementation of {@link GaugeService}. + * + * @author Dave Syer + */ +public class DefaultGaugeService implements GaugeService { + + private MetricRepository metricRepository; + + /** + * @param counterRepository + */ + public DefaultGaugeService(MetricRepository counterRepository) { + super(); + this.metricRepository = counterRepository; + } + + @Override + public void set(String metricName, double value) { + this.metricRepository.set(wrap(metricName), value, new Date()); + } + + private String wrap(String metricName) { + if (metricName.startsWith("gauge")) { + return metricName; + } else { + return "gauge." + metricName; + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/GaugeService.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/GaugeService.java new file mode 100644 index 00000000000..ec22869dc3c --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/GaugeService.java @@ -0,0 +1,33 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +/** + * A service that can be used to manage a {@link Metric} as a gauge. + * + * @author Dave Syer + */ +public interface GaugeService { + + /** + * Set the specified metric value + * @param metricName the metric to set + * @param value the value of the metric + */ + void set(String metricName, double value); + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepository.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepository.java new file mode 100644 index 00000000000..d16614aa511 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepository.java @@ -0,0 +1,81 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +/** + * @author Dave Syer + */ +public class InMemoryMetricRepository implements MetricRepository { + + private ConcurrentMap metrics = new ConcurrentHashMap(); + + @Override + public void increment(String metricName, int amount, Date timestamp) { + // FIXME this might not be thread safe + Measurement current = this.metrics.get(metricName); + if (current != null) { + Metric metric = current.getMetric(); + this.metrics.replace(metricName, current, + new Measurement(timestamp, metric.increment(amount))); + } else { + this.metrics.putIfAbsent(metricName, new Measurement(timestamp, new Metric( + metricName, amount))); + } + } + + @Override + public void set(String metricName, double value, Date timestamp) { + Measurement current = this.metrics.get(metricName); + if (current != null) { + Metric metric = current.getMetric(); + this.metrics.replace(metricName, current, + new Measurement(timestamp, metric.set(value))); + } else { + this.metrics.putIfAbsent(metricName, new Measurement(timestamp, new Metric( + metricName, value))); + } + } + + @Override + public void delete(String metricName) { + this.metrics.remove(metricName); + } + + @Override + public Metric findOne(String metricName) { + if (this.metrics.containsKey(metricName)) { + return this.metrics.get(metricName).getMetric(); + } + return new Metric(metricName, 0); + } + + @Override + public Collection findAll() { + ArrayList result = new ArrayList(); + for (Measurement measurement : this.metrics.values()) { + result.add(measurement.getMetric()); + } + return result; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/Measurement.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/Measurement.java new file mode 100644 index 00000000000..32e0327fa1d --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/Measurement.java @@ -0,0 +1,79 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +import java.util.Date; + +import org.springframework.util.ObjectUtils; + +/** + * A {@link Metric} at a given point in time. + * + * @author Dave Syer + */ +public final class Measurement { + + private Date timestamp; + + private Metric metric; + + public Measurement(Date timestamp, Metric metric) { + this.timestamp = timestamp; + this.metric = metric; + } + + public Date getTimestamp() { + return this.timestamp; + } + + public Metric getMetric() { + return this.metric; + } + + @Override + public String toString() { + return "Measurement [dateTime=" + this.timestamp + ", metric=" + this.metric + + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ObjectUtils.nullSafeHashCode(this.timestamp); + result = prime * result + ObjectUtils.nullSafeHashCode(this.metric); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() == obj.getClass()) { + Measurement other = (Measurement) obj; + boolean result = ObjectUtils.nullSafeEquals(this.timestamp, other.timestamp); + result &= ObjectUtils.nullSafeEquals(this.metric, other.metric); + return result; + } + return super.equals(obj); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/Metric.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/Metric.java new file mode 100644 index 00000000000..9726fb07aab --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/Metric.java @@ -0,0 +1,113 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +import org.springframework.util.Assert; +import org.springframework.util.ObjectUtils; + +/** + * Immutable class that can be used to hold any arbitrary system measurement value. For + * example a metric might record the number of active connections. + * + * @author Dave Syer + * @see MetricRepository + * @see CounterService + */ +public final class Metric { + + private final String name; + + private final double value; + + /** + * Create a new {@link Metric} instance. + * @param name the name of the metric + * @param value the value of the metric + */ + public Metric(String name, double value) { + super(); + Assert.notNull(name, "Name must not be null"); + this.name = name; + this.value = value; + } + + /** + * Returns the name of the metric. + */ + public String getName() { + return this.name; + } + + /** + * Returns the value of the metric. + */ + public double getValue() { + return this.value; + } + + /** + * Create a new {@link Metric} with an incremented value. + * @param amount the amount that the new metric will differ from this one + * @return a new {@link Metric} instance + */ + public Metric increment(int amount) { + return new Metric(this.name, new Double(((int) this.value) + amount)); + } + + /** + * Create a new {@link Metric} with a different value. + * @param value the value of the new metric + * @return a new {@link Metric} instance + */ + public Metric set(double value) { + return new Metric(this.name, value); + } + + @Override + public String toString() { + return "Metric [name=" + this.name + ", value=" + this.value + "]"; + } + + @Override + public int hashCode() { + int valueHashCode = ObjectUtils.hashCode(this.value); + final int prime = 31; + int result = 1; + result = prime * result + ObjectUtils.nullSafeHashCode(this.name); + result = prime * result + (valueHashCode ^ (valueHashCode >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() == obj.getClass()) { + Metric other = (Metric) obj; + boolean result = ObjectUtils.nullSafeEquals(this.name, other.name); + result &= Double.doubleToLongBits(this.value) == Double + .doubleToLongBits(other.value); + return result; + } + return super.equals(obj); + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/MetricRepository.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/MetricRepository.java new file mode 100644 index 00000000000..afc746cb43a --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/MetricRepository.java @@ -0,0 +1,45 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +import java.util.Collection; +import java.util.Date; + +/** + * A Repository used to manage {@link Metric}s. + * + * @author Dave Syer + */ +public interface MetricRepository { + + // FIXME perhaps revisit this, there is no way to get timestamps + // could also simply, leaving increment to counter service + + // Perhaps findAll, findOne should return Measurements + // put(String name, Callback -> process(Metric) + + void increment(String metricName, int amount, Date timestamp); + + void set(String metricName, double value, Date timestamp); + + void delete(String metricName); + + Metric findOne(String metricName); + + Collection findAll(); + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/properties/ManagementServerProperties.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/properties/ManagementServerProperties.java new file mode 100644 index 00000000000..896d79f9d37 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/properties/ManagementServerProperties.java @@ -0,0 +1,85 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.properties; + +import java.net.InetAddress; + +import javax.validation.constraints.NotNull; + +import org.springframework.zero.context.annotation.ConfigurationProperties; +import org.springframework.zero.properties.ServerProperties; + +/** + * Properties for the management server (e.g. port and path settings). + * + * @author Dave Syer + * @see ServerProperties + */ +@ConfigurationProperties(name = "management", ignoreUnknownFields = false) +public class ManagementServerProperties { + + private Integer port; + + private InetAddress address; + + @NotNull + private String contextPath = ""; + + private boolean allowShutdown = false; + + public boolean isAllowShutdown() { + return this.allowShutdown; + } + + public void setAllowShutdown(boolean allowShutdown) { + this.allowShutdown = allowShutdown; + } + + /** + * Returns the management port or {@code null} if the + * {@link ServerProperties#getPort() server port} should be used. + * @see #setPort(Integer) + */ + public Integer getPort() { + return this.port; + } + + /** + * Sets the port of the management server, use {@code null} if the + * {@link ServerProperties#getPort() server port} should be used. To disable use 0. + */ + public void setPort(Integer port) { + this.port = port; + } + + public InetAddress getAddress() { + return this.address; + } + + public void setAddress(InetAddress address) { + this.address = address; + } + + public String getContextPath() { + return this.contextPath; + } + + public void setContextPath(String contextPath) { + this.contextPath = contextPath; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/properties/SecurityProperties.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/properties/SecurityProperties.java new file mode 100644 index 00000000000..ad397021d04 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/properties/SecurityProperties.java @@ -0,0 +1,115 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.properties; + +import org.springframework.security.config.annotation.web.configurers.SessionCreationPolicy; +import org.springframework.zero.context.annotation.ConfigurationProperties; + +/** + * Properties for the security aspects of an application. + * + * @author Dave Syer + */ +@ConfigurationProperties(name = "security", ignoreUnknownFields = false) +public class SecurityProperties { + + private boolean requireSsl; + + private Basic basic = new Basic(); + + private SessionCreationPolicy sessions = SessionCreationPolicy.stateless; + + private String[] ignored = new String[] { "/css/**", "/js/**", "/images/**", + "/**/favicon.ico" }; + + public SessionCreationPolicy getSessions() { + return this.sessions; + } + + public void setSessions(SessionCreationPolicy sessions) { + this.sessions = sessions; + } + + public Basic getBasic() { + return this.basic; + } + + public void setBasic(Basic basic) { + this.basic = basic; + } + + public boolean isRequireSsl() { + return this.requireSsl; + } + + public void setRequireSsl(boolean requireSsl) { + this.requireSsl = requireSsl; + } + + public void setIgnored(String... ignored) { + this.ignored = ignored; + } + + public String[] getIgnored() { + return this.ignored; + } + + public static class Basic { + + private boolean enabled = true; + + private String realm = "Spring"; + + private String[] path = new String[] { "/**" }; + + private String role = "USER"; + + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public String getRealm() { + return this.realm; + } + + public void setRealm(String realm) { + this.realm = realm; + } + + public String[] getPath() { + return this.path; + } + + public void setPath(String... paths) { + this.path = paths; + } + + public String getRole() { + return this.role; + } + + public void setRole(String role) { + this.role = role; + } + + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthenticationAuditListener.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthenticationAuditListener.java new file mode 100644 index 00000000000..a33dd40f175 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthenticationAuditListener.java @@ -0,0 +1,91 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.security; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.ApplicationEventPublisherAware; +import org.springframework.context.ApplicationListener; +import org.springframework.security.authentication.event.AbstractAuthenticationEvent; +import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent; +import org.springframework.security.web.authentication.switchuser.AuthenticationSwitchUserEvent; +import org.springframework.zero.actuate.audit.AuditEvent; +import org.springframework.zero.actuate.audit.listener.AuditApplicationEvent; + +/** + * {@link ApplicationListener} expose Spring Security {@link AbstractAuthenticationEvent + * authentication events} as {@link AuditEvent}s. + * + * @author Dave Syer + */ +public class AuthenticationAuditListener implements + ApplicationListener, ApplicationEventPublisherAware { + + private ApplicationEventPublisher publisher; + + @Override + public void setApplicationEventPublisher(ApplicationEventPublisher publisher) { + this.publisher = publisher; + } + + @Override + public void onApplicationEvent(AbstractAuthenticationEvent event) { + if (event instanceof AbstractAuthenticationFailureEvent) { + onAuthenticationFailureEvent((AbstractAuthenticationFailureEvent) event); + } else if (event instanceof AuthenticationSwitchUserEvent) { + onAuthenticationSwitchUserEvent((AuthenticationSwitchUserEvent) event); + } else { + onAuthenticationEvent(event); + } + } + + private void onAuthenticationFailureEvent(AbstractAuthenticationFailureEvent event) { + Map data = new HashMap(); + data.put("type", event.getException().getClass().getName()); + data.put("message", event.getException().getMessage()); + publish(new AuditEvent(event.getAuthentication().getName(), + "AUTHENTICATION_FAILURE", data)); + } + + private void onAuthenticationSwitchUserEvent(AuthenticationSwitchUserEvent event) { + Map data = new HashMap(); + if (event.getAuthentication().getDetails() != null) { + data.put("details", event.getAuthentication().getDetails()); + } + data.put("target", event.getTargetUser().getUsername()); + publish(new AuditEvent(event.getAuthentication().getName(), + "AUTHENTICATION_SWITCH", data)); + } + + private void onAuthenticationEvent(AbstractAuthenticationEvent event) { + Map data = new HashMap(); + if (event.getAuthentication().getDetails() != null) { + data.put("details", event.getAuthentication().getDetails()); + } + publish(new AuditEvent(event.getAuthentication().getName(), + "AUTHENTICATION_SUCCESS", data)); + } + + private void publish(AuditEvent event) { + if (this.publisher != null) { + this.publisher.publishEvent(new AuditApplicationEvent(event)); + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthorizationAuditListener.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthorizationAuditListener.java new file mode 100644 index 00000000000..d11d03a329a --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthorizationAuditListener.java @@ -0,0 +1,78 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.security; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.ApplicationEventPublisherAware; +import org.springframework.context.ApplicationListener; +import org.springframework.security.access.event.AbstractAuthorizationEvent; +import org.springframework.security.access.event.AuthenticationCredentialsNotFoundEvent; +import org.springframework.security.access.event.AuthorizationFailureEvent; +import org.springframework.zero.actuate.audit.AuditEvent; +import org.springframework.zero.actuate.audit.listener.AuditApplicationEvent; + +/** + * {@link ApplicationListener} expose Spring Security {@link AbstractAuthorizationEvent + * authorization events} as {@link AuditEvent}s. + * + * @author Dave Syer + */ +public class AuthorizationAuditListener implements + ApplicationListener, ApplicationEventPublisherAware { + + private ApplicationEventPublisher publisher; + + @Override + public void setApplicationEventPublisher(ApplicationEventPublisher publisher) { + this.publisher = publisher; + } + + @Override + public void onApplicationEvent(AbstractAuthorizationEvent event) { + if (event instanceof AuthenticationCredentialsNotFoundEvent) { + onAuthenticationCredentialsNotFoundEvent((AuthenticationCredentialsNotFoundEvent) event); + } else if (event instanceof AuthorizationFailureEvent) { + onAuthorizationFailureEvent((AuthorizationFailureEvent) event); + } + } + + private void onAuthenticationCredentialsNotFoundEvent( + AuthenticationCredentialsNotFoundEvent event) { + Map data = new HashMap(); + data.put("type", event.getCredentialsNotFoundException().getClass().getName()); + data.put("message", event.getCredentialsNotFoundException().getMessage()); + publish(new AuditEvent("", "AUTHENTICATION_FAILURE", data)); + } + + private void onAuthorizationFailureEvent(AuthorizationFailureEvent event) { + Map data = new HashMap(); + data.put("type", event.getAccessDeniedException().getClass().getName()); + data.put("message", event.getAccessDeniedException().getMessage()); + publish(new AuditEvent(event.getAuthentication().getName(), + "AUTHORIZATION_FAILURE", data)); + } + + private void publish(AuditEvent event) { + if (this.publisher != null) { + this.publisher.publishEvent(new AuditApplicationEvent(event)); + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/InMemoryTraceRepository.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/InMemoryTraceRepository.java new file mode 100644 index 00000000000..01067ea38d8 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/InMemoryTraceRepository.java @@ -0,0 +1,61 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.trace; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * In-memory implementation of {@link TraceRepository}. + * + * @author Dave Syer + */ +public class InMemoryTraceRepository implements TraceRepository { + + private int capacity = 100; + + private List traces = new ArrayList(); + + /** + * @param capacity the capacity to set + */ + public void setCapacity(int capacity) { + this.capacity = capacity; + } + + @Override + public List findAll() { + synchronized (this.traces) { + return Collections.unmodifiableList(this.traces); + } + } + + @Override + public void add(Map map) { + Trace trace = new Trace(new Date(), map); + synchronized (this.traces) { + while (this.traces.size() >= this.capacity) { + this.traces.remove(0); + } + this.traces.add(trace); + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/Trace.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/Trace.java new file mode 100644 index 00000000000..090aa729839 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/Trace.java @@ -0,0 +1,52 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.trace; + +import java.util.Date; +import java.util.Map; + +import org.springframework.util.Assert; + +/** + * A value object representing a trace event: at a particular time with a simple (map) + * information. Can be used for analyzing contextual information such as HTTP headers. + * + * @author Dave Syer + */ +public final class Trace { + + private Date timestamp; + + private Map info; + + public Trace(Date timestamp, Map info) { + super(); + Assert.notNull(timestamp, "Timestamp must not be null"); + Assert.notNull(info, "Info must not be null"); + this.timestamp = timestamp; + this.info = info; + } + + public Date getTimestamp() { + return this.timestamp; + } + + public Map getInfo() { + return this.info; + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/TraceRepository.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/TraceRepository.java new file mode 100644 index 00000000000..3eac458ce9f --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/TraceRepository.java @@ -0,0 +1,40 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.trace; + +import java.util.List; +import java.util.Map; + +/** + * A repository for {@link Trace}s. + * + * @author Dave Syer + */ +public interface TraceRepository { + + /** + * Find all {@link Trace} objects contained in the repository. + */ + List findAll(); + + /** + * Add a new {@link Trace} object at the current time. + * @param traceInfo trace information + */ + void add(Map traceInfo); + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/WebRequestTraceFilter.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/WebRequestTraceFilter.java new file mode 100644 index 00000000000..9ce56289ea8 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/WebRequestTraceFilter.java @@ -0,0 +1,145 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.trace; + +import java.io.IOException; +import java.util.Collections; +import java.util.Enumeration; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.core.Ordered; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * Servlet {@link Filter} that logs all requests to a {@link TraceRepository}. + * + * @author Dave Syer + */ +public class WebRequestTraceFilter implements Filter, Ordered { + + final Log logger = LogFactory.getLog(WebRequestTraceFilter.class); + + private boolean dumpRequests = false; + + private final TraceRepository traceRepository; + + private int order = Integer.MAX_VALUE; + + private ObjectMapper objectMapper = new ObjectMapper(); + + /** + * @param traceRepository + */ + public WebRequestTraceFilter(TraceRepository traceRepository) { + this.traceRepository = traceRepository; + } + + /** + * @param order the order to set + */ + public void setOrder(int order) { + this.order = order; + } + + @Override + public int getOrder() { + return this.order; + } + + /** + * Debugging feature. If enabled, and trace logging is enabled then web request + * headers will be logged. + */ + public void setDumpRequests(boolean dumpRequests) { + this.dumpRequests = dumpRequests; + } + + @Override + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) + throws IOException, ServletException { + HttpServletRequest request = (HttpServletRequest) req; + HttpServletResponse response = (HttpServletResponse) res; + + Map trace = getTrace(request); + this.traceRepository.add(trace); + if (this.logger.isTraceEnabled()) { + this.logger.trace("Processing request " + request.getMethod() + " " + + request.getRequestURI()); + if (this.dumpRequests) { + try { + @SuppressWarnings("unchecked") + Map headers = (Map) trace + .get("headers"); + this.logger.trace("Headers: " + + this.objectMapper.writeValueAsString(headers)); + } catch (JsonProcessingException e) { + throw new IllegalStateException("Cannot create JSON", e); + } + } + } + + chain.doFilter(request, response); + } + + protected Map getTrace(HttpServletRequest request) { + + Map map = new LinkedHashMap(); + Enumeration names = request.getHeaderNames(); + + while (names.hasMoreElements()) { + String name = names.nextElement(); + List values = Collections.list(request.getHeaders(name)); + Object value = values; + if (values.size() == 1) { + value = values.get(0); + } else if (values.isEmpty()) { + value = ""; + } + map.put(name, value); + + } + Map trace = new LinkedHashMap(); + trace.put("method", request.getMethod()); + trace.put("path", request.getRequestURI()); + trace.put("headers", map); + return trace; + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + @Override + public void destroy() { + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/BasicErrorController.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/BasicErrorController.java new file mode 100644 index 00000000000..206407180b6 --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/BasicErrorController.java @@ -0,0 +1,110 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.web; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.zero.context.embedded.AbstractEmbeddedServletContainerFactory; + +/** + * Basic global error {@link Controller}, rendering servlet container error codes and + * messages where available. More specific errors can be handled either using Spring MVC + * abstractions (e.g. {@code @ExceptionHandler}) or by adding servlet + * {@link AbstractEmbeddedServletContainerFactory#setErrorPages(java.util.Set) container + * error pages}. + * + * @author Dave Syer + */ +@Controller +public class BasicErrorController implements ErrorController { + + private Log logger = LogFactory.getLog(BasicErrorController.class); + + @Value("${error.path:/error}") + private String errorPath; + + @Override + public String getErrorPath() { + return this.errorPath; + } + + @RequestMapping(value = "${error.path:/error}", produces = "text/html") + public ModelAndView errorHtml(HttpServletRequest request) { + Map map = error(request); + return new ModelAndView("error", map); + } + + @RequestMapping(value = "${error.path:/error}") + @ResponseBody + public Map error(HttpServletRequest request) { + Map map = new LinkedHashMap(); + map.put("timestamp", new Date()); + try { + Throwable error = (Throwable) request + .getAttribute("javax.servlet.error.exception"); + Object obj = request.getAttribute("javax.servlet.error.status_code"); + int status = 999; + if (obj != null) { + status = (Integer) obj; + map.put("error", HttpStatus.valueOf(status).getReasonPhrase()); + } else { + map.put("error", "None"); + } + map.put("status", status); + if (error != null) { + while (error instanceof ServletException) { + error = ((ServletException) error).getCause(); + } + map.put("exception", error.getClass().getName()); + map.put("message", error.getMessage()); + String trace = request.getParameter("trace"); + if (trace != null && !"false".equals(trace.toLowerCase())) { + StringWriter stackTrace = new StringWriter(); + error.printStackTrace(new PrintWriter(stackTrace)); + stackTrace.flush(); + map.put("trace", stackTrace.toString()); + } + this.logger.error(error); + } else { + Object message = request.getAttribute("javax.servlet.error.message"); + map.put("message", message == null ? "No message available" : message); + } + return map; + } catch (Exception e) { + map.put("error", e.getClass().getName()); + map.put("message", e.getMessage()); + this.logger.error(e); + return map; + } + } + +} diff --git a/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/ErrorController.java b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/ErrorController.java new file mode 100644 index 00000000000..372fc25ee9a --- /dev/null +++ b/spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/ErrorController.java @@ -0,0 +1,31 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.web; + +import org.springframework.stereotype.Controller; + +/** + * Marker interface used to indicate that a {@link Controller @Controller} is used to + * render errors. + * + * @author Phillip Webb + */ +public interface ErrorController { + + public String getErrorPath(); + +} diff --git a/spring-zero-actuator/src/main/resources/META-INF/spring.factories b/spring-zero-actuator/src/main/resources/META-INF/spring.factories index 83f5b6d483a..61e36f90393 100644 --- a/spring-zero-actuator/src/main/resources/META-INF/spring.factories +++ b/spring-zero-actuator/src/main/resources/META-INF/spring.factories @@ -1,11 +1,11 @@ -org.springframework.bootstrap.context.annotation.EnableAutoConfiguration=\ -org.springframework.bootstrap.actuate.autoconfigure.AuditAutoConfiguration,\ -org.springframework.bootstrap.actuate.autoconfigure.EndpointAutoConfiguration,\ -org.springframework.bootstrap.actuate.autoconfigure.EndpointWebMvcAutoConfiguration,\ -org.springframework.bootstrap.actuate.autoconfigure.ErrorMvcAutoConfiguration,\ -org.springframework.bootstrap.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration,\ -org.springframework.bootstrap.actuate.autoconfigure.MetricFilterAutoConfiguration,\ -org.springframework.bootstrap.actuate.autoconfigure.MetricRepositoryAutoConfiguration,\ -org.springframework.bootstrap.actuate.autoconfigure.SecurityAutoConfiguration,\ -org.springframework.bootstrap.actuate.autoconfigure.TraceRepositoryAutoConfiguration,\ -org.springframework.bootstrap.actuate.autoconfigure.TraceWebFilterAutoConfiguration +org.springframework.zero.context.annotation.EnableAutoConfiguration=\ +org.springframework.zero.actuate.autoconfigure.AuditAutoConfiguration,\ +org.springframework.zero.actuate.autoconfigure.EndpointAutoConfiguration,\ +org.springframework.zero.actuate.autoconfigure.EndpointWebMvcAutoConfiguration,\ +org.springframework.zero.actuate.autoconfigure.ErrorMvcAutoConfiguration,\ +org.springframework.zero.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration,\ +org.springframework.zero.actuate.autoconfigure.MetricFilterAutoConfiguration,\ +org.springframework.zero.actuate.autoconfigure.MetricRepositoryAutoConfiguration,\ +org.springframework.zero.actuate.autoconfigure.SecurityAutoConfiguration,\ +org.springframework.zero.actuate.autoconfigure.TraceRepositoryAutoConfiguration,\ +org.springframework.zero.actuate.autoconfigure.TraceWebFilterAutoConfiguration diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java deleted file mode 100644 index ade84630fcd..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.core.env.MapPropertySource; - -/** - * @author Dave Syer - * - */ -public class TestUtils { - - public static void addEnviroment(ConfigurableApplicationContext context, - String... pairs) { - Map map = new HashMap(); - for (String pair : pairs) { - int index = pair.indexOf(":"); - String key = pair.substring(0, index > 0 ? index : pair.length()); - String value = index > 0 ? pair.substring(index + 1) : ""; - map.put(key, value); - } - context.getEnvironment().getPropertySources() - .addFirst(new MapPropertySource("test", map)); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java deleted file mode 100644 index 362ef5773b1..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.audit; - -import java.util.Collections; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -/** - * Tests for {@link AuditEvent}. - * - * @author Dave Syer - */ -public class AuditEventTests { - - @Test - public void testNowEvent() throws Exception { - 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()); - assertNotNull(event.getTimestamp()); - } - - @Test - public void testConvertStringsToData() throws Exception { - AuditEvent event = new AuditEvent("phil", "UNKNOWN", "a=b", "c=d"); - assertEquals("b", event.getData().get("a")); - assertEquals("d", event.getData().get("c")); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java deleted file mode 100644 index efc7b0f9a03..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.audit; - -import java.util.Date; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * Tests for {@link InMemoryAuditEventRepository}. - * - * @author Dave Syer - */ -public class InMemoryAuditEventRepositoryTests { - - private InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(); - - @Test - public void testAddToCapacity() throws Exception { - this.repository.setCapacity(2); - this.repository.add(new AuditEvent("phil", "UNKNOWN")); - this.repository.add(new AuditEvent("phil", "UNKNOWN")); - this.repository.add(new AuditEvent("dave", "UNKNOWN")); - this.repository.add(new AuditEvent("dave", "UNKNOWN")); - this.repository.add(new AuditEvent("phil", "UNKNOWN")); - assertEquals(2, this.repository.find("phil", new Date(0L)).size()); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java deleted file mode 100644 index 5c63c2ab947..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.audit.listener; - -import java.util.Collections; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.audit.AuditEvent; -import org.springframework.bootstrap.actuate.audit.AuditEventRepository; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -/** - * Tests for {@link AuditListener}. - * - * @author Phillip Webb - */ -public class AuditListenerTests { - - @Test - public void testStoredEvents() { - AuditEventRepository repository = mock(AuditEventRepository.class); - AuditEvent event = new AuditEvent("principal", "type", - Collections. emptyMap()); - AuditListener listener = new AuditListener(repository); - listener.onApplicationEvent(new AuditApplicationEvent(event)); - verify(repository).add(event); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java deleted file mode 100644 index ffaeaf12a11..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.audit.AuditEventRepository; -import org.springframework.bootstrap.actuate.audit.InMemoryAuditEventRepository; -import org.springframework.bootstrap.actuate.security.AuthenticationAuditListener; -import org.springframework.bootstrap.actuate.security.AuthorizationAuditListener; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.instanceOf; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link AuditAutoConfiguration}. - * - * @author Dave Syer - */ -public class AuditAutoConfigurationTests { - - private AnnotationConfigApplicationContext context; - - @Test - public void testTraceConfiguration() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(AuditAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(AuditEventRepository.class)); - assertNotNull(this.context.getBean(AuthenticationAuditListener.class)); - assertNotNull(this.context.getBean(AuthorizationAuditListener.class)); - } - - @Test - public void ownAutoRepository() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(Config.class, AuditAutoConfiguration.class); - this.context.refresh(); - assertThat(this.context.getBean(AuditEventRepository.class), - instanceOf(TestAuditEventRepository.class)); - } - - @Configuration - public static class Config { - - @Bean - public TestAuditEventRepository testAuditEventRepository() { - return new TestAuditEventRepository(); - } - - } - - public static class TestAuditEventRepository extends InMemoryAuditEventRepository { - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java deleted file mode 100644 index 0d1885f6055..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.bootstrap.actuate.TestUtils; -import org.springframework.bootstrap.actuate.endpoint.BeansEndpoint; -import org.springframework.bootstrap.actuate.endpoint.DumpEndpoint; -import org.springframework.bootstrap.actuate.endpoint.EnvironmentEndpoint; -import org.springframework.bootstrap.actuate.endpoint.HealthEndpoint; -import org.springframework.bootstrap.actuate.endpoint.InfoEndpoint; -import org.springframework.bootstrap.actuate.endpoint.MetricsEndpoint; -import org.springframework.bootstrap.actuate.endpoint.ShutdownEndpoint; -import org.springframework.bootstrap.actuate.endpoint.TraceEndpoint; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -/** - * Tests for {@link EndpointAutoConfiguration}. - * - * @author Dave Syer - * @author Phillip Webb - */ -public class EndpointAutoConfigurationTests { - - private AnnotationConfigApplicationContext context; - - @Before - public void setup() { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(EndpointAutoConfiguration.class); - this.context.refresh(); - } - - @Test - public void endpoints() throws Exception { - assertNotNull(this.context.getBean(BeansEndpoint.class)); - assertNotNull(this.context.getBean(DumpEndpoint.class)); - assertNotNull(this.context.getBean(EnvironmentEndpoint.class)); - assertNotNull(this.context.getBean(HealthEndpoint.class)); - assertNotNull(this.context.getBean(InfoEndpoint.class)); - assertNotNull(this.context.getBean(MetricsEndpoint.class)); - assertNotNull(this.context.getBean(ShutdownEndpoint.class)); - assertNotNull(this.context.getBean(TraceEndpoint.class)); - } - - @Test - public void testInfoEndpointConfiguration() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - TestUtils.addEnviroment(this.context, "info.foo:bar"); - this.context.register(EndpointAutoConfiguration.class); - this.context.refresh(); - InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class); - assertNotNull(endpoint); - assertNotNull(endpoint.invoke().get("git")); - assertEquals("bar", endpoint.invoke().get("foo")); - } - - @Test - public void testNoGitProperties() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - TestUtils.addEnviroment(this.context, - "spring.git.properties:classpath:nonexistent"); - this.context.register(EndpointAutoConfiguration.class); - this.context.refresh(); - InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class); - assertNotNull(endpoint); - assertNull(endpoint.invoke().get("git")); - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java deleted file mode 100644 index 093ef5681a0..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.autoconfigure; - -import java.io.FileNotFoundException; -import java.net.SocketException; -import java.net.URI; -import java.nio.charset.Charset; - -import org.junit.After; -import org.junit.Test; -import org.springframework.bootstrap.actuate.TestUtils; -import org.springframework.bootstrap.actuate.endpoint.AbstractEndpoint; -import org.springframework.bootstrap.actuate.endpoint.Endpoint; -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.web.WebMvcAutoConfiguration; -import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpMethod; -import org.springframework.http.client.ClientHttpRequest; -import org.springframework.http.client.ClientHttpResponse; -import org.springframework.http.client.SimpleClientHttpRequestFactory; -import org.springframework.stereotype.Controller; -import org.springframework.util.StreamUtils; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link EndpointWebMvcAutoConfiguration}. - * - * @author Phillip Webb - * @author Greg Turnquist - */ -public class EndpointWebMvcAutoConfigurationTests { - - private AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext(); - - @After - public void close() { - try { - this.applicationContext.close(); - } catch (Exception ex) { - } - } - - @Test - public void onSamePort() throws Exception { - this.applicationContext.register(RootConfig.class, - PropertyPlaceholderAutoConfiguration.class, - EmbeddedServletContainerAutoConfiguration.class, - WebMvcAutoConfiguration.class, - ManagementServerPropertiesAutoConfiguration.class, - EndpointWebMvcAutoConfiguration.class); - this.applicationContext.refresh(); - assertContent("/controller", 8080, "controlleroutput"); - assertContent("/endpoint", 8080, "endpointoutput"); - assertContent("/controller", 8081, null); - assertContent("/endpoint", 8081, null); - this.applicationContext.close(); - assertAllClosed(); - } - - @Test - public void onDifferentPort() throws Exception { - this.applicationContext.register(RootConfig.class, DifferentPortConfig.class, - PropertyPlaceholderAutoConfiguration.class, - EmbeddedServletContainerAutoConfiguration.class, - WebMvcAutoConfiguration.class, - ManagementServerPropertiesAutoConfiguration.class, - EndpointWebMvcAutoConfiguration.class); - this.applicationContext.refresh(); - assertContent("/controller", 8080, "controlleroutput"); - assertContent("/endpoint", 8080, null); - assertContent("/controller", 8081, null); - assertContent("/endpoint", 8081, "endpointoutput"); - this.applicationContext.close(); - assertAllClosed(); - } - - @Test - public void disabled() throws Exception { - this.applicationContext.register(RootConfig.class, DisableConfig.class, - PropertyPlaceholderAutoConfiguration.class, - EmbeddedServletContainerAutoConfiguration.class, - WebMvcAutoConfiguration.class, - ManagementServerPropertiesAutoConfiguration.class, - EndpointWebMvcAutoConfiguration.class); - this.applicationContext.refresh(); - assertContent("/controller", 8080, "controlleroutput"); - assertContent("/endpoint", 8080, null); - assertContent("/controller", 8081, null); - assertContent("/endpoint", 8081, null); - this.applicationContext.close(); - assertAllClosed(); - } - - @Test - public void specificPortsViaProperties() throws Exception { - TestUtils.addEnviroment(this.applicationContext, "server.port:7070", - "management.port:7071"); - this.applicationContext.register(RootConfig.class, - PropertyPlaceholderAutoConfiguration.class, - ManagementServerPropertiesAutoConfiguration.class, - ServerPropertiesAutoConfiguration.class, - EmbeddedServletContainerAutoConfiguration.class, - WebMvcAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class); - this.applicationContext.refresh(); - assertContent("/controller", 7070, "controlleroutput"); - assertContent("/endpoint", 7070, null); - assertContent("/controller", 7071, null); - assertContent("/endpoint", 7071, "endpointoutput"); - this.applicationContext.close(); - assertAllClosed(); - } - - @Test - public void contextPath() throws Exception { - TestUtils.addEnviroment(this.applicationContext, "management.contextPath:/test"); - this.applicationContext.register(RootConfig.class, - PropertyPlaceholderAutoConfiguration.class, - ManagementServerPropertiesAutoConfiguration.class, - ServerPropertiesAutoConfiguration.class, - EmbeddedServletContainerAutoConfiguration.class, - WebMvcAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class); - this.applicationContext.refresh(); - assertContent("/controller", 8080, "controlleroutput"); - assertContent("/test/endpoint", 8080, "endpointoutput"); - this.applicationContext.close(); - assertAllClosed(); - } - - private void assertAllClosed() throws Exception { - assertContent("/controller", 8080, null); - assertContent("/endpoint", 8080, null); - assertContent("/controller", 8081, null); - assertContent("/endpoint", 8081, null); - } - - 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); - try { - ClientHttpResponse response = request.execute(); - try { - String actual = StreamUtils.copyToString(response.getBody(), - Charset.forName("UTF-8")); - assertThat(actual, equalTo(expected)); - } finally { - response.close(); - } - } catch (Exception ex) { - if (expected == null) { - if (SocketException.class.isInstance(ex) - || FileNotFoundException.class.isInstance(ex)) { - return; - } - } - throw ex; - } - } - - @Configuration - public static class RootConfig { - - @Bean - public TestController testController() { - return new TestController(); - } - - @Bean - public Endpoint testEndpoint() { - return new AbstractEndpoint("/endpoint", false) { - @Override - public String invoke() { - return "endpointoutput"; - } - }; - } - } - - @Controller - public static class TestController { - - @RequestMapping("/controller") - @ResponseBody - public String requestMappedMethod() { - return "controlleroutput"; - } - - } - - @Configuration - public static class DifferentPortConfig { - - @Bean - public ManagementServerProperties managementServerProperties() { - ManagementServerProperties properties = new ManagementServerProperties(); - properties.setPort(8081); - return properties; - } - - } - - @Configuration - public static class DisableConfig { - - @Bean - public ManagementServerProperties managementServerProperties() { - ManagementServerProperties properties = new ManagementServerProperties(); - properties.setPort(0); - return properties; - } - - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java deleted file mode 100644 index 55182f6a5a5..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link ManagementServerPropertiesAutoConfiguration}. - * - * @author Phillip Webb - */ -public class ManagementServerPropertiesAutoConfigurationTests { - - @Test - public void defaultManagementServerProperties() { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - ManagementServerPropertiesAutoConfiguration.class); - assertThat(context.getBean(ManagementServerProperties.class).getPort(), - nullValue()); - context.close(); - } - - @Test - public void definedManagementServerProperties() throws Exception { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - Config.class, ManagementServerPropertiesAutoConfiguration.class); - assertThat(context.getBean(ManagementServerProperties.class).getPort(), - equalTo(Integer.valueOf(123))); - context.close(); - } - - @Configuration - public static class Config { - - @Bean - public ManagementServerProperties managementServerProperties() { - ManagementServerProperties properties = new ManagementServerProperties(); - properties.setPort(123); - return properties; - } - - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java deleted file mode 100644 index ea880547724..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; - -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.bootstrap.actuate.metrics.CounterService; -import org.springframework.bootstrap.actuate.metrics.GaugeService; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.mock.web.MockHttpServletResponse; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Matchers.anyDouble; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -/** - * Tests for {@link MetricFilterAutoConfiguration}. - * - * @author Phillip Webb - */ -public class MetricFilterAutoConfigurationTests { - - @Test - public void recordsHttpInteractions() throws Exception { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - Config.class, MetricFilterAutoConfiguration.class); - Filter filter = context.getBean(Filter.class); - final MockHttpServletRequest request = new MockHttpServletRequest("GET", - "/test/path"); - final MockHttpServletResponse response = new MockHttpServletResponse(); - FilterChain chain = mock(FilterChain.class); - willAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocation) throws Throwable { - response.setStatus(200); - return null; - } - }).given(chain).doFilter(request, response); - filter.doFilter(request, response, chain); - verify(context.getBean(CounterService.class)).increment("status.200.test.path"); - verify(context.getBean(GaugeService.class)).set(eq("response.test.path"), - anyDouble()); - context.close(); - } - - @Test - public void skipsFilterIfMissingServices() throws Exception { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - MetricFilterAutoConfiguration.class); - assertThat(context.getBeansOfType(Filter.class).size(), equalTo(0)); - context.close(); - } - - @Configuration - public static class Config { - - @Bean - public CounterService counterService() { - return mock(CounterService.class); - } - - @Bean - public GaugeService gaugeService() { - return mock(GaugeService.class); - } - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java deleted file mode 100644 index 733f98a2698..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.metrics.CounterService; -import org.springframework.bootstrap.actuate.metrics.DefaultCounterService; -import org.springframework.bootstrap.actuate.metrics.DefaultGaugeService; -import org.springframework.bootstrap.actuate.metrics.GaugeService; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.mock; - -/** - * Tests for {@link MetricRepositoryAutoConfiguration}. - * - * @author Phillip Webb - */ -public class MetricRepositoryAutoConfigurationTests { - - @Test - public void createServices() { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - MetricRepositoryAutoConfiguration.class); - assertNotNull(context.getBean(DefaultGaugeService.class)); - assertNotNull(context.getBean(DefaultCounterService.class)); - context.close(); - } - - @Test - public void skipsIfBeansExist() throws Exception { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - Config.class, MetricRepositoryAutoConfiguration.class); - assertThat(context.getBeansOfType(DefaultGaugeService.class).size(), equalTo(0)); - assertThat(context.getBeansOfType(DefaultCounterService.class).size(), equalTo(0)); - context.close(); - } - - @Configuration - public static class Config { - - @Bean - public GaugeService gaugeService() { - return mock(GaugeService.class); - } - - @Bean - public CounterService counterService() { - return mock(CounterService.class); - } - - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java deleted file mode 100644 index 11633cf97ff..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.junit.Test; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.mock.web.MockServletContext; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -/** - * Tests for {@link SecurityAutoConfiguration}. - * - * @author Dave Syer - */ -public class SecurityAutoConfigurationTests { - - private AnnotationConfigWebApplicationContext context; - - @Test - public void testWebConfiguration() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.setServletContext(new MockServletContext()); - this.context.register(SecurityAutoConfiguration.class, - EndpointAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(AuthenticationManager.class)); - } - - @Test - public void testOverrideAuthenticationManager() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.setServletContext(new MockServletContext()); - this.context.register(TestConfiguration.class, SecurityAutoConfiguration.class, - EndpointAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertEquals(this.context.getBean(TestConfiguration.class).authenticationManager, - this.context.getBean(AuthenticationManager.class)); - } - - @Configuration - protected static class TestConfiguration { - - private AuthenticationManager authenticationManager; - - @Bean - public AuthenticationManager myAuthenticationManager() { - this.authenticationManager = new AuthenticationManager() { - - @Override - public Authentication authenticate(Authentication authentication) - throws AuthenticationException { - return new TestingAuthenticationToken("foo", "bar"); - } - }; - return this.authenticationManager; - } - - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java deleted file mode 100644 index 81439201cb0..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository; -import org.springframework.bootstrap.actuate.trace.TraceRepository; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.mock; - -/** - * Tests for {@link TraceRepositoryAutoConfiguration}. - * - * @author Phillip Webb - */ -public class TraceRepositoryAutoConfigurationTests { - - @Test - public void configuresInMemoryTraceRepository() throws Exception { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - TraceRepositoryAutoConfiguration.class); - assertNotNull(context.getBean(InMemoryTraceRepository.class)); - context.close(); - } - - @Test - public void skipsIfRepositoryExists() throws Exception { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - Config.class, TraceRepositoryAutoConfiguration.class); - assertThat(context.getBeansOfType(InMemoryTraceRepository.class).size(), - equalTo(0)); - assertThat(context.getBeansOfType(TraceRepository.class).size(), equalTo(1)); - context.close(); - } - - @Configuration - public static class Config { - - @Bean - public TraceRepository traceRepository() { - return mock(TraceRepository.class); - } - - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java deleted file mode 100644 index ec2cb178d00..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.autoconfigure; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.trace.WebRequestTraceFilter; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import static org.junit.Assert.assertNotNull; - -/** - * Tests for {@link TraceWebFilterAutoConfiguration}. - * - * @author Phillip Webb - */ -public class TraceWebFilterAutoConfigurationTest { - - @Test - public void configureFilter() { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - PropertyPlaceholderAutoConfiguration.class, - TraceRepositoryAutoConfiguration.class, - TraceWebFilterAutoConfiguration.class); - assertNotNull(context.getBean(WebRequestTraceFilter.class)); - context.close(); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java deleted file mode 100644 index c3389cfb5db..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.Collections; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.bootstrap.actuate.TestUtils; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.core.env.MapPropertySource; -import org.springframework.core.env.PropertySource; -import org.springframework.http.MediaType; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -/** - * Abstract base class for endpoint tests. - * - * @author Phillip Webb - */ -public abstract class AbstractEndpointTests> { - - protected AnnotationConfigApplicationContext context; - - private final Class configClass; - - private final Class type; - - private final String path; - - private final boolean sensitive; - - private final String property; - - private MediaType[] produces; - - public AbstractEndpointTests(Class configClass, Class type, String path, - boolean sensitive, String property, MediaType... produces) { - this.configClass = configClass; - this.type = type; - this.path = path; - this.sensitive = sensitive; - this.property = property; - this.produces = produces; - } - - @Before - public void setup() { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(this.configClass); - this.context.refresh(); - } - - @Test - public void producesMediaType() { - assertThat(getEndpointBean().getProduces(), equalTo(this.produces)); - } - - @Test - public void getPath() throws Exception { - assertThat(getEndpointBean().getPath(), equalTo(this.path)); - } - - @Test - public void isSensitive() throws Exception { - assertThat(getEndpointBean().isSensitive(), equalTo(this.sensitive)); - } - - @Test - public void pathOverride() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - TestUtils.addEnviroment(this.context, this.property + ".path:/mypath"); - this.context.register(this.configClass); - this.context.refresh(); - assertThat(getEndpointBean().getPath(), equalTo("/mypath")); - } - - @Test - public void isSensitiveOverride() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - PropertySource propertySource = new MapPropertySource("test", - Collections. singletonMap(this.property + ".sensitive", - String.valueOf(!this.sensitive))); - this.context.getEnvironment().getPropertySources().addFirst(propertySource); - this.context.register(this.configClass); - this.context.refresh(); - assertThat(getEndpointBean().isSensitive(), equalTo(!this.sensitive)); - } - - @SuppressWarnings("unchecked") - protected T getEndpointBean() { - return (T) this.context.getBean(this.type); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java deleted file mode 100644 index 8f0844c5b6a..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import org.junit.Test; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.MediaType; - -import static org.hamcrest.Matchers.containsString; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link BeansEndpoint}. - * - * @author Phillip Webb - */ -public class BeansEndpointTests extends AbstractEndpointTests { - - public BeansEndpointTests() { - super(Config.class, BeansEndpoint.class, "/beans", true, "endpoints.beans", - MediaType.APPLICATION_JSON); - } - - @Test - public void invoke() throws Exception { - assertThat(getEndpointBean().invoke(), containsString("\"bean\": \"endpoint\"")); - } - - @Configuration - @EnableConfigurationProperties - public static class Config { - - @Bean - public BeansEndpoint endpoint() { - return new BeansEndpoint(); - } - - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java deleted file mode 100644 index 70696b8dabc..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.lang.management.ThreadInfo; -import java.util.List; - -import org.junit.Test; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.greaterThan; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link DumpEndpoint}. - * - * @author Phillip Webb - */ -public class DumpEndpointTests extends AbstractEndpointTests { - - public DumpEndpointTests() { - super(Config.class, DumpEndpoint.class, "/dump", true, "endpoints.dump"); - } - - @Test - public void invoke() throws Exception { - List threadInfo = getEndpointBean().invoke(); - assertThat(threadInfo.size(), greaterThan(0)); - } - - @Configuration - @EnableConfigurationProperties - public static class Config { - - @Bean - public DumpEndpoint endpoint() { - return new DumpEndpoint(); - } - - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java deleted file mode 100644 index 59b9d7b8a1a..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import org.junit.Test; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.greaterThan; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link EnvironmentEndpoint}. - * - * @author Phillip Webb - */ -public class EnvironmentEndpointTests extends AbstractEndpointTests { - - public EnvironmentEndpointTests() { - super(Config.class, EnvironmentEndpoint.class, "/env", true, "endpoints.env"); - } - - @Test - public void invoke() throws Exception { - assertThat(getEndpointBean().invoke().size(), greaterThan(0)); - } - - @Configuration - @EnableConfigurationProperties - public static class Config { - - @Bean - public EnvironmentEndpoint endpoint() { - return new EnvironmentEndpoint(); - } - - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java deleted file mode 100644 index ed580a2e842..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.health.HealthIndicator; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link HealthEndpoint}. - * - * @author Phillip Webb - */ -public class HealthEndpointTests extends AbstractEndpointTests> { - - public HealthEndpointTests() { - super(Config.class, HealthEndpoint.class, "/health", false, "endpoints.health"); - } - - @Test - public void invoke() throws Exception { - assertThat(getEndpointBean().invoke(), equalTo("fine")); - } - - @Configuration - @EnableConfigurationProperties - public static class Config { - - @Bean - public HealthEndpoint endpoint() { - return new HealthEndpoint(new HealthIndicator() { - @Override - public String health() { - return "fine"; - } - }); - } - - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java deleted file mode 100644 index 2f1c153a9dc..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.Collections; - -import org.junit.Test; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link InfoEndpoint}. - * - * @author Phillip Webb - */ -public class InfoEndpointTests extends AbstractEndpointTests { - - public InfoEndpointTests() { - super(Config.class, InfoEndpoint.class, "/info", true, "endpoints.info"); - } - - @Test - public void invoke() throws Exception { - assertThat(getEndpointBean().invoke().get("a"), equalTo((Object) "b")); - } - - @Configuration - @EnableConfigurationProperties - public static class Config { - - @Bean - public InfoEndpoint endpoint() { - return new InfoEndpoint(Collections.singletonMap("a", "b")); - } - - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java deleted file mode 100644 index a85d4bde297..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.Collection; -import java.util.Collections; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.metrics.Metric; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link MetricsEndpoint}. - * - * @author Phillip Webb - */ -public class MetricsEndpointTests extends AbstractEndpointTests { - - public MetricsEndpointTests() { - super(Config.class, MetricsEndpoint.class, "/metrics", true, "endpoints.metrics"); - } - - @Test - public void invoke() throws Exception { - assertThat(getEndpointBean().invoke().get("a"), equalTo((Object) 0.5)); - } - - @Configuration - @EnableConfigurationProperties - public static class Config { - - @Bean - public MetricsEndpoint endpoint() { - final Metric metric = new Metric("a", 0.5f); - PublicMetrics metrics = new PublicMetrics() { - @Override - public Collection metrics() { - return Collections.singleton(metric); - } - }; - return new MetricsEndpoint(metrics); - } - - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java deleted file mode 100644 index ce01c52d3c8..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.startsWith; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -/** - * Tests for {@link ShutdownEndpoint}. - * - * @author Phillip Webb - */ -public class ShutdownEndpointTests extends AbstractEndpointTests { - - public ShutdownEndpointTests() { - super(Config.class, ShutdownEndpoint.class, "/shutdown", true, - "endpoints.shutdown"); - } - - @Test - public void invoke() throws Exception { - assertThat((String) getEndpointBean().invoke().get("message"), - startsWith("Shutting down")); - assertTrue(this.context.isActive()); - Thread.sleep(600); - assertFalse(this.context.isActive()); - } - - @Configuration - @EnableConfigurationProperties - public static class Config { - - @Bean - public ManagementServerProperties managementServerProperties() { - ManagementServerProperties properties = new ManagementServerProperties(); - properties.setAllowShutdown(true); - return properties; - } - - @Bean - public ShutdownEndpoint endpoint() { - return new ShutdownEndpoint(); - } - - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java deleted file mode 100644 index e470fa3d89a..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.Collections; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository; -import org.springframework.bootstrap.actuate.trace.Trace; -import org.springframework.bootstrap.actuate.trace.TraceRepository; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link TraceEndpoint}. - * - * @author Phillip Webb - */ -public class TraceEndpointTests extends AbstractEndpointTests { - - public TraceEndpointTests() { - super(Config.class, TraceEndpoint.class, "/trace", true, "endpoints.trace"); - } - - @Test - public void invoke() throws Exception { - Trace trace = getEndpointBean().invoke().get(0); - assertThat(trace.getInfo().get("a"), equalTo((Object) "b")); - } - - @Configuration - @EnableConfigurationProperties - public static class Config { - - @Bean - public TraceEndpoint endpoint() { - TraceRepository repository = new InMemoryTraceRepository(); - repository.add(Collections. singletonMap("a", "b")); - return new TraceEndpoint(repository); - } - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java deleted file mode 100644 index faef1645dba..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.metrics.InMemoryMetricRepository; -import org.springframework.bootstrap.actuate.metrics.Metric; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -/** - * Tests for {@link VanillaPublicMetrics}. - * - * @author Phillip Webb - */ -public class VanillaPublicMetricsTests { - - @Test - public void testMetrics() throws Exception { - InMemoryMetricRepository repository = new InMemoryMetricRepository(); - repository.set("a", 0.5, new Date()); - VanillaPublicMetrics publicMetrics = new VanillaPublicMetrics(repository); - Map results = new HashMap(); - for (Metric metric : publicMetrics.metrics()) { - results.put(metric.getName(), metric); - } - assertTrue(results.containsKey("mem")); - assertTrue(results.containsKey("mem.free")); - assertThat(results.get("a").getValue(), equalTo(0.5)); - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java deleted file mode 100644 index de9408d4acb..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint.mvc; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.endpoint.Endpoint; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; - -/** - * Tests for {@link EndpointHandlerAdapter}. - * - * @author Phillip Webb - */ -public class EndpointHandlerAdapterTests { - - private EndpointHandlerAdapter adapter = new EndpointHandlerAdapter(); - - @Test - public void onlySupportsEndpoints() throws Exception { - assertTrue(this.adapter.supports(mock(Endpoint.class))); - assertFalse(this.adapter.supports(mock(Object.class))); - } - - // FIXME tests - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java deleted file mode 100644 index 0ed37e4739c..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.endpoint.mvc; - -import java.util.Arrays; - -import org.junit.Test; -import org.springframework.bootstrap.actuate.endpoint.AbstractEndpoint; -import org.springframework.bootstrap.actuate.endpoint.ActionEndpoint; -import org.springframework.mock.web.MockHttpServletRequest; - -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link EndpointHandlerMapping}. - * - * @author Phillip Webb - */ -public class EndpointHandlerMappingTests { - - @Test - public void withoutPrefix() throws Exception { - TestEndpoint endpointA = new TestEndpoint("/a"); - TestEndpoint endpointB = new TestEndpoint("/b"); - EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( - endpointA, endpointB)); - mapping.afterPropertiesSet(); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")) - .getHandler(), equalTo((Object) endpointA)); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/b")) - .getHandler(), equalTo((Object) endpointB)); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/c")), - nullValue()); - } - - @Test - public void withPrefix() throws Exception { - TestEndpoint endpointA = new TestEndpoint("/a"); - TestEndpoint endpointB = new TestEndpoint("/b"); - EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( - endpointA, endpointB)); - mapping.setPrefix("/a"); - mapping.afterPropertiesSet(); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a/a")) - .getHandler(), equalTo((Object) endpointA)); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a/b")) - .getHandler(), equalTo((Object) endpointB)); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")), - nullValue()); - } - - @Test - public void onlyGetHttpMethodForNonActionEndpoints() throws Exception { - TestEndpoint endpoint = new TestEndpoint("/a"); - EndpointHandlerMapping mapping = new EndpointHandlerMapping( - Arrays.asList(endpoint)); - mapping.afterPropertiesSet(); - assertNotNull(mapping.getHandler(new MockHttpServletRequest("GET", "/a"))); - assertNull(mapping.getHandler(new MockHttpServletRequest("POST", "/a"))); - } - - @Test - public void onlyPostHttpMethodForActionEndpoints() throws Exception { - TestEndpoint endpoint = new TestActionEndpoint("/a"); - EndpointHandlerMapping mapping = new EndpointHandlerMapping( - Arrays.asList(endpoint)); - mapping.afterPropertiesSet(); - assertNull(mapping.getHandler(new MockHttpServletRequest("GET", "/a"))); - assertNotNull(mapping.getHandler(new MockHttpServletRequest("POST", "/a"))); - } - - @Test - public void disabled() throws Exception { - TestEndpoint endpointA = new TestEndpoint("/a"); - EndpointHandlerMapping mapping = new EndpointHandlerMapping( - Arrays.asList(endpointA)); - mapping.setDisabled(true); - mapping.afterPropertiesSet(); - assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")), - nullValue()); - } - - private static class TestEndpoint extends AbstractEndpoint { - - public TestEndpoint(String path) { - super(path); - } - - @Override - public Object invoke() { - return null; - } - - } - - private static class TestActionEndpoint extends TestEndpoint implements - ActionEndpoint { - - public TestActionEndpoint(String path) { - super(path); - } - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java deleted file mode 100644 index e70fbabc3b9..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.fixme; - -/** - * @author Dave Syer - */ -public class ErrorConfigurationTests { - - // private AnnotationConfigApplicationContext context; - // - // @Test - // public void testErrorEndpointConfiguration() throws Exception { - // this.context = new AnnotationConfigApplicationContext(); - // this.context.register(ErrorConfiguration.class, - // ActuatorServerPropertiesConfiguration.class, - // PropertyPlaceholderAutoConfiguration.class); - // this.context.refresh(); - // assertNotNull(this.context.getBean(ErrorEndpoint.class)); - // ConfigurableEmbeddedServletContainerFactory factory = Mockito - // .mock(ConfigurableEmbeddedServletContainerFactory.class); - // this.context.getBean(EmbeddedServletContainerCustomizer.class).customize(factory); - // Mockito.verify(factory).addErrorPages(Mockito.any(ErrorPage.class)); - // } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java deleted file mode 100644 index 780d3032e9e..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.health; - -import org.junit.Test; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link VanillaHealthIndicator}. - * - * @author Phillip Webb - */ -public class VanillaHealthIndicatorTests { - - @Test - public void ok() throws Exception { - VanillaHealthIndicator healthIndicator = new VanillaHealthIndicator(); - assertThat(healthIndicator.health(), equalTo("ok")); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java deleted file mode 100644 index b50b297650f..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -import org.junit.Ignore; -import org.junit.Test; - -import static org.junit.Assert.fail; - -/** - * Tests for {@link DefaultCounterService}. - */ -@Ignore -public class DefaultCounterServiceTests { - - // FIXME - - @Test - public void test() { - fail("Not yet implemented"); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java deleted file mode 100644 index 460a894edc9..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.metrics; - -import org.junit.Ignore; -import org.junit.Test; - -import static org.junit.Assert.fail; - -/** - * Tests for {@link DefaultGaugeService}. - */ -@Ignore -public class DefaultGaugeServiceTests { - - // FIXME - - @Test - public void test() { - fail("Not yet implemented"); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java deleted file mode 100644 index abc06723a8b..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.actuate.metrics; - -import org.junit.Ignore; -import org.junit.Test; - -import static org.junit.Assert.fail; - -/** - * Tests for {@link InMemoryMetricRepository}. - */ -@Ignore -public class InMemoryMetricRepositoryTests { - - // FIXME write tests - // FIXME possibly also add Metric/Measurement tests - - @Test - public void test() { - fail("Not yet implemented"); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java deleted file mode 100644 index dc9de4458b0..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.properties; - -import java.util.Collections; - -import org.junit.Test; -import org.springframework.beans.MutablePropertyValues; -import org.springframework.bootstrap.actuate.properties.SecurityProperties; -import org.springframework.bootstrap.bind.RelaxedDataBinder; -import org.springframework.core.convert.support.DefaultConversionService; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -/** - * Tests for {@link SecurityProperties}. - * - * @author Dave Syer - */ -public class SecurityPropertiesTests { - - @Test - public void testBindingIgnoredSingleValued() { - SecurityProperties security = new SecurityProperties(); - RelaxedDataBinder binder = new RelaxedDataBinder(security, "security"); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", "/css/**"))); - assertFalse(binder.getBindingResult().hasErrors()); - assertEquals(1, security.getIgnored().length); - } - - @Test - public void testBindingIgnoredMultiValued() { - SecurityProperties security = new SecurityProperties(); - RelaxedDataBinder binder = new RelaxedDataBinder(security, "security"); - binder.setConversionService(new DefaultConversionService()); - binder.bind(new MutablePropertyValues(Collections.singletonMap( - "security.ignored", "/css/**,/images/**"))); - assertFalse(binder.getBindingResult().hasErrors()); - assertEquals(2, security.getIgnored().length); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java deleted file mode 100644 index 84e67787acf..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.security; - -import org.junit.Ignore; -import org.junit.Test; - -import static org.junit.Assert.fail; - -/** - * Tests for {@link AuthenticationAuditListener}. - */ -@Ignore -public class AuthenticationAuditListenerTests { - - // FIXME - - @Test - public void test() { - fail("Not yet implemented"); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java deleted file mode 100644 index a06b00998dc..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.security; - -import org.junit.Ignore; -import org.junit.Test; - -import static org.junit.Assert.fail; - -/** - * Tests for {@link AuthenticationAuditListener}. - */ -@Ignore -public class AuthorizationAuditListenerTests { - - // FIXME - - @Test - public void test() { - fail("Not yet implemented"); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java deleted file mode 100644 index 6342c018d41..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.trace; - -import java.util.Collections; -import java.util.List; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * Tests for {@link InMemoryTraceRepository}. - * - * @author Dave Syer - */ -public class InMemoryTraceRepositoryTests { - - private InMemoryTraceRepository repository = new InMemoryTraceRepository(); - - @Test - public void capacityLimited() { - this.repository.setCapacity(2); - this.repository.add(Collections. singletonMap("foo", "bar")); - this.repository.add(Collections. singletonMap("bar", "foo")); - this.repository.add(Collections. singletonMap("bar", "bar")); - List traces = this.repository.findAll(); - assertEquals(2, traces.size()); - assertEquals("bar", traces.get(1).getInfo().get("bar")); - } - -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java b/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java deleted file mode 100644 index cc291b2896f..00000000000 --- a/spring-zero-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.actuate.trace; - -import java.util.Map; - -import org.junit.Test; -import org.springframework.mock.web.MockHttpServletRequest; - -import static org.junit.Assert.assertEquals; - -/** - * Tests for {@link WebRequestTraceFilter}. - * - * @author Dave Syer - */ -public class WebRequestTraceFilterTests { - - private WebRequestTraceFilter filter = new WebRequestTraceFilter( - new InMemoryTraceRepository()); - - @Test - public void filterDumpsRequest() { - MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo"); - request.addHeader("Accept", "application/json"); - Map trace = this.filter.getTrace(request); - assertEquals("GET", trace.get("method")); - assertEquals("/foo", trace.get("path")); - assertEquals("{Accept=application/json}", trace.get("headers").toString()); - } -} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/TestUtils.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/TestUtils.java new file mode 100644 index 00000000000..e0e4ea2fec3 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/TestUtils.java @@ -0,0 +1,43 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.MapPropertySource; + +/** + * @author Dave Syer + * + */ +public class TestUtils { + + public static void addEnviroment(ConfigurableApplicationContext context, + String... pairs) { + Map map = new HashMap(); + for (String pair : pairs) { + int index = pair.indexOf(":"); + String key = pair.substring(0, index > 0 ? index : pair.length()); + String value = index > 0 ? pair.substring(index + 1) : ""; + map.put(key, value); + } + context.getEnvironment().getPropertySources() + .addFirst(new MapPropertySource("test", map)); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/AuditEventTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/AuditEventTests.java new file mode 100644 index 00000000000..3016173ed9d --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/AuditEventTests.java @@ -0,0 +1,51 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.audit; + +import java.util.Collections; + +import org.junit.Test; +import org.springframework.zero.actuate.audit.AuditEvent; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * Tests for {@link AuditEvent}. + * + * @author Dave Syer + */ +public class AuditEventTests { + + @Test + public void testNowEvent() throws Exception { + 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()); + assertNotNull(event.getTimestamp()); + } + + @Test + public void testConvertStringsToData() throws Exception { + AuditEvent event = new AuditEvent("phil", "UNKNOWN", "a=b", "c=d"); + assertEquals("b", event.getData().get("a")); + assertEquals("d", event.getData().get("c")); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/InMemoryAuditEventRepositoryTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/InMemoryAuditEventRepositoryTests.java new file mode 100644 index 00000000000..9cbe0b89636 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/InMemoryAuditEventRepositoryTests.java @@ -0,0 +1,47 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.audit; + +import java.util.Date; + +import org.junit.Test; +import org.springframework.zero.actuate.audit.AuditEvent; +import org.springframework.zero.actuate.audit.InMemoryAuditEventRepository; + +import static org.junit.Assert.assertEquals; + +/** + * Tests for {@link InMemoryAuditEventRepository}. + * + * @author Dave Syer + */ +public class InMemoryAuditEventRepositoryTests { + + private InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(); + + @Test + public void testAddToCapacity() throws Exception { + this.repository.setCapacity(2); + this.repository.add(new AuditEvent("phil", "UNKNOWN")); + this.repository.add(new AuditEvent("phil", "UNKNOWN")); + this.repository.add(new AuditEvent("dave", "UNKNOWN")); + this.repository.add(new AuditEvent("dave", "UNKNOWN")); + this.repository.add(new AuditEvent("phil", "UNKNOWN")); + assertEquals(2, this.repository.find("phil", new Date(0L)).size()); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/listener/AuditListenerTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/listener/AuditListenerTests.java new file mode 100644 index 00000000000..9031611cb81 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/audit/listener/AuditListenerTests.java @@ -0,0 +1,46 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.audit.listener; + +import java.util.Collections; + +import org.junit.Test; +import org.springframework.zero.actuate.audit.AuditEvent; +import org.springframework.zero.actuate.audit.AuditEventRepository; +import org.springframework.zero.actuate.audit.listener.AuditApplicationEvent; +import org.springframework.zero.actuate.audit.listener.AuditListener; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +/** + * Tests for {@link AuditListener}. + * + * @author Phillip Webb + */ +public class AuditListenerTests { + + @Test + public void testStoredEvents() { + AuditEventRepository repository = mock(AuditEventRepository.class); + AuditEvent event = new AuditEvent("principal", "type", + Collections. emptyMap()); + AuditListener listener = new AuditListener(repository); + listener.onApplicationEvent(new AuditApplicationEvent(event)); + verify(repository).add(event); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/AuditAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/AuditAutoConfigurationTests.java new file mode 100644 index 00000000000..e5b3df9e671 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/AuditAutoConfigurationTests.java @@ -0,0 +1,74 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.audit.AuditEventRepository; +import org.springframework.zero.actuate.audit.InMemoryAuditEventRepository; +import org.springframework.zero.actuate.autoconfigure.AuditAutoConfiguration; +import org.springframework.zero.actuate.security.AuthenticationAuditListener; +import org.springframework.zero.actuate.security.AuthorizationAuditListener; + +import static org.hamcrest.Matchers.instanceOf; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link AuditAutoConfiguration}. + * + * @author Dave Syer + */ +public class AuditAutoConfigurationTests { + + private AnnotationConfigApplicationContext context; + + @Test + public void testTraceConfiguration() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(AuditAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(AuditEventRepository.class)); + assertNotNull(this.context.getBean(AuthenticationAuditListener.class)); + assertNotNull(this.context.getBean(AuthorizationAuditListener.class)); + } + + @Test + public void ownAutoRepository() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(Config.class, AuditAutoConfiguration.class); + this.context.refresh(); + assertThat(this.context.getBean(AuditEventRepository.class), + instanceOf(TestAuditEventRepository.class)); + } + + @Configuration + public static class Config { + + @Bean + public TestAuditEventRepository testAuditEventRepository() { + return new TestAuditEventRepository(); + } + + } + + public static class TestAuditEventRepository extends InMemoryAuditEventRepository { + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointAutoConfigurationTests.java new file mode 100644 index 00000000000..7955089ff55 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointAutoConfigurationTests.java @@ -0,0 +1,88 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.autoconfigure; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.zero.actuate.TestUtils; +import org.springframework.zero.actuate.autoconfigure.EndpointAutoConfiguration; +import org.springframework.zero.actuate.endpoint.BeansEndpoint; +import org.springframework.zero.actuate.endpoint.DumpEndpoint; +import org.springframework.zero.actuate.endpoint.EnvironmentEndpoint; +import org.springframework.zero.actuate.endpoint.HealthEndpoint; +import org.springframework.zero.actuate.endpoint.InfoEndpoint; +import org.springframework.zero.actuate.endpoint.MetricsEndpoint; +import org.springframework.zero.actuate.endpoint.ShutdownEndpoint; +import org.springframework.zero.actuate.endpoint.TraceEndpoint; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +/** + * Tests for {@link EndpointAutoConfiguration}. + * + * @author Dave Syer + * @author Phillip Webb + */ +public class EndpointAutoConfigurationTests { + + private AnnotationConfigApplicationContext context; + + @Before + public void setup() { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(EndpointAutoConfiguration.class); + this.context.refresh(); + } + + @Test + public void endpoints() throws Exception { + assertNotNull(this.context.getBean(BeansEndpoint.class)); + assertNotNull(this.context.getBean(DumpEndpoint.class)); + assertNotNull(this.context.getBean(EnvironmentEndpoint.class)); + assertNotNull(this.context.getBean(HealthEndpoint.class)); + assertNotNull(this.context.getBean(InfoEndpoint.class)); + assertNotNull(this.context.getBean(MetricsEndpoint.class)); + assertNotNull(this.context.getBean(ShutdownEndpoint.class)); + assertNotNull(this.context.getBean(TraceEndpoint.class)); + } + + @Test + public void testInfoEndpointConfiguration() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + TestUtils.addEnviroment(this.context, "info.foo:bar"); + this.context.register(EndpointAutoConfiguration.class); + this.context.refresh(); + InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class); + assertNotNull(endpoint); + assertNotNull(endpoint.invoke().get("git")); + assertEquals("bar", endpoint.invoke().get("foo")); + } + + @Test + public void testNoGitProperties() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + TestUtils.addEnviroment(this.context, + "spring.git.properties:classpath:nonexistent"); + this.context.register(EndpointAutoConfiguration.class); + this.context.refresh(); + InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class); + assertNotNull(endpoint); + assertNull(endpoint.invoke().get("git")); + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java new file mode 100644 index 00000000000..c47a1e603ea --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java @@ -0,0 +1,239 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.autoconfigure; + +import java.io.FileNotFoundException; +import java.net.SocketException; +import java.net.URI; +import java.nio.charset.Charset; + +import org.junit.After; +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.stereotype.Controller; +import org.springframework.util.StreamUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.zero.actuate.TestUtils; +import org.springframework.zero.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; +import org.springframework.zero.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration; +import org.springframework.zero.actuate.endpoint.AbstractEndpoint; +import org.springframework.zero.actuate.endpoint.Endpoint; +import org.springframework.zero.actuate.properties.ManagementServerProperties; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.zero.autoconfigure.web.ServerPropertiesAutoConfiguration; +import org.springframework.zero.autoconfigure.web.WebMvcAutoConfiguration; +import org.springframework.zero.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link EndpointWebMvcAutoConfiguration}. + * + * @author Phillip Webb + * @author Greg Turnquist + */ +public class EndpointWebMvcAutoConfigurationTests { + + private AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext(); + + @After + public void close() { + try { + this.applicationContext.close(); + } catch (Exception ex) { + } + } + + @Test + public void onSamePort() throws Exception { + this.applicationContext.register(RootConfig.class, + PropertyPlaceholderAutoConfiguration.class, + EmbeddedServletContainerAutoConfiguration.class, + WebMvcAutoConfiguration.class, + ManagementServerPropertiesAutoConfiguration.class, + EndpointWebMvcAutoConfiguration.class); + this.applicationContext.refresh(); + assertContent("/controller", 8080, "controlleroutput"); + assertContent("/endpoint", 8080, "endpointoutput"); + assertContent("/controller", 8081, null); + assertContent("/endpoint", 8081, null); + this.applicationContext.close(); + assertAllClosed(); + } + + @Test + public void onDifferentPort() throws Exception { + this.applicationContext.register(RootConfig.class, DifferentPortConfig.class, + PropertyPlaceholderAutoConfiguration.class, + EmbeddedServletContainerAutoConfiguration.class, + WebMvcAutoConfiguration.class, + ManagementServerPropertiesAutoConfiguration.class, + EndpointWebMvcAutoConfiguration.class); + this.applicationContext.refresh(); + assertContent("/controller", 8080, "controlleroutput"); + assertContent("/endpoint", 8080, null); + assertContent("/controller", 8081, null); + assertContent("/endpoint", 8081, "endpointoutput"); + this.applicationContext.close(); + assertAllClosed(); + } + + @Test + public void disabled() throws Exception { + this.applicationContext.register(RootConfig.class, DisableConfig.class, + PropertyPlaceholderAutoConfiguration.class, + EmbeddedServletContainerAutoConfiguration.class, + WebMvcAutoConfiguration.class, + ManagementServerPropertiesAutoConfiguration.class, + EndpointWebMvcAutoConfiguration.class); + this.applicationContext.refresh(); + assertContent("/controller", 8080, "controlleroutput"); + assertContent("/endpoint", 8080, null); + assertContent("/controller", 8081, null); + assertContent("/endpoint", 8081, null); + this.applicationContext.close(); + assertAllClosed(); + } + + @Test + public void specificPortsViaProperties() throws Exception { + TestUtils.addEnviroment(this.applicationContext, "server.port:7070", + "management.port:7071"); + this.applicationContext.register(RootConfig.class, + PropertyPlaceholderAutoConfiguration.class, + ManagementServerPropertiesAutoConfiguration.class, + ServerPropertiesAutoConfiguration.class, + EmbeddedServletContainerAutoConfiguration.class, + WebMvcAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class); + this.applicationContext.refresh(); + assertContent("/controller", 7070, "controlleroutput"); + assertContent("/endpoint", 7070, null); + assertContent("/controller", 7071, null); + assertContent("/endpoint", 7071, "endpointoutput"); + this.applicationContext.close(); + assertAllClosed(); + } + + @Test + public void contextPath() throws Exception { + TestUtils.addEnviroment(this.applicationContext, "management.contextPath:/test"); + this.applicationContext.register(RootConfig.class, + PropertyPlaceholderAutoConfiguration.class, + ManagementServerPropertiesAutoConfiguration.class, + ServerPropertiesAutoConfiguration.class, + EmbeddedServletContainerAutoConfiguration.class, + WebMvcAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class); + this.applicationContext.refresh(); + assertContent("/controller", 8080, "controlleroutput"); + assertContent("/test/endpoint", 8080, "endpointoutput"); + this.applicationContext.close(); + assertAllClosed(); + } + + private void assertAllClosed() throws Exception { + assertContent("/controller", 8080, null); + assertContent("/endpoint", 8080, null); + assertContent("/controller", 8081, null); + assertContent("/endpoint", 8081, null); + } + + 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); + try { + ClientHttpResponse response = request.execute(); + try { + String actual = StreamUtils.copyToString(response.getBody(), + Charset.forName("UTF-8")); + assertThat(actual, equalTo(expected)); + } finally { + response.close(); + } + } catch (Exception ex) { + if (expected == null) { + if (SocketException.class.isInstance(ex) + || FileNotFoundException.class.isInstance(ex)) { + return; + } + } + throw ex; + } + } + + @Configuration + public static class RootConfig { + + @Bean + public TestController testController() { + return new TestController(); + } + + @Bean + public Endpoint testEndpoint() { + return new AbstractEndpoint("/endpoint", false) { + @Override + public String invoke() { + return "endpointoutput"; + } + }; + } + } + + @Controller + public static class TestController { + + @RequestMapping("/controller") + @ResponseBody + public String requestMappedMethod() { + return "controlleroutput"; + } + + } + + @Configuration + public static class DifferentPortConfig { + + @Bean + public ManagementServerProperties managementServerProperties() { + ManagementServerProperties properties = new ManagementServerProperties(); + properties.setPort(8081); + return properties; + } + + } + + @Configuration + public static class DisableConfig { + + @Bean + public ManagementServerProperties managementServerProperties() { + ManagementServerProperties properties = new ManagementServerProperties(); + properties.setPort(0); + return properties; + } + + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java new file mode 100644 index 00000000000..e3ab86f5ebc --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.autoconfigure; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration; +import org.springframework.zero.actuate.properties.ManagementServerProperties; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.nullValue; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link ManagementServerPropertiesAutoConfiguration}. + * + * @author Phillip Webb + */ +public class ManagementServerPropertiesAutoConfigurationTests { + + @Test + public void defaultManagementServerProperties() { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + ManagementServerPropertiesAutoConfiguration.class); + assertThat(context.getBean(ManagementServerProperties.class).getPort(), + nullValue()); + context.close(); + } + + @Test + public void definedManagementServerProperties() throws Exception { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + Config.class, ManagementServerPropertiesAutoConfiguration.class); + assertThat(context.getBean(ManagementServerProperties.class).getPort(), + equalTo(Integer.valueOf(123))); + context.close(); + } + + @Configuration + public static class Config { + + @Bean + public ManagementServerProperties managementServerProperties() { + ManagementServerProperties properties = new ManagementServerProperties(); + properties.setPort(123); + return properties; + } + + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java new file mode 100644 index 00000000000..e29e8cd3409 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java @@ -0,0 +1,94 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; + +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.zero.actuate.autoconfigure.MetricFilterAutoConfiguration; +import org.springframework.zero.actuate.metrics.CounterService; +import org.springframework.zero.actuate.metrics.GaugeService; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Matchers.anyDouble; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +/** + * Tests for {@link MetricFilterAutoConfiguration}. + * + * @author Phillip Webb + */ +public class MetricFilterAutoConfigurationTests { + + @Test + public void recordsHttpInteractions() throws Exception { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + Config.class, MetricFilterAutoConfiguration.class); + Filter filter = context.getBean(Filter.class); + final MockHttpServletRequest request = new MockHttpServletRequest("GET", + "/test/path"); + final MockHttpServletResponse response = new MockHttpServletResponse(); + FilterChain chain = mock(FilterChain.class); + willAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) throws Throwable { + response.setStatus(200); + return null; + } + }).given(chain).doFilter(request, response); + filter.doFilter(request, response, chain); + verify(context.getBean(CounterService.class)).increment("status.200.test.path"); + verify(context.getBean(GaugeService.class)).set(eq("response.test.path"), + anyDouble()); + context.close(); + } + + @Test + public void skipsFilterIfMissingServices() throws Exception { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + MetricFilterAutoConfiguration.class); + assertThat(context.getBeansOfType(Filter.class).size(), equalTo(0)); + context.close(); + } + + @Configuration + public static class Config { + + @Bean + public CounterService counterService() { + return mock(CounterService.class); + } + + @Bean + public GaugeService gaugeService() { + return mock(GaugeService.class); + } + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java new file mode 100644 index 00000000000..b5c2cdb618d --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java @@ -0,0 +1,73 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.autoconfigure.MetricRepositoryAutoConfiguration; +import org.springframework.zero.actuate.metrics.CounterService; +import org.springframework.zero.actuate.metrics.DefaultCounterService; +import org.springframework.zero.actuate.metrics.DefaultGaugeService; +import org.springframework.zero.actuate.metrics.GaugeService; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.mock; + +/** + * Tests for {@link MetricRepositoryAutoConfiguration}. + * + * @author Phillip Webb + */ +public class MetricRepositoryAutoConfigurationTests { + + @Test + public void createServices() { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + MetricRepositoryAutoConfiguration.class); + assertNotNull(context.getBean(DefaultGaugeService.class)); + assertNotNull(context.getBean(DefaultCounterService.class)); + context.close(); + } + + @Test + public void skipsIfBeansExist() throws Exception { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + Config.class, MetricRepositoryAutoConfiguration.class); + assertThat(context.getBeansOfType(DefaultGaugeService.class).size(), equalTo(0)); + assertThat(context.getBeansOfType(DefaultCounterService.class).size(), equalTo(0)); + context.close(); + } + + @Configuration + public static class Config { + + @Bean + public GaugeService gaugeService() { + return mock(GaugeService.class); + } + + @Bean + public CounterService counterService() { + return mock(CounterService.class); + } + + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfigurationTests.java new file mode 100644 index 00000000000..12ee2232a09 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfigurationTests.java @@ -0,0 +1,87 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.mock.web.MockServletContext; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.TestingAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import org.springframework.zero.actuate.autoconfigure.EndpointAutoConfiguration; +import org.springframework.zero.actuate.autoconfigure.SecurityAutoConfiguration; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * Tests for {@link SecurityAutoConfiguration}. + * + * @author Dave Syer + */ +public class SecurityAutoConfigurationTests { + + private AnnotationConfigWebApplicationContext context; + + @Test + public void testWebConfiguration() throws Exception { + this.context = new AnnotationConfigWebApplicationContext(); + this.context.setServletContext(new MockServletContext()); + this.context.register(SecurityAutoConfiguration.class, + EndpointAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(AuthenticationManager.class)); + } + + @Test + public void testOverrideAuthenticationManager() throws Exception { + this.context = new AnnotationConfigWebApplicationContext(); + this.context.setServletContext(new MockServletContext()); + this.context.register(TestConfiguration.class, SecurityAutoConfiguration.class, + EndpointAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertEquals(this.context.getBean(TestConfiguration.class).authenticationManager, + this.context.getBean(AuthenticationManager.class)); + } + + @Configuration + protected static class TestConfiguration { + + private AuthenticationManager authenticationManager; + + @Bean + public AuthenticationManager myAuthenticationManager() { + this.authenticationManager = new AuthenticationManager() { + + @Override + public Authentication authenticate(Authentication authentication) + throws AuthenticationException { + return new TestingAuthenticationToken("foo", "bar"); + } + }; + return this.authenticationManager; + } + + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java new file mode 100644 index 00000000000..a35ae93c4c3 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java @@ -0,0 +1,67 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.autoconfigure.TraceRepositoryAutoConfiguration; +import org.springframework.zero.actuate.trace.InMemoryTraceRepository; +import org.springframework.zero.actuate.trace.TraceRepository; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.mock; + +/** + * Tests for {@link TraceRepositoryAutoConfiguration}. + * + * @author Phillip Webb + */ +public class TraceRepositoryAutoConfigurationTests { + + @Test + public void configuresInMemoryTraceRepository() throws Exception { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + TraceRepositoryAutoConfiguration.class); + assertNotNull(context.getBean(InMemoryTraceRepository.class)); + context.close(); + } + + @Test + public void skipsIfRepositoryExists() throws Exception { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + Config.class, TraceRepositoryAutoConfiguration.class); + assertThat(context.getBeansOfType(InMemoryTraceRepository.class).size(), + equalTo(0)); + assertThat(context.getBeansOfType(TraceRepository.class).size(), equalTo(1)); + context.close(); + } + + @Configuration + public static class Config { + + @Bean + public TraceRepository traceRepository() { + return mock(TraceRepository.class); + } + + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java new file mode 100644 index 00000000000..1272bf2302b --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java @@ -0,0 +1,45 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.autoconfigure; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.zero.actuate.autoconfigure.TraceRepositoryAutoConfiguration; +import org.springframework.zero.actuate.autoconfigure.TraceWebFilterAutoConfiguration; +import org.springframework.zero.actuate.trace.WebRequestTraceFilter; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; + +import static org.junit.Assert.assertNotNull; + +/** + * Tests for {@link TraceWebFilterAutoConfiguration}. + * + * @author Phillip Webb + */ +public class TraceWebFilterAutoConfigurationTest { + + @Test + public void configureFilter() { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + PropertyPlaceholderAutoConfiguration.class, + TraceRepositoryAutoConfiguration.class, + TraceWebFilterAutoConfiguration.class); + assertNotNull(context.getBean(WebRequestTraceFilter.class)); + context.close(); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/AbstractEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/AbstractEndpointTests.java new file mode 100644 index 00000000000..8b3e957e105 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/AbstractEndpointTests.java @@ -0,0 +1,112 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.Collections; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.core.env.MapPropertySource; +import org.springframework.core.env.PropertySource; +import org.springframework.http.MediaType; +import org.springframework.zero.actuate.TestUtils; +import org.springframework.zero.actuate.endpoint.Endpoint; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Abstract base class for endpoint tests. + * + * @author Phillip Webb + */ +public abstract class AbstractEndpointTests> { + + protected AnnotationConfigApplicationContext context; + + private final Class configClass; + + private final Class type; + + private final String path; + + private final boolean sensitive; + + private final String property; + + private MediaType[] produces; + + public AbstractEndpointTests(Class configClass, Class type, String path, + boolean sensitive, String property, MediaType... produces) { + this.configClass = configClass; + this.type = type; + this.path = path; + this.sensitive = sensitive; + this.property = property; + this.produces = produces; + } + + @Before + public void setup() { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(this.configClass); + this.context.refresh(); + } + + @Test + public void producesMediaType() { + assertThat(getEndpointBean().getProduces(), equalTo(this.produces)); + } + + @Test + public void getPath() throws Exception { + assertThat(getEndpointBean().getPath(), equalTo(this.path)); + } + + @Test + public void isSensitive() throws Exception { + assertThat(getEndpointBean().isSensitive(), equalTo(this.sensitive)); + } + + @Test + public void pathOverride() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + TestUtils.addEnviroment(this.context, this.property + ".path:/mypath"); + this.context.register(this.configClass); + this.context.refresh(); + assertThat(getEndpointBean().getPath(), equalTo("/mypath")); + } + + @Test + public void isSensitiveOverride() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + PropertySource propertySource = new MapPropertySource("test", + Collections. singletonMap(this.property + ".sensitive", + String.valueOf(!this.sensitive))); + this.context.getEnvironment().getPropertySources().addFirst(propertySource); + this.context.register(this.configClass); + this.context.refresh(); + assertThat(getEndpointBean().isSensitive(), equalTo(!this.sensitive)); + } + + @SuppressWarnings("unchecked") + protected T getEndpointBean() { + return (T) this.context.getBean(this.type); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/BeansEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/BeansEndpointTests.java new file mode 100644 index 00000000000..39b85d54cbd --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/BeansEndpointTests.java @@ -0,0 +1,56 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.zero.actuate.endpoint.BeansEndpoint; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +import static org.hamcrest.Matchers.containsString; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link BeansEndpoint}. + * + * @author Phillip Webb + */ +public class BeansEndpointTests extends AbstractEndpointTests { + + public BeansEndpointTests() { + super(Config.class, BeansEndpoint.class, "/beans", true, "endpoints.beans", + MediaType.APPLICATION_JSON); + } + + @Test + public void invoke() throws Exception { + assertThat(getEndpointBean().invoke(), containsString("\"bean\": \"endpoint\"")); + } + + @Configuration + @EnableConfigurationProperties + public static class Config { + + @Bean + public BeansEndpoint endpoint() { + return new BeansEndpoint(); + } + + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/DumpEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/DumpEndpointTests.java new file mode 100644 index 00000000000..64a5c8811ad --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/DumpEndpointTests.java @@ -0,0 +1,58 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.lang.management.ThreadInfo; +import java.util.List; + +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.endpoint.DumpEndpoint; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link DumpEndpoint}. + * + * @author Phillip Webb + */ +public class DumpEndpointTests extends AbstractEndpointTests { + + public DumpEndpointTests() { + super(Config.class, DumpEndpoint.class, "/dump", true, "endpoints.dump"); + } + + @Test + public void invoke() throws Exception { + List threadInfo = getEndpointBean().invoke(); + assertThat(threadInfo.size(), greaterThan(0)); + } + + @Configuration + @EnableConfigurationProperties + public static class Config { + + @Bean + public DumpEndpoint endpoint() { + return new DumpEndpoint(); + } + + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/EnvironmentEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/EnvironmentEndpointTests.java new file mode 100644 index 00000000000..577e34920ca --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/EnvironmentEndpointTests.java @@ -0,0 +1,54 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.endpoint.EnvironmentEndpoint; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link EnvironmentEndpoint}. + * + * @author Phillip Webb + */ +public class EnvironmentEndpointTests extends AbstractEndpointTests { + + public EnvironmentEndpointTests() { + super(Config.class, EnvironmentEndpoint.class, "/env", true, "endpoints.env"); + } + + @Test + public void invoke() throws Exception { + assertThat(getEndpointBean().invoke().size(), greaterThan(0)); + } + + @Configuration + @EnableConfigurationProperties + public static class Config { + + @Bean + public EnvironmentEndpoint endpoint() { + return new EnvironmentEndpoint(); + } + + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/HealthEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/HealthEndpointTests.java new file mode 100644 index 00000000000..bff7beb136f --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/HealthEndpointTests.java @@ -0,0 +1,60 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.endpoint.HealthEndpoint; +import org.springframework.zero.actuate.health.HealthIndicator; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link HealthEndpoint}. + * + * @author Phillip Webb + */ +public class HealthEndpointTests extends AbstractEndpointTests> { + + public HealthEndpointTests() { + super(Config.class, HealthEndpoint.class, "/health", false, "endpoints.health"); + } + + @Test + public void invoke() throws Exception { + assertThat(getEndpointBean().invoke(), equalTo("fine")); + } + + @Configuration + @EnableConfigurationProperties + public static class Config { + + @Bean + public HealthEndpoint endpoint() { + return new HealthEndpoint(new HealthIndicator() { + @Override + public String health() { + return "fine"; + } + }); + } + + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/InfoEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/InfoEndpointTests.java new file mode 100644 index 00000000000..92686910788 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/InfoEndpointTests.java @@ -0,0 +1,56 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.Collections; + +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.endpoint.InfoEndpoint; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link InfoEndpoint}. + * + * @author Phillip Webb + */ +public class InfoEndpointTests extends AbstractEndpointTests { + + public InfoEndpointTests() { + super(Config.class, InfoEndpoint.class, "/info", true, "endpoints.info"); + } + + @Test + public void invoke() throws Exception { + assertThat(getEndpointBean().invoke().get("a"), equalTo((Object) "b")); + } + + @Configuration + @EnableConfigurationProperties + public static class Config { + + @Bean + public InfoEndpoint endpoint() { + return new InfoEndpoint(Collections.singletonMap("a", "b")); + } + + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/MetricsEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/MetricsEndpointTests.java new file mode 100644 index 00000000000..e23cc76d69a --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/MetricsEndpointTests.java @@ -0,0 +1,66 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.Collection; +import java.util.Collections; + +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.endpoint.MetricsEndpoint; +import org.springframework.zero.actuate.endpoint.PublicMetrics; +import org.springframework.zero.actuate.metrics.Metric; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link MetricsEndpoint}. + * + * @author Phillip Webb + */ +public class MetricsEndpointTests extends AbstractEndpointTests { + + public MetricsEndpointTests() { + super(Config.class, MetricsEndpoint.class, "/metrics", true, "endpoints.metrics"); + } + + @Test + public void invoke() throws Exception { + assertThat(getEndpointBean().invoke().get("a"), equalTo((Object) 0.5)); + } + + @Configuration + @EnableConfigurationProperties + public static class Config { + + @Bean + public MetricsEndpoint endpoint() { + final Metric metric = new Metric("a", 0.5f); + PublicMetrics metrics = new PublicMetrics() { + @Override + public Collection metrics() { + return Collections.singleton(metric); + } + }; + return new MetricsEndpoint(metrics); + } + + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/ShutdownEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/ShutdownEndpointTests.java new file mode 100644 index 00000000000..af005cf1e4c --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/ShutdownEndpointTests.java @@ -0,0 +1,69 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.endpoint.ShutdownEndpoint; +import org.springframework.zero.actuate.properties.ManagementServerProperties; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +import static org.hamcrest.Matchers.startsWith; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +/** + * Tests for {@link ShutdownEndpoint}. + * + * @author Phillip Webb + */ +public class ShutdownEndpointTests extends AbstractEndpointTests { + + public ShutdownEndpointTests() { + super(Config.class, ShutdownEndpoint.class, "/shutdown", true, + "endpoints.shutdown"); + } + + @Test + public void invoke() throws Exception { + assertThat((String) getEndpointBean().invoke().get("message"), + startsWith("Shutting down")); + assertTrue(this.context.isActive()); + Thread.sleep(600); + assertFalse(this.context.isActive()); + } + + @Configuration + @EnableConfigurationProperties + public static class Config { + + @Bean + public ManagementServerProperties managementServerProperties() { + ManagementServerProperties properties = new ManagementServerProperties(); + properties.setAllowShutdown(true); + return properties; + } + + @Bean + public ShutdownEndpoint endpoint() { + return new ShutdownEndpoint(); + } + + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/TraceEndpointTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/TraceEndpointTests.java new file mode 100644 index 00000000000..69e88c03153 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/TraceEndpointTests.java @@ -0,0 +1,61 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.Collections; + +import org.junit.Test; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.actuate.endpoint.TraceEndpoint; +import org.springframework.zero.actuate.trace.InMemoryTraceRepository; +import org.springframework.zero.actuate.trace.Trace; +import org.springframework.zero.actuate.trace.TraceRepository; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link TraceEndpoint}. + * + * @author Phillip Webb + */ +public class TraceEndpointTests extends AbstractEndpointTests { + + public TraceEndpointTests() { + super(Config.class, TraceEndpoint.class, "/trace", true, "endpoints.trace"); + } + + @Test + public void invoke() throws Exception { + Trace trace = getEndpointBean().invoke().get(0); + assertThat(trace.getInfo().get("a"), equalTo((Object) "b")); + } + + @Configuration + @EnableConfigurationProperties + public static class Config { + + @Bean + public TraceEndpoint endpoint() { + TraceRepository repository = new InMemoryTraceRepository(); + repository.add(Collections. singletonMap("a", "b")); + return new TraceEndpoint(repository); + } + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/VanillaPublicMetricsTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/VanillaPublicMetricsTests.java new file mode 100644 index 00000000000..982b41d4a8c --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/VanillaPublicMetricsTests.java @@ -0,0 +1,52 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.springframework.zero.actuate.endpoint.VanillaPublicMetrics; +import org.springframework.zero.actuate.metrics.InMemoryMetricRepository; +import org.springframework.zero.actuate.metrics.Metric; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +/** + * Tests for {@link VanillaPublicMetrics}. + * + * @author Phillip Webb + */ +public class VanillaPublicMetricsTests { + + @Test + public void testMetrics() throws Exception { + InMemoryMetricRepository repository = new InMemoryMetricRepository(); + repository.set("a", 0.5, new Date()); + VanillaPublicMetrics publicMetrics = new VanillaPublicMetrics(repository); + Map results = new HashMap(); + for (Metric metric : publicMetrics.metrics()) { + results.put(metric.getName(), metric); + } + assertTrue(results.containsKey("mem")); + assertTrue(results.containsKey("mem.free")); + assertThat(results.get("a").getValue(), equalTo(0.5)); + } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java new file mode 100644 index 00000000000..3b044d8c41a --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java @@ -0,0 +1,44 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint.mvc; + +import org.junit.Test; +import org.springframework.zero.actuate.endpoint.Endpoint; +import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerAdapter; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + +/** + * Tests for {@link EndpointHandlerAdapter}. + * + * @author Phillip Webb + */ +public class EndpointHandlerAdapterTests { + + private EndpointHandlerAdapter adapter = new EndpointHandlerAdapter(); + + @Test + public void onlySupportsEndpoints() throws Exception { + assertTrue(this.adapter.supports(mock(Endpoint.class))); + assertFalse(this.adapter.supports(mock(Object.class))); + } + + // FIXME tests + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerMappingTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerMappingTests.java new file mode 100644 index 00000000000..d587765a954 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerMappingTests.java @@ -0,0 +1,123 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.endpoint.mvc; + +import java.util.Arrays; + +import org.junit.Test; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.zero.actuate.endpoint.AbstractEndpoint; +import org.springframework.zero.actuate.endpoint.ActionEndpoint; +import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerMapping; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.nullValue; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link EndpointHandlerMapping}. + * + * @author Phillip Webb + */ +public class EndpointHandlerMappingTests { + + @Test + public void withoutPrefix() throws Exception { + TestEndpoint endpointA = new TestEndpoint("/a"); + TestEndpoint endpointB = new TestEndpoint("/b"); + EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( + endpointA, endpointB)); + mapping.afterPropertiesSet(); + assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")) + .getHandler(), equalTo((Object) endpointA)); + assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/b")) + .getHandler(), equalTo((Object) endpointB)); + assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/c")), + nullValue()); + } + + @Test + public void withPrefix() throws Exception { + TestEndpoint endpointA = new TestEndpoint("/a"); + TestEndpoint endpointB = new TestEndpoint("/b"); + EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList( + endpointA, endpointB)); + mapping.setPrefix("/a"); + mapping.afterPropertiesSet(); + assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a/a")) + .getHandler(), equalTo((Object) endpointA)); + assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a/b")) + .getHandler(), equalTo((Object) endpointB)); + assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")), + nullValue()); + } + + @Test + public void onlyGetHttpMethodForNonActionEndpoints() throws Exception { + TestEndpoint endpoint = new TestEndpoint("/a"); + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + Arrays.asList(endpoint)); + mapping.afterPropertiesSet(); + assertNotNull(mapping.getHandler(new MockHttpServletRequest("GET", "/a"))); + assertNull(mapping.getHandler(new MockHttpServletRequest("POST", "/a"))); + } + + @Test + public void onlyPostHttpMethodForActionEndpoints() throws Exception { + TestEndpoint endpoint = new TestActionEndpoint("/a"); + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + Arrays.asList(endpoint)); + mapping.afterPropertiesSet(); + assertNull(mapping.getHandler(new MockHttpServletRequest("GET", "/a"))); + assertNotNull(mapping.getHandler(new MockHttpServletRequest("POST", "/a"))); + } + + @Test + public void disabled() throws Exception { + TestEndpoint endpointA = new TestEndpoint("/a"); + EndpointHandlerMapping mapping = new EndpointHandlerMapping( + Arrays.asList(endpointA)); + mapping.setDisabled(true); + mapping.afterPropertiesSet(); + assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")), + nullValue()); + } + + private static class TestEndpoint extends AbstractEndpoint { + + public TestEndpoint(String path) { + super(path); + } + + @Override + public Object invoke() { + return null; + } + + } + + private static class TestActionEndpoint extends TestEndpoint implements + ActionEndpoint { + + public TestActionEndpoint(String path) { + super(path); + } + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/fixme/ErrorConfigurationTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/fixme/ErrorConfigurationTests.java new file mode 100644 index 00000000000..d0a182aaa08 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/fixme/ErrorConfigurationTests.java @@ -0,0 +1,39 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.fixme; + +/** + * @author Dave Syer + */ +public class ErrorConfigurationTests { + + // private AnnotationConfigApplicationContext context; + // + // @Test + // public void testErrorEndpointConfiguration() throws Exception { + // this.context = new AnnotationConfigApplicationContext(); + // this.context.register(ErrorConfiguration.class, + // ActuatorServerPropertiesConfiguration.class, + // PropertyPlaceholderAutoConfiguration.class); + // this.context.refresh(); + // assertNotNull(this.context.getBean(ErrorEndpoint.class)); + // ConfigurableEmbeddedServletContainerFactory factory = Mockito + // .mock(ConfigurableEmbeddedServletContainerFactory.class); + // this.context.getBean(EmbeddedServletContainerCustomizer.class).customize(factory); + // Mockito.verify(factory).addErrorPages(Mockito.any(ErrorPage.class)); + // } +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/health/VanillaHealthIndicatorTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/health/VanillaHealthIndicatorTests.java new file mode 100644 index 00000000000..b1afb330799 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/health/VanillaHealthIndicatorTests.java @@ -0,0 +1,38 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.health; + +import org.junit.Test; +import org.springframework.zero.actuate.health.VanillaHealthIndicator; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link VanillaHealthIndicator}. + * + * @author Phillip Webb + */ +public class VanillaHealthIndicatorTests { + + @Test + public void ok() throws Exception { + VanillaHealthIndicator healthIndicator = new VanillaHealthIndicator(); + assertThat(healthIndicator.health(), equalTo("ok")); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/DefaultCounterServiceTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/DefaultCounterServiceTests.java new file mode 100644 index 00000000000..19bfaffca0d --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/DefaultCounterServiceTests.java @@ -0,0 +1,38 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.zero.actuate.metrics.DefaultCounterService; + +import static org.junit.Assert.fail; + +/** + * Tests for {@link DefaultCounterService}. + */ +@Ignore +public class DefaultCounterServiceTests { + + // FIXME + + @Test + public void test() { + fail("Not yet implemented"); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/DefaultGaugeServiceTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/DefaultGaugeServiceTests.java new file mode 100644 index 00000000000..35d09982e69 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/DefaultGaugeServiceTests.java @@ -0,0 +1,38 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.metrics; + +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.zero.actuate.metrics.DefaultGaugeService; + +import static org.junit.Assert.fail; + +/** + * Tests for {@link DefaultGaugeService}. + */ +@Ignore +public class DefaultGaugeServiceTests { + + // FIXME + + @Test + public void test() { + fail("Not yet implemented"); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepositoryTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepositoryTests.java new file mode 100644 index 00000000000..d19aca734d2 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepositoryTests.java @@ -0,0 +1,38 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.actuate.metrics; + +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.zero.actuate.metrics.InMemoryMetricRepository; + +import static org.junit.Assert.fail; + +/** + * Tests for {@link InMemoryMetricRepository}. + */ +@Ignore +public class InMemoryMetricRepositoryTests { + + // FIXME write tests + // FIXME possibly also add Metric/Measurement tests + + @Test + public void test() { + fail("Not yet implemented"); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/properties/SecurityPropertiesTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/properties/SecurityPropertiesTests.java new file mode 100644 index 00000000000..083b4464fd3 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/properties/SecurityPropertiesTests.java @@ -0,0 +1,58 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.properties; + +import java.util.Collections; + +import org.junit.Test; +import org.springframework.beans.MutablePropertyValues; +import org.springframework.core.convert.support.DefaultConversionService; +import org.springframework.zero.actuate.properties.SecurityProperties; +import org.springframework.zero.bind.RelaxedDataBinder; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +/** + * Tests for {@link SecurityProperties}. + * + * @author Dave Syer + */ +public class SecurityPropertiesTests { + + @Test + public void testBindingIgnoredSingleValued() { + SecurityProperties security = new SecurityProperties(); + RelaxedDataBinder binder = new RelaxedDataBinder(security, "security"); + binder.bind(new MutablePropertyValues(Collections.singletonMap( + "security.ignored", "/css/**"))); + assertFalse(binder.getBindingResult().hasErrors()); + assertEquals(1, security.getIgnored().length); + } + + @Test + public void testBindingIgnoredMultiValued() { + SecurityProperties security = new SecurityProperties(); + RelaxedDataBinder binder = new RelaxedDataBinder(security, "security"); + binder.setConversionService(new DefaultConversionService()); + binder.bind(new MutablePropertyValues(Collections.singletonMap( + "security.ignored", "/css/**,/images/**"))); + assertFalse(binder.getBindingResult().hasErrors()); + assertEquals(2, security.getIgnored().length); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/security/AuthenticationAuditListenerTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/security/AuthenticationAuditListenerTests.java new file mode 100644 index 00000000000..01828be482d --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/security/AuthenticationAuditListenerTests.java @@ -0,0 +1,38 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.security; + +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.zero.actuate.security.AuthenticationAuditListener; + +import static org.junit.Assert.fail; + +/** + * Tests for {@link AuthenticationAuditListener}. + */ +@Ignore +public class AuthenticationAuditListenerTests { + + // FIXME + + @Test + public void test() { + fail("Not yet implemented"); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/security/AuthorizationAuditListenerTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/security/AuthorizationAuditListenerTests.java new file mode 100644 index 00000000000..227d1832215 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/security/AuthorizationAuditListenerTests.java @@ -0,0 +1,38 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.security; + +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.zero.actuate.security.AuthenticationAuditListener; + +import static org.junit.Assert.fail; + +/** + * Tests for {@link AuthenticationAuditListener}. + */ +@Ignore +public class AuthorizationAuditListenerTests { + + // FIXME + + @Test + public void test() { + fail("Not yet implemented"); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/trace/InMemoryTraceRepositoryTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/trace/InMemoryTraceRepositoryTests.java new file mode 100644 index 00000000000..67cf674a343 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/trace/InMemoryTraceRepositoryTests.java @@ -0,0 +1,48 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.trace; + +import java.util.Collections; +import java.util.List; + +import org.junit.Test; +import org.springframework.zero.actuate.trace.InMemoryTraceRepository; +import org.springframework.zero.actuate.trace.Trace; + +import static org.junit.Assert.assertEquals; + +/** + * Tests for {@link InMemoryTraceRepository}. + * + * @author Dave Syer + */ +public class InMemoryTraceRepositoryTests { + + private InMemoryTraceRepository repository = new InMemoryTraceRepository(); + + @Test + public void capacityLimited() { + this.repository.setCapacity(2); + this.repository.add(Collections. singletonMap("foo", "bar")); + this.repository.add(Collections. singletonMap("bar", "foo")); + this.repository.add(Collections. singletonMap("bar", "bar")); + List traces = this.repository.findAll(); + assertEquals(2, traces.size()); + assertEquals("bar", traces.get(1).getInfo().get("bar")); + } + +} diff --git a/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/trace/WebRequestTraceFilterTests.java b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/trace/WebRequestTraceFilterTests.java new file mode 100644 index 00000000000..644c354c2c3 --- /dev/null +++ b/spring-zero-actuator/src/test/java/org/springframework/zero/actuate/trace/WebRequestTraceFilterTests.java @@ -0,0 +1,47 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.actuate.trace; + +import java.util.Map; + +import org.junit.Test; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.zero.actuate.trace.InMemoryTraceRepository; +import org.springframework.zero.actuate.trace.WebRequestTraceFilter; + +import static org.junit.Assert.assertEquals; + +/** + * Tests for {@link WebRequestTraceFilter}. + * + * @author Dave Syer + */ +public class WebRequestTraceFilterTests { + + private WebRequestTraceFilter filter = new WebRequestTraceFilter( + new InMemoryTraceRepository()); + + @Test + public void filterDumpsRequest() { + MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo"); + request.addHeader("Accept", "application/json"); + Map trace = this.filter.getTrace(request); + assertEquals("GET", trace.get("method")); + assertEquals("/foo", trace.get("path")); + assertEquals("{Accept=application/json}", trace.get("headers").toString()); + } +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java deleted file mode 100644 index 567fec748ed..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; - -/** - * Convenience class for storing base packages during component scan, for reference later - * (e.g. by JPA entity scanner). - * - * @author Phil Webb - * @author Dave Syer - */ -public abstract class AutoConfigurationUtils { - - private static String BASE_PACKAGES_BEAN = AutoConfigurationUtils.class.getName() - + ".basePackages"; - - @SuppressWarnings("unchecked") - public static List getBasePackages(BeanFactory beanFactory) { - try { - return beanFactory.getBean(BASE_PACKAGES_BEAN, List.class); - } catch (NoSuchBeanDefinitionException e) { - return Collections.emptyList(); - } - } - - public static void storeBasePackages(ConfigurableListableBeanFactory beanFactory, - List basePackages) { - if (!beanFactory.containsBean(BASE_PACKAGES_BEAN)) { - beanFactory.registerSingleton(BASE_PACKAGES_BEAN, new ArrayList( - basePackages)); - } else { - List packages = getBasePackages(beanFactory); - for (String pkg : basePackages) { - if (packages.contains(pkg)) { - packages.add(pkg); - } - } - } - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java deleted file mode 100644 index 30b3ad72c04..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.MessageSource; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.support.ResourceBundleMessageSource; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}. - * - * @author Dave Syer - */ -@Configuration -@ConditionalOnMissingBean(MessageSource.class) -@Order(Ordered.HIGHEST_PRECEDENCE) -public class MessageSourceAutoConfiguration { - - @Value("${spring.messages.basename:messages}") - private String basename; - - @Bean - public MessageSource messageSource() { - ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); - messageSource.setBasename(this.basename); - return messageSource; - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java deleted file mode 100644 index ea5a556ac96..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure; - -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for - * {@link PropertySourcesPlaceholderConfigurer}. - * - * @author Phillip Webb - * @author Dave Syer - */ -@Configuration -@Order(Ordered.HIGHEST_PRECEDENCE) -public class PropertyPlaceholderAutoConfiguration { - - @Bean - @ConditionalOnMissingBean - public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer( - ApplicationContext context) { - return new PropertySourcesPlaceholderConfigurer(); - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java deleted file mode 100644 index f7e5860c44e..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.batch; - -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.bootstrap.CommandLineRunner; -import org.springframework.bootstrap.ExitCodeGenerator; -import org.springframework.bootstrap.context.annotation.ConditionalOnBean; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for Spring Batch. - * - * @author Dave Syer - */ -@Configuration -@ConditionalOnClass({ JobLauncher.class }) -public class BatchAutoConfiguration { - - @Bean - // Harmless to always include this, but maybe could make it conditional as well - public BatchDatabaseInitializer batchDatabaseInitializer() { - return new BatchDatabaseInitializer(); - } - - @Bean - @ConditionalOnMissingBean(CommandLineRunner.class) - @ConditionalOnBean(JobLauncher.class) - public JobLauncherCommandLineRunner jobLauncherCommandLineRunner() { - return new JobLauncherCommandLineRunner(); - } - - @Bean - @ConditionalOnMissingBean(ExitCodeGenerator.class) - @ConditionalOnBean(JobLauncher.class) - public ExitCodeGenerator jobExecutionExitCodeGenerator() { - return new JobExecutionExitCodeGenerator(); - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java deleted file mode 100644 index f79a2780167..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.batch; - -import javax.annotation.PostConstruct; -import javax.sql.DataSource; - -import org.springframework.batch.support.DatabaseType; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.ResourceLoader; -import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils; -import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -import org.springframework.stereotype.Component; - -/** - * Initialize the Spring Batch schema (ignoring errors, so should be idempotent). - * - * @author Dave Syer - */ -@Component -public class BatchDatabaseInitializer { - - @Autowired - private DataSource dataSource; - - @Autowired - private ResourceLoader resourceLoader; - - @Value("${spring.batch.schema:classpath:org/springframework/batch/core/schema-@@platform@@.sql}") - private String schemaLocation = "classpath:org/springframework/batch/core/schema-@@platform@@.sql"; - - @PostConstruct - protected void initialize() throws Exception { - String platform = DatabaseType.fromMetaData(this.dataSource).toString() - .toLowerCase(); - if ("hsql".equals(platform)) { - platform = "hsqldb"; - } - ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); - populator.addScript(this.resourceLoader.getResource(this.schemaLocation.replace( - "@@platform@@", platform))); - populator.setContinueOnError(true); - DatabasePopulatorUtils.execute(populator, this.dataSource); - } -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java deleted file mode 100644 index 332746e8d1a..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.batch; - -import org.springframework.batch.core.JobExecution; -import org.springframework.context.ApplicationEvent; - -/** - * Spring {@link ApplicationEvent} encapsulating a {@link JobExecution}. - * - * @author Dave Syer - */ -public class JobExecutionEvent extends ApplicationEvent { - - private JobExecution execution; - - /** - * @param execution the job execution - */ - public JobExecutionEvent(JobExecution execution) { - super(execution); - this.execution = execution; - } - - /** - * @return the job execution - */ - public JobExecution getJobExecution() { - return this.execution; - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java deleted file mode 100644 index 4ae7b1b338a..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.batch; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.batch.core.JobExecution; -import org.springframework.bootstrap.ExitCodeGenerator; -import org.springframework.context.ApplicationListener; - -/** - * {@link ExitCodeGenerator} for {@link JobExecutionEvent}s. - * - * @author Dave Syer - */ -public class JobExecutionExitCodeGenerator implements - ApplicationListener, ExitCodeGenerator { - - private List executions = new ArrayList(); - - @Override - public void onApplicationEvent(JobExecutionEvent event) { - this.executions.add(event.getJobExecution()); - } - - @Override - public int getExitCode() { - for (JobExecution execution : this.executions) { - if (execution.getStatus().ordinal() > 0) { - return execution.getStatus().ordinal(); - } - } - return 0; - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java deleted file mode 100644 index 50e31b5e165..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.batch; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.batch.core.Job; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.JobExecutionException; -import org.springframework.batch.core.converter.DefaultJobParametersConverter; -import org.springframework.batch.core.converter.JobParametersConverter; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.CommandLineRunner; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.stereotype.Component; -import org.springframework.util.StringUtils; - -/** - * {@link CommandLineRunner} to {@link JobLauncher launch} Spring Batch jobs. - * - * @author Dave Syer - */ -@Component -public class JobLauncherCommandLineRunner implements CommandLineRunner, - ApplicationEventPublisherAware { - - private static Log logger = LogFactory.getLog(JobLauncherCommandLineRunner.class); - - @Autowired(required = false) - private JobParametersConverter converter = new DefaultJobParametersConverter(); - - @Autowired - private JobLauncher jobLauncher; - - @Autowired(required = false) - private Collection jobs = Collections.emptySet(); - - private ApplicationEventPublisher publisher; - - @Override - public void setApplicationEventPublisher(ApplicationEventPublisher publisher) { - this.publisher = publisher; - } - - @Override - public void run(String... args) throws JobExecutionException { - logger.info("Running default command line with: " + Arrays.asList(args)); - launchJobFromProperties(StringUtils.splitArrayElementsIntoProperties(args, "=")); - } - - protected void launchJobFromProperties(Properties properties) - throws JobExecutionException { - for (Job job : this.jobs) { - JobExecution execution = this.jobLauncher.run(job, - this.converter.getJobParameters(properties)); - if (this.publisher != null) { - this.publisher.publishEvent(new JobExecutionEvent(execution)); - } - } - } -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java deleted file mode 100644 index 46aa1413590..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.data; - -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for Spring Data's JPA Repositories. - * - * @author Phillip Webb - * @see EnableJpaRepositories - */ -@Configuration -@ConditionalOnClass(JpaRepository.class) -@ConditionalOnMissingBean(JpaRepositoryFactoryBean.class) -@Import(JpaRepositoriesAutoConfigureRegistrar.class) -public class JpaRepositoriesAutoConfiguration { - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java deleted file mode 100644 index 14052ff78b1..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.data; - -import java.util.Collection; -import java.util.List; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanClassLoaderAware; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.bootstrap.autoconfigure.AutoConfigurationUtils; -import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.ResourceLoader; -import org.springframework.core.type.AnnotationMetadata; -import org.springframework.core.type.StandardAnnotationMetadata; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension; -import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource; -import org.springframework.data.repository.config.RepositoryBeanDefinitionBuilder; -import org.springframework.data.repository.config.RepositoryBeanNameGenerator; -import org.springframework.data.repository.config.RepositoryConfiguration; -import org.springframework.data.repository.config.RepositoryConfigurationExtension; -import org.springframework.util.Assert; - -/** - * {@link ImportBeanDefinitionRegistrar} used to auto-configure Spring Data JPA - * Repositories. - * - * @author Phillip Webb - */ -class JpaRepositoriesAutoConfigureRegistrar implements ImportBeanDefinitionRegistrar, - BeanFactoryAware, BeanClassLoaderAware { - - private BeanFactory beanFactory; - - private ClassLoader beanClassLoader; - - @Override - public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, - final BeanDefinitionRegistry registry) { - - final ResourceLoader resourceLoader = new DefaultResourceLoader(); - final AnnotationRepositoryConfigurationSource configurationSource = getConfigurationSource(); - final RepositoryConfigurationExtension extension = new JpaRepositoryConfigExtension(); - extension.registerBeansForRoot(registry, configurationSource); - - final RepositoryBeanNameGenerator generator = new RepositoryBeanNameGenerator(); - generator.setBeanClassLoader(this.beanClassLoader); - - Collection> repositoryConfigurations = extension - .getRepositoryConfigurations(configurationSource, resourceLoader); - - for (final RepositoryConfiguration repositoryConfiguration : repositoryConfigurations) { - RepositoryBeanDefinitionBuilder builder = new RepositoryBeanDefinitionBuilder( - repositoryConfiguration, extension); - BeanDefinitionBuilder definitionBuilder = builder.build(registry, - resourceLoader); - extension.postProcess(definitionBuilder, configurationSource); - - String beanName = generator.generateBeanName( - definitionBuilder.getBeanDefinition(), registry); - registry.registerBeanDefinition(beanName, - definitionBuilder.getBeanDefinition()); - } - } - - private AnnotationRepositoryConfigurationSource getConfigurationSource() { - StandardAnnotationMetadata metadata = new StandardAnnotationMetadata( - EnableJpaRepositoriesConfiguration.class, true); - AnnotationRepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource( - metadata, EnableJpaRepositories.class) { - - @Override - public java.lang.Iterable getBasePackages() { - return JpaRepositoriesAutoConfigureRegistrar.this.getBasePackages(); - }; - }; - return configurationSource; - } - - protected Iterable getBasePackages() { - List basePackages = AutoConfigurationUtils - .getBasePackages(this.beanFactory); - Assert.notEmpty( - basePackages, - "Unable to find JPA repository base packages, please define " - + "a @ComponentScan annotation or disable JpaRepositoriesAutoConfigure"); - return basePackages; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = beanFactory; - } - - @Override - public void setBeanClassLoader(ClassLoader classLoader) { - this.beanClassLoader = classLoader; - } - - @EnableJpaRepositories - private static class EnableJpaRepositoriesConfiguration { - } -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java deleted file mode 100644 index 734fb369938..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import org.springframework.beans.factory.BeanCreationException; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.util.StringUtils; - -/** - * Base class for configuration of a database pool. - * - * @author Dave Syer - */ -public class AbstractDataSourceConfiguration { - - // TODO: add pool parameters - - @Value("${spring.database.driverClassName:}") - private String driverClassName; - - @Value("${spring.database.url:}") - private String url; - - @Value("${spring.database.username:sa}") - private String username; - - @Value("${spring.database.password:}") - private String password; - - protected String getDriverClassName() { - if (StringUtils.hasText(this.driverClassName)) { - return this.driverClassName; - } - EmbeddedDatabaseType embeddedDatabaseType = EmbeddedDatabaseConfiguration - .getEmbeddedDatabaseType(); - this.driverClassName = EmbeddedDatabaseConfiguration - .getEmbeddedDatabaseDriverClass(embeddedDatabaseType); - if (!StringUtils.hasText(this.driverClassName)) { - throw new BeanCreationException( - "Cannot determine embedded database driver class for database type " - + embeddedDatabaseType - + ". If you want an embedded database please put a supoprted one on the classpath."); - } - return this.driverClassName; - } - - protected String getUrl() { - if (StringUtils.hasText(this.url)) { - return this.url; - } - EmbeddedDatabaseType embeddedDatabaseType = EmbeddedDatabaseConfiguration - .getEmbeddedDatabaseType(); - this.url = EmbeddedDatabaseConfiguration - .getEmbeddedDatabaseUrl(embeddedDatabaseType); - if (!StringUtils.hasText(this.url)) { - throw new BeanCreationException( - "Cannot determine embedded database url for database type " - + embeddedDatabaseType - + ". If you want an embedded database please put a supported on on the classpath."); - } - return this.url; - } - - protected String getUsername() { - return this.username; - } - - protected String getPassword() { - return this.password; - } -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java deleted file mode 100644 index 3363fcb4c2e..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import java.sql.SQLException; - -import javax.annotation.PreDestroy; -import javax.sql.DataSource; - -import org.apache.commons.dbcp.BasicDataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.dao.DataAccessResourceFailureException; - -/** - * Configuration for a Commons DBCP database pool. The DBCP pool is popular but not - * recommended in high volume environments (the Tomcat DataSource is more reliable). - * - * @author Dave Syer - */ -@Configuration -public class BasicDataSourceConfiguration extends AbstractDataSourceConfiguration { - - private static Log logger = LogFactory.getLog(BasicDataSourceConfiguration.class); - - private BasicDataSource pool; - - @Bean - public DataSource dataSource() { - logger.info("Hint: using Commons DBCP BasicDataSource. It's going to work, " - + "but the Tomcat DataSource is more reliable."); - this.pool = new BasicDataSource(); - this.pool.setDriverClassName(getDriverClassName()); - this.pool.setUrl(getUrl()); - this.pool.setUsername(getUsername()); - this.pool.setPassword(getPassword()); - return this.pool; - } - - @PreDestroy - public void close() { - if (this.pool != null) { - try { - this.pool.close(); - } catch (SQLException e) { - throw new DataAccessResourceFailureException( - "Could not close data source", e); - } - } - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java deleted file mode 100644 index b7cb1090a0f..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.sql.DataSource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.BeanFactoryUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.context.annotation.ConditionLogUtils; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Condition; -import org.springframework.context.annotation.ConditionContext; -import org.springframework.context.annotation.Conditional; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.core.io.Resource; -import org.springframework.core.type.AnnotatedTypeMetadata; -import org.springframework.jdbc.core.JdbcOperations; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils; -import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -import org.springframework.util.ClassUtils; -import org.springframework.util.StringUtils; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for {@link DataSource}. - * - * @author Dave Syer - */ -@Configuration -@ConditionalOnClass(EmbeddedDatabaseType.class /* Spring JDBC */) -@ConditionalOnMissingBean(DataSource.class) -public class DataSourceAutoConfiguration { - - // FIXME see above - - private static Log logger = LogFactory.getLog(DataSourceAutoConfiguration.class); - - @Autowired(required = false) - private DataSource dataSource; - - @Autowired - private ApplicationContext applicationContext; - - @Conditional(DataSourceAutoConfiguration.EmbeddedDatabaseCondition.class) - @Import(EmbeddedDatabaseConfiguration.class) - protected static class EmbeddedConfiguration { - } - - @Conditional(DataSourceAutoConfiguration.TomcatDatabaseCondition.class) - @Import(TomcatDataSourceConfiguration.class) - protected static class TomcatConfiguration { - } - - @Conditional(DataSourceAutoConfiguration.BasicDatabaseCondition.class) - @Import(BasicDataSourceConfiguration.class) - protected static class DbcpConfiguration { - } - - @Configuration - @Conditional(DataSourceAutoConfiguration.SomeDatabaseCondition.class) - // FIXME: make this @ConditionalOnBean(DataSource.class) - protected static class JdbcTemplateConfiguration { - - @Autowired(required = false) - private DataSource dataSource; - - @Bean - @ConditionalOnMissingBean(JdbcOperations.class) - public JdbcOperations jdbcTemplate() { - return new JdbcTemplate(this.dataSource); - } - - @Bean - @ConditionalOnMissingBean(NamedParameterJdbcOperations.class) - public NamedParameterJdbcOperations namedParameterJdbcTemplate() { - return new NamedParameterJdbcTemplate(this.dataSource); - } - - } - - // FIXME: DB platform - @Value("${spring.database.schema:classpath*:schema-${spring.database.platform:all}.sql}") - private String schemaLocations = ""; - - @PostConstruct - protected void initialize() throws Exception { - if (this.dataSource == null) { - logger.debug("No DataSource found so not initializing"); - return; - } - ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); - boolean exists = false; - List resources = new ArrayList(); - for (String location : StringUtils - .commaDelimitedListToStringArray(this.schemaLocations)) { - resources - .addAll(Arrays.asList(this.applicationContext.getResources(location))); - } - for (Resource resource : resources) { - if (resource.exists()) { - exists = true; - populator.addScript(resource); - populator.setContinueOnError(true); - } - } - if (exists) { - DatabasePopulatorUtils.execute(populator, this.dataSource); - } - } - - static class SomeDatabaseCondition implements Condition { - - protected Log logger = LogFactory.getLog(getClass()); - - private Condition tomcatCondition = new TomcatDatabaseCondition(); - - private Condition dbcpCondition = new BasicDatabaseCondition(); - - private Condition embeddedCondition = new EmbeddedDatabaseCondition(); - - @Override - public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { - - String checking = ConditionLogUtils.getPrefix(this.logger, metadata); - - if (this.tomcatCondition.matches(context, metadata) - || this.dbcpCondition.matches(context, metadata) - || this.embeddedCondition.matches(context, metadata)) { - if (this.logger.isDebugEnabled()) { - this.logger.debug(checking - + "Existing auto database detected: match result true"); - } - return true; - } - if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors( - context.getBeanFactory(), DataSource.class, true, false).length > 0) { - if (this.logger.isDebugEnabled()) { - this.logger - .debug(checking - + "Existing bean configured database detected: match result true"); - } - return true; - } - if (this.logger.isDebugEnabled()) { - this.logger - .debug(checking - + "Existing bean configured database not detected: match result false"); - } - return false; - } - - } - - static class TomcatDatabaseCondition extends NonEmbeddedDatabaseCondition { - - @Override - protected String getDataSourecClassName() { - return "org.apache.tomcat.jdbc.pool.DataSource"; - } - - } - - static class BasicDatabaseCondition extends NonEmbeddedDatabaseCondition { - - private Condition condition = new TomcatDatabaseCondition(); - - @Override - protected String getDataSourecClassName() { - return "org.apache.commons.dbcp.BasicDataSource"; - } - - @Override - public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { - if (this.condition.matches(context, metadata)) { - return false; // prefer Tomcat pool - } - return super.matches(context, metadata); - } - } - - static abstract class NonEmbeddedDatabaseCondition implements Condition { - - protected Log logger = LogFactory.getLog(getClass()); - - protected abstract String getDataSourecClassName(); - - @Override - public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { - - String checking = ConditionLogUtils.getPrefix(this.logger, metadata); - - if (!ClassUtils.isPresent(getDataSourecClassName(), null)) { - if (this.logger.isDebugEnabled()) { - this.logger.debug(checking + "Tomcat DataSource pool not found"); - } - return false; - } - String driverClassName = context.getEnvironment().getProperty( - "spring.database.driverClassName"); - String url = context.getEnvironment().getProperty("spring.database.url"); - if (this.logger.isDebugEnabled()) { - this.logger.debug(checking - + "Spring JDBC detected (embedded database type is " - + EmbeddedDatabaseConfiguration.getEmbeddedDatabaseType() + ")."); - } - if (driverClassName == null) { - driverClassName = EmbeddedDatabaseConfiguration - .getEmbeddedDatabaseDriverClass(EmbeddedDatabaseConfiguration - .getEmbeddedDatabaseType()); - } - if (url == null) { - url = EmbeddedDatabaseConfiguration - .getEmbeddedDatabaseUrl(EmbeddedDatabaseConfiguration - .getEmbeddedDatabaseType()); - } - if (driverClassName != null && url != null - && ClassUtils.isPresent(driverClassName, null)) { - if (this.logger.isDebugEnabled()) { - this.logger.debug(checking + "Driver class " + driverClassName - + " found"); - } - return true; - } - if (this.logger.isDebugEnabled()) { - this.logger.debug(checking + "Driver class " + driverClassName - + " not found"); - } - return false; - } - - } - - static class EmbeddedDatabaseCondition implements Condition { - - protected Log logger = LogFactory.getLog(getClass()); - - private Condition tomcatCondition = new TomcatDatabaseCondition(); - - private Condition dbcpCondition = new BasicDatabaseCondition(); - - @Override - public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { - - String checking = ConditionLogUtils.getPrefix(this.logger, metadata); - - if (this.tomcatCondition.matches(context, metadata) - || this.dbcpCondition.matches(context, metadata)) { - if (this.logger.isDebugEnabled()) { - this.logger - .debug(checking - + "Existing non-embedded database detected: match result false"); - } - return false; - } - if (this.logger.isDebugEnabled()) { - this.logger.debug(checking - + "Spring JDBC detected (embedded database type is " - + EmbeddedDatabaseConfiguration.getEmbeddedDatabaseType() + ")."); - } - return EmbeddedDatabaseConfiguration.getEmbeddedDatabaseType() != null; - } - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java deleted file mode 100644 index 5df7d0bba39..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.context.annotation.ConditionalOnBean; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; -import org.springframework.transaction.PlatformTransactionManager; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for - * {@link DataSourceTransactionManager}. - * - * @author Dave Syer - */ -@Configuration -@ConditionalOnClass({ JdbcTemplate.class, PlatformTransactionManager.class }) -public class DataSourceTransactionManagerAutoConfiguration implements Ordered { - - @Override - public int getOrder() { - return Integer.MAX_VALUE; - } - - @Autowired(required = false) - private DataSource dataSource; - - @Bean - @ConditionalOnMissingBean(name = "transactionManager") - @ConditionalOnBean(DataSource.class) - public PlatformTransactionManager transactionManager() { - return new DataSourceTransactionManager(this.dataSource); - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java deleted file mode 100644 index fce5f3a5909..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.annotation.PreDestroy; -import javax.sql.DataSource; - -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.util.ClassUtils; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for embedded databases. - * - * @author Phillip Webb - */ -@Configuration -public class EmbeddedDatabaseConfiguration { - - private static final Map EMBEDDED_DATABASE_DRIVER_CLASSES; - private static final Map EMBEDDED_DATABASE_URLS; - - private EmbeddedDatabase database; - - static { - - EMBEDDED_DATABASE_DRIVER_CLASSES = new LinkedHashMap(); - EMBEDDED_DATABASE_DRIVER_CLASSES.put(EmbeddedDatabaseType.H2, "org.h2.Driver"); - EMBEDDED_DATABASE_DRIVER_CLASSES.put(EmbeddedDatabaseType.DERBY, - "org.apache.derby.jdbc.EmbeddedDriver"); - EMBEDDED_DATABASE_DRIVER_CLASSES.put(EmbeddedDatabaseType.HSQL, - "org.hsqldb.jdbcDriver"); - - EMBEDDED_DATABASE_URLS = new LinkedHashMap(); - EMBEDDED_DATABASE_URLS.put(EmbeddedDatabaseType.H2, - "jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1"); - EMBEDDED_DATABASE_URLS.put(EmbeddedDatabaseType.DERBY, - "jdbc:derby:memory:testdb;create=true"); - EMBEDDED_DATABASE_URLS.put(EmbeddedDatabaseType.HSQL, "jdbc:hsqldb:mem:testdb"); - - } - - @Bean - public DataSource dataSource() { - EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() - .setType(getEmbeddedDatabaseType()); - this.database = builder.build(); - return this.database; - } - - @PreDestroy - public void close() { - if (this.database != null) { - this.database.shutdown(); - } - } - - public static String getEmbeddedDatabaseDriverClass( - EmbeddedDatabaseType embeddedDatabaseType) { - return EMBEDDED_DATABASE_DRIVER_CLASSES.get(embeddedDatabaseType); - } - - public static String getEmbeddedDatabaseUrl(EmbeddedDatabaseType embeddedDatabaseType) { - return EMBEDDED_DATABASE_URLS.get(embeddedDatabaseType); - } - - public static EmbeddedDatabaseType getEmbeddedDatabaseType() { - for (Map.Entry entry : EMBEDDED_DATABASE_DRIVER_CLASSES - .entrySet()) { - if (ClassUtils.isPresent(entry.getValue(), - EmbeddedDatabaseConfiguration.class.getClassLoader())) { - return entry.getKey(); - } - } - return null; - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java deleted file mode 100644 index 79d9139f508..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import javax.annotation.PreDestroy; -import javax.sql.DataSource; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Configuration for a Tomcat database pool. The Tomcat pool provides superior performance - * and tends not to deadlock in high volume environments. - * - * @author Dave Syer - */ -@Configuration -public class TomcatDataSourceConfiguration extends AbstractDataSourceConfiguration { - - private org.apache.tomcat.jdbc.pool.DataSource pool; - - @Bean - public DataSource dataSource() { - this.pool = new org.apache.tomcat.jdbc.pool.DataSource(); - this.pool.setDriverClassName(getDriverClassName()); - this.pool.setUrl(getUrl()); - this.pool.setUsername(getUsername()); - this.pool.setPassword(getPassword()); - return this.pool; - } - - @PreDestroy - public void close() { - if (this.pool != null) { - this.pool.close(); - } - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java deleted file mode 100644 index 6db6ba0633e..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.orm.jpa; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.hibernate.ejb.HibernateEntityManager; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.orm.jpa.JpaVendorAdapter; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.Database; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.util.StringUtils; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for Hibernate JPA. - * - * @author Phillip Webb - */ -@Configuration -@ConditionalOnClass(HibernateEntityManager.class) -@EnableTransactionManagement -public class HibernateJpaAutoConfiguration extends JpaAutoConfiguration { - - public static enum DDLAUTO { - none, validate, update, create, create_drop; - @Override - public String toString() { - return this.name().toLowerCase().replace("_", "-"); - } - } - - private static final Map EMBEDDED_DATABASE_DIALECTS; - static { - EMBEDDED_DATABASE_DIALECTS = new LinkedHashMap(); - EMBEDDED_DATABASE_DIALECTS.put(EmbeddedDatabaseType.HSQL, - "org.hibernate.dialect.HSQLDialect"); - } - - @Value("${spring.jpa.databasePlatform:${spring.jpa.database_platform:}}") - private String databasePlatform; - - @Value("${spring.jpa.database:DEFAULT}") - private Database database = Database.DEFAULT; - - @Value("${spring.jpa.showSql:${spring.jpa.show_sql:false}}") - private boolean showSql; - - @Value("${spring.jpa.ddlAuto:${spring.jpa.ddl_auto:none}}") - private DDLAUTO ddlAuto; - - @Bean - @Override - public JpaVendorAdapter jpaVendorAdapter() { - HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); - adapter.setShowSql(this.showSql); - if (StringUtils.hasText(this.databasePlatform)) { - adapter.setDatabasePlatform(this.databasePlatform); - } - adapter.setDatabase(this.database); - return adapter; - } - - @Override - protected void configure( - LocalContainerEntityManagerFactoryBean entityManagerFactoryBean) { - Map properties = entityManagerFactoryBean.getJpaPropertyMap(); - // FIXME: detect EhCache - properties.put("hibernate.cache.provider_class", - "org.hibernate.cache.HashtableCacheProvider"); - if (this.ddlAuto != DDLAUTO.none) { - properties.put("hibernate.hbm2ddl.auto", this.ddlAuto.toString()); - } - - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java deleted file mode 100644 index 3684af0bceb..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.orm.jpa; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.sql.DataSource; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.bootstrap.autoconfigure.AutoConfigurationUtils; -import org.springframework.bootstrap.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; -import org.springframework.bootstrap.context.annotation.ConditionalOnBean; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.JpaVendorAdapter; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.util.Assert; - -/** - * Base {@link EnableAutoConfiguration Auto-configuration} for JPA. - * - * @author Phillip Webb - */ -@ConditionalOnClass({ LocalContainerEntityManagerFactoryBean.class, - EnableTransactionManagement.class, EntityManager.class }) -@ConditionalOnBean(DataSource.class) -public abstract class JpaAutoConfiguration implements BeanFactoryAware { - - private ConfigurableListableBeanFactory beanFactory; - - @Bean - public PlatformTransactionManager transactionManager() { - return new JpaTransactionManager(entityManagerFactory().getObject()); - } - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); - entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter()); - entityManagerFactoryBean.setDataSource(getDataSource()); - entityManagerFactoryBean.setPackagesToScan(getPackagesToScan()); - configure(entityManagerFactoryBean); - return entityManagerFactoryBean; - } - - /** - * Determines if the {@code dataSource} being used by Spring was created from - * {@link EmbeddedDatabaseConfiguration}. - * @return true if the data source was auto-configured. - */ - protected boolean isAutoConfiguredDataSource() { - try { - BeanDefinition beanDefinition = this.beanFactory - .getBeanDefinition("dataSource"); - return EmbeddedDatabaseConfiguration.class.getName().equals( - beanDefinition.getFactoryBeanName()); - } catch (NoSuchBeanDefinitionException e) { - return false; - } - } - - @Bean - public abstract JpaVendorAdapter jpaVendorAdapter(); - - protected DataSource getDataSource() { - try { - return this.beanFactory.getBean("dataSource", DataSource.class); - } catch (RuntimeException e) { - return this.beanFactory.getBean(DataSource.class); - } - } - - protected String[] getPackagesToScan() { - List basePackages = AutoConfigurationUtils - .getBasePackages(this.beanFactory); - Assert.notEmpty(basePackages, - "Unable to find JPA packages to scan, please define " - + "a @ComponentScan annotation or disable JpaAutoConfiguration"); - return basePackages.toArray(new String[basePackages.size()]); - } - - protected void configure( - LocalContainerEntityManagerFactoryBean entityManagerFactoryBean) { - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = (ConfigurableListableBeanFactory) beanFactory; - } -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java deleted file mode 100644 index 8aed8834a88..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.thymeleaf; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Collection; -import java.util.Collections; - -import javax.servlet.Servlet; - -import nz.net.ultraq.web.thymeleaf.LayoutDialect; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.autoconfigure.web.WebMvcAutoConfiguration; -import org.springframework.bootstrap.context.annotation.AutoConfigureAfter; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingClass; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.ResourceLoader; -import org.thymeleaf.TemplateProcessingParameters; -import org.thymeleaf.resourceresolver.IResourceResolver; -import org.thymeleaf.spring3.SpringTemplateEngine; -import org.thymeleaf.spring3.view.ThymeleafViewResolver; -import org.thymeleaf.templateresolver.ITemplateResolver; -import org.thymeleaf.templateresolver.TemplateResolver; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for Thymeleaf templating. - * - * @author Dave Syer - */ -@Configuration -@ConditionalOnClass(SpringTemplateEngine.class) -@AutoConfigureAfter(WebMvcAutoConfiguration.class) -public class ThymeleafAutoConfiguration { - - @Configuration - @ConditionalOnMissingBean(name = "defaultTemplateResolver") - protected static class DefaultTemplateResolverConfiguration { - - @Autowired - private ResourceLoader resourceLoader = new DefaultResourceLoader(); - - @Value("${spring.template.prefix:classpath:/templates/}") - private String prefix = "classpath:/templates/"; - - @Value("${spring.template.suffix:.html}") - private String suffix = ".html"; - - @Value("${spring.template.cache:true}") - private boolean cacheable; - - @Value("${spring.template.mode:HTML5}") - private String templateMode = "HTML5"; - - @Bean - public ITemplateResolver defaultTemplateResolver() { - TemplateResolver resolver = new TemplateResolver(); - resolver.setResourceResolver(new IResourceResolver() { - @Override - public InputStream getResourceAsStream( - TemplateProcessingParameters templateProcessingParameters, - String resourceName) { - try { - return DefaultTemplateResolverConfiguration.this.resourceLoader - .getResource(resourceName).getInputStream(); - } catch (IOException e) { - return null; - } - } - - @Override - public String getName() { - return "SPRING"; - } - }); - resolver.setPrefix(this.prefix); - resolver.setSuffix(this.suffix); - resolver.setTemplateMode(this.templateMode); - resolver.setCacheable(this.cacheable); - return resolver; - } - - } - - @Configuration - @ConditionalOnMissingClass("nz.net.ultraq.web.thymeleaf.LayoutDialect") - @ConditionalOnMissingBean(SpringTemplateEngine.class) - protected static class ThymeleafDefaultConfiguration { - - @Autowired - private Collection templateResolvers = Collections.emptySet(); - - @Bean - public SpringTemplateEngine templateEngine() { - SpringTemplateEngine engine = new SpringTemplateEngine(); - for (ITemplateResolver templateResolver : this.templateResolvers) { - engine.addTemplateResolver(templateResolver); - } - return engine; - } - - } - - @Configuration - @ConditionalOnClass(name = "nz.net.ultraq.web.thymeleaf.LayoutDialect") - @ConditionalOnMissingBean(SpringTemplateEngine.class) - protected static class ThymeleafWebLayoutConfiguration { - - @Autowired - private Collection templateResolvers = Collections.emptySet(); - - @Bean - public SpringTemplateEngine templateEngine() { - SpringTemplateEngine engine = new SpringTemplateEngine(); - for (ITemplateResolver templateResolver : this.templateResolvers) { - engine.addTemplateResolver(templateResolver); - } - engine.addDialect(new LayoutDialect()); - return engine; - } - - } - - @Configuration - @ConditionalOnClass({ Servlet.class }) - protected static class ThymeleafViewResolverConfiguration { - - @Autowired - private SpringTemplateEngine templateEngine; - - @Bean - @ConditionalOnMissingBean(name = "thymeleafViewResolver") - public ThymeleafViewResolver thymeleafViewResolver() { - ThymeleafViewResolver resolver = new ThymeleafViewResolver(); - resolver.setTemplateEngine(this.templateEngine); - return resolver; - } - - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java deleted file mode 100644 index 7d4e6cdd6ec..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.web; - -import javax.servlet.Servlet; - -import org.apache.catalina.startup.Tomcat; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.Loader; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.ServletContextInitializer; -import org.springframework.bootstrap.context.embedded.jetty.JettyEmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.web.servlet.DispatcherServlet; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for an embedded servlet containers. - * - * @author Phillip Webb - * @author Dave Syer - */ -@Order(Ordered.HIGHEST_PRECEDENCE) -public class EmbeddedServletContainerAutoConfiguration { - - /** - * Support {@link EmbeddedServletContainerCustomizerBeanPostProcessor} to apply - * {@link EmbeddedServletContainerCustomizer}s. - */ - @Bean - @ConditionalOnMissingBean(value = EmbeddedServletContainerCustomizerBeanPostProcessor.class, considerHierarchy = false) - public EmbeddedServletContainerCustomizerBeanPostProcessor embeddedServletContainerCustomizerBeanPostProcessor() { - return new EmbeddedServletContainerCustomizerBeanPostProcessor(); - } - - /** - * Add the {@link DispatcherServlet} unless the user has defined their own - * {@link ServletContextInitializer}s. - */ - @ConditionalOnClass(DispatcherServlet.class) - public static class DispatcherServletConfiguration { - - @Bean - @ConditionalOnMissingBean(value = { ServletContextInitializer.class, - Servlet.class }, considerHierarchy = false) - public DispatcherServlet dispatcherServlet() { - return new DispatcherServlet(); - } - } - - /** - * Nested configuration for if Tomcat is being used. - */ - @Configuration - @ConditionalOnClass({ Servlet.class, Tomcat.class }) - @ConditionalOnMissingBean(value = EmbeddedServletContainerFactory.class, considerHierarchy = false) - public static class EmbeddedTomcat { - - @Bean - public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() { - return new TomcatEmbeddedServletContainerFactory(); - } - - } - - /** - * Nested configuration if Jetty is being used. - */ - @Configuration - @ConditionalOnClass({ Servlet.class, Server.class, Loader.class }) - @ConditionalOnMissingBean(value = EmbeddedServletContainerFactory.class, considerHierarchy = false) - public static class EmbeddedJetty { - - @Bean - public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() { - return new JettyEmbeddedServletContainerFactory(); - } - - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java deleted file mode 100644 index 4bdab4dc578..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.web; - -import javax.servlet.MultipartConfigElement; -import javax.servlet.Servlet; - -import org.springframework.bootstrap.context.annotation.ConditionalOnBean; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.context.embedded.EmbeddedWebApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.multipart.support.StandardServletMultipartResolver; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for multi-part uploads. Adds a - * {@link StandardServletMultipartResolver} when a {@link MultipartConfigElement} bean is - * defined. The {@link EmbeddedWebApplicationContext} will associated the - * {@link MultipartConfigElement} bean to any {@link Servlet} beans. - * - * @author Greg Turnquist - */ -@Configuration -@ConditionalOnClass({ Servlet.class, StandardServletMultipartResolver.class }) -@ConditionalOnBean(MultipartConfigElement.class) -public class MultipartAutoConfiguration { - - @Bean - public StandardServletMultipartResolver multipartResolver() { - return new StandardServletMultipartResolver(); - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java deleted file mode 100644 index 7d9c69b9f80..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.web; - -import org.apache.catalina.valves.AccessLogValve; -import org.apache.catalina.valves.RemoteIpValve; -import org.springframework.beans.BeansException; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; -import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; -import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.bootstrap.properties.ServerProperties; -import org.springframework.bootstrap.properties.ServerProperties.Tomcat; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.util.StringUtils; - -/** - * {@link EnableAutoConfiguration Auto-configuration} that configures the - * {@link ConfigurableEmbeddedServletContainerFactory} from a {@link ServerProperties} - * bean. - * - * @author Dave Syer - */ -@Configuration -@EnableConfigurationProperties -public class ServerPropertiesAutoConfiguration implements - EmbeddedServletContainerCustomizer, ApplicationContextAware { - - private ApplicationContext applicationContext; - - @Bean(name = "org.springframework.bootstrap.properties.ServerProperties") - @ConditionalOnMissingBean - public ServerProperties serverProperties() { - return new ServerProperties(); - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) - throws BeansException { - this.applicationContext = applicationContext; - } - - @Override - public void customize(ConfigurableEmbeddedServletContainerFactory factory) { - - // Need to do a look up here to make it lazy - ServerProperties server = this.applicationContext.getBean(ServerProperties.class); - - factory.setPort(server.getPort()); - factory.setAddress(server.getAddress()); - factory.setContextPath(server.getContextPath()); - - if (factory instanceof TomcatEmbeddedServletContainerFactory) { - configureTomcat((TomcatEmbeddedServletContainerFactory) factory, server); - } - - } - - private void configureTomcat(TomcatEmbeddedServletContainerFactory tomcatFactory, - ServerProperties configuration) { - - Tomcat tomcat = configuration.getTomcat(); - if (tomcat.getBasedir() != null) { - tomcatFactory.setBaseDirectory(tomcat.getBasedir()); - } - - String remoteIpHeader = tomcat.getRemoteIpHeader(); - String protocolHeader = tomcat.getProtocolHeader(); - - if (StringUtils.hasText(remoteIpHeader) || StringUtils.hasText(protocolHeader)) { - RemoteIpValve valve = new RemoteIpValve(); - valve.setRemoteIpHeader(remoteIpHeader); - valve.setProtocolHeader(protocolHeader); - tomcatFactory.addContextValves(valve); - } - - String pattern = tomcat.getAccessLogPattern(); - if (pattern != null) { - AccessLogValve valve = new AccessLogValve(); - valve.setPattern(pattern); - valve.setSuffix(".log"); - tomcatFactory.addContextValves(valve); - } - - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java deleted file mode 100644 index 232815d1851..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.web; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import javax.servlet.Servlet; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.ListableBeanFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.context.annotation.AutoConfigureAfter; -import org.springframework.bootstrap.context.annotation.ConditionalOnBean; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.core.convert.converter.Converter; -import org.springframework.core.convert.converter.GenericConverter; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.format.Formatter; -import org.springframework.format.FormatterRegistry; -import org.springframework.web.accept.ContentNegotiationManager; -import org.springframework.web.servlet.DispatcherServlet; -import org.springframework.web.servlet.HandlerAdapter; -import org.springframework.web.servlet.HandlerMapping; -import org.springframework.web.servlet.View; -import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; -import org.springframework.web.servlet.resource.ResourceHttpRequestHandler; -import org.springframework.web.servlet.view.BeanNameViewResolver; -import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for {@link EnableWebMvc Web MVC}. - * - * @author Phillip Webb - * @author Dave Syer - */ -@Configuration -@ConditionalOnClass({ Servlet.class, DispatcherServlet.class, - WebMvcConfigurerAdapter.class }) -@ConditionalOnMissingBean({ HandlerAdapter.class, HandlerMapping.class }) -@Order(Ordered.HIGHEST_PRECEDENCE + 10) -@AutoConfigureAfter(EmbeddedServletContainerAutoConfiguration.class) -public class WebMvcAutoConfiguration { - - // Defined as a nested config to ensure WebMvcConfigurerAdapter it not read when not - // on the classpath - @EnableWebMvc - public static class WebMvcAutoConfigurationAdapter extends WebMvcConfigurerAdapter { - - @Autowired - private ListableBeanFactory beanFactory; - - @ConditionalOnBean(View.class) - @Bean - public BeanNameViewResolver beanNameViewResolver() { - BeanNameViewResolver resolver = new BeanNameViewResolver(); - resolver.setOrder(0); - return resolver; - } - - @ConditionalOnBean(View.class) - @Bean - public ContentNegotiatingViewResolver viewResolver(BeanFactory beanFactory) { - ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver(); - resolver.setContentNegotiationManager(beanFactory - .getBean(ContentNegotiationManager.class)); - return resolver; - } - - @Override - public void configureDefaultServletHandling( - DefaultServletHandlerConfigurer configurer) { - configurer.enable(); - } - - @Override - public void addFormatters(FormatterRegistry registry) { - for (Converter converter : getBeansOfType(Converter.class)) { - registry.addConverter(converter); - } - - for (GenericConverter converter : getBeansOfType(GenericConverter.class)) { - registry.addConverter(converter); - } - - for (Formatter formatter : getBeansOfType(Formatter.class)) { - registry.addFormatter(formatter); - } - } - - private Collection getBeansOfType(Class type) { - return this.beanFactory.getBeansOfType(type).values(); - } - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - // FIXME exposing the root classpath is a security risk - // eg http://localhost:8080/org/springframework/bootstrap/Banner.class - registry.addResourceHandler("/resources/**").addResourceLocations("/") - .addResourceLocations("classpath:/META-INF/resources/") - .addResourceLocations("classpath:/resources/") - .addResourceLocations("classpath:/"); - registry.addResourceHandler("/**").addResourceLocations("/") - .addResourceLocations("classpath:/META-INF/resources/") - .addResourceLocations("classpath:/static/") - .addResourceLocations("classpath:/"); - } - - @Configuration - public static class FaviconConfiguration { - - @Bean - public SimpleUrlHandlerMapping faviconHandlerMapping() { - SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping(); - mapping.setOrder(Integer.MIN_VALUE + 1); - mapping.setUrlMap(Collections.singletonMap("**/favicon.ico", - faviconRequestHandler())); - return mapping; - } - - @Bean - protected ResourceHttpRequestHandler faviconRequestHandler() { - ResourceHttpRequestHandler requestHandler = new ResourceHttpRequestHandler(); - requestHandler.setLocations(Arrays - . asList(new ClassPathResource("/"))); - return requestHandler; - } - } - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java deleted file mode 100644 index f3f2a71b0dd..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.context.annotation; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.springframework.core.OrderComparator; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.core.io.ResourceLoader; -import org.springframework.core.type.AnnotationMetadata; -import org.springframework.core.type.classreading.CachingMetadataReaderFactory; -import org.springframework.core.type.classreading.MetadataReader; -import org.springframework.util.Assert; - -/** - * Sort {@link EnableAutoConfiguration auto-configuration} classes into priority order by - * reading {@link Ordered} and {@link AutoConfigureAfter} annotations (without loading - * classes). - * - * @author Phillip Webb - */ -class AutoConfigurationSorter { - - private CachingMetadataReaderFactory metadataReaderFactory; - - public AutoConfigurationSorter(ResourceLoader resourceLoader) { - Assert.notNull(resourceLoader, "ResourceLoader must not be null"); - this.metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader); - } - - public List getInPriorityOrder(Collection classNames) - throws IOException { - List autoConfigurationClasses = new ArrayList(); - for (String className : classNames) { - autoConfigurationClasses.add(new AutoConfigurationClass(className)); - } - - // Sort initially by order - Collections.sort(autoConfigurationClasses, OrderComparator.INSTANCE); - - // Then respect @AutoConfigureAfter - autoConfigurationClasses = sortByAfterAnnotation(autoConfigurationClasses); - - List orderedClassNames = new ArrayList(); - for (AutoConfigurationClass autoConfigurationClass : autoConfigurationClasses) { - orderedClassNames.add(autoConfigurationClass.toString()); - } - return orderedClassNames; - } - - private List sortByAfterAnnotation( - Collection autoConfigurationClasses) - throws IOException { - List tosort = new ArrayList( - autoConfigurationClasses); - Set sorted = new LinkedHashSet(); - Set processing = new LinkedHashSet(); - while (!tosort.isEmpty()) { - doSortByAfterAnnotation(tosort, sorted, processing, null); - } - return new ArrayList(sorted); - } - - private void doSortByAfterAnnotation(List tosort, - Set sorted, Set processing, - AutoConfigurationClass current) throws IOException { - - if (current == null) { - current = tosort.remove(0); - } - - processing.add(current); - - for (AutoConfigurationClass after : current.getAfter()) { - Assert.state(!processing.contains(after), - "Cycle @AutoConfigureAfter detected between " + current + " and " - + after); - if (!sorted.contains(after) && tosort.contains(after)) { - doSortByAfterAnnotation(tosort, sorted, processing, after); - } - } - - processing.remove(current); - sorted.add(current); - } - - private class AutoConfigurationClass implements Ordered { - - private final String className; - - private final int order; - - private List after; - - private Map afterAnnotation; - - public AutoConfigurationClass(String className) throws IOException { - - this.className = className; - - MetadataReader metadataReader = AutoConfigurationSorter.this.metadataReaderFactory - .getMetadataReader(className); - AnnotationMetadata metadata = metadataReader.getAnnotationMetadata(); - - // Read @Order annotation - Map orderedAnnotation = metadata - .getAnnotationAttributes(Order.class.getName()); - this.order = (orderedAnnotation == null ? Ordered.LOWEST_PRECEDENCE - : (Integer) orderedAnnotation.get("value")); - - // Read @AutoConfigureAfter annotation - this.afterAnnotation = metadata.getAnnotationAttributes( - AutoConfigureAfter.class.getName(), true); - } - - @Override - public int getOrder() { - return this.order; - } - - public List getAfter() throws IOException { - if (this.after == null) { - if (this.afterAnnotation == null) { - this.after = Collections.emptyList(); - } else { - this.after = new ArrayList(); - for (String afterClass : (String[]) this.afterAnnotation.get("value")) { - this.after.add(new AutoConfigurationClass(afterClass)); - } - } - } - return this.after; - } - - @Override - public String toString() { - return this.className; - } - - @Override - public int hashCode() { - return this.className.hashCode(); - } - - @Override - public boolean equals(Object obj) { - return this.className.equals(((AutoConfigurationClass) obj).className); - } - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java deleted file mode 100644 index c5a0d8fee30..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.context.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Hint for that an {@link EnableAutoConfiguration auto-configuration} should be applied - * after the specified auto-configuration classes. - * - * @author Phillip Webb - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE }) -public @interface AutoConfigureAfter { - Class[] value(); -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java deleted file mode 100644 index 35eab37d5a1..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.context.annotation; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.beans.factory.support.AbstractBeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.bootstrap.autoconfigure.AutoConfigurationUtils; -import org.springframework.cglib.proxy.Enhancer; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; -import org.springframework.core.annotation.AnnotationAttributes; -import org.springframework.core.type.AnnotationMetadata; -import org.springframework.core.type.StandardAnnotationMetadata; -import org.springframework.core.type.classreading.MetadataReader; -import org.springframework.core.type.classreading.MetadataReaderFactory; -import org.springframework.core.type.classreading.SimpleMetadataReaderFactory; -import org.springframework.util.ClassUtils; -import org.springframework.util.StringUtils; - -/** - * Helper to detect a component scan declared in the enclosing context (normally on a - * {@code @Configuration} class). Once the component scan is detected, the base packages - * are stored for retrieval later. - * - * @author Dave Syer - * @author Phillip Webb - * @see AutoConfigurationUtils - */ -class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactoryAware { - - private final Log logger = LogFactory.getLog(getClass()); - - private BeanFactory beanFactory; - - private MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); - - @Override - public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, - final BeanDefinitionRegistry registry) { - storeComponentScanBasePackages(); - } - - private void storeComponentScanBasePackages() { - if (this.beanFactory instanceof ConfigurableListableBeanFactory) { - storeComponentScanBasePackages((ConfigurableListableBeanFactory) this.beanFactory); - } else { - if (this.logger.isWarnEnabled()) { - this.logger - .warn("Unable to read @ComponentScan annotations for auto-configure"); - } - } - } - - private void storeComponentScanBasePackages( - ConfigurableListableBeanFactory beanFactory) { - List basePackages = new ArrayList(); - for (String beanName : beanFactory.getBeanDefinitionNames()) { - BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName); - String[] basePackagesAttribute = (String[]) beanDefinition - .getAttribute("componentScanBasePackages"); - if (basePackagesAttribute != null) { - basePackages.addAll(Arrays.asList(basePackagesAttribute)); - } - AnnotationMetadata metadata = getMetadata(beanDefinition); - basePackages.addAll(getBasePackages(metadata)); - } - AutoConfigurationUtils.storeBasePackages(beanFactory, basePackages); - } - - private AnnotationMetadata getMetadata(BeanDefinition beanDefinition) { - if (beanDefinition instanceof AbstractBeanDefinition - && ((AbstractBeanDefinition) beanDefinition).hasBeanClass()) { - Class beanClass = ((AbstractBeanDefinition) beanDefinition).getBeanClass(); - if (Enhancer.isEnhanced(beanClass)) { - beanClass = beanClass.getSuperclass(); - } - return new StandardAnnotationMetadata(beanClass, true); - } - String className = beanDefinition.getBeanClassName(); - if (className != null) { - try { - MetadataReader metadataReader = this.metadataReaderFactory - .getMetadataReader(className); - return metadataReader.getAnnotationMetadata(); - } catch (IOException ex) { - if (this.logger.isDebugEnabled()) { - this.logger.debug( - "Could not find class file for introspecting @ComponentScan classes: " - + className, ex); - } - } - } - return null; - } - - private List getBasePackages(AnnotationMetadata metadata) { - AnnotationAttributes attributes = AnnotationAttributes - .fromMap((metadata == null ? null : metadata.getAnnotationAttributes( - ComponentScan.class.getName(), true))); - if (attributes != null) { - List basePackages = new ArrayList(); - addAllHavingText(basePackages, attributes.getStringArray("value")); - addAllHavingText(basePackages, attributes.getStringArray("basePackages")); - for (String packageClass : attributes.getStringArray("basePackageClasses")) { - basePackages.add(ClassUtils.getPackageName(packageClass)); - } - if (basePackages.isEmpty()) { - basePackages.add(ClassUtils.getPackageName(metadata.getClassName())); - } - return basePackages; - } - return Collections.emptyList(); - } - - private void addAllHavingText(List list, String[] strings) { - for (String s : strings) { - if (StringUtils.hasText(s)) { - list.add(s); - } - } - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = beanFactory; - } -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java deleted file mode 100644 index 47bce123717..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.context.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.context.annotation.Conditional; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.core.io.support.SpringFactoriesLoader; - -/** - * Enable auto-configuration of the Spring Application Context, attempting to guess and - * configure beans that you are likely to need. - * - * Auto-configuration classes are usually applied based on your classpath and what beans - * you have defined. For example, If you have {@code tomat-embedded.jar} on your classpath - * you are likely to want a {@link TomcatEmbeddedServletContainerFactory} (unless you have - * defined your own {@link EmbeddedServletContainerFactory} bean). - * - *

- * Auto-configuration tries to be as intelligent as possible and will back-away as you - * define more of your own configuration. You can always manually {@link #exclude()} any - * configuration that you never want to apply. Auto-configuration is always applied after - * user-defined beans have been registered. - * - *

- * Auto-configuration classes are regular Spring {@link Configuration} beans. They are - * located using the {@link SpringFactoriesLoader} mechanism (keyed against this class). - * Generally auto-configuration beans are {@link Conditional @Conditional} beans (most - * often using {@link ConditionalOnClass @ConditionalOnClass} and - * {@link ConditionalOnMissingBean @ConditionalOnMissingBean} annotations). - * - * @author Phillip Webb - * @see ConditionalOnBean - * @see ConditionalOnMissingBean - * @see ConditionalOnClass - * @see AutoConfigureAfter - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Import(EnableAutoConfigurationImportSelector.class) -public @interface EnableAutoConfiguration { - - /** - * Exclude specific auto-configuration classes such that they will never be applied. - */ - Class[] exclude() default {}; - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java deleted file mode 100644 index 63a975cac58..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.context.annotation; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.springframework.beans.factory.BeanClassLoaderAware; -import org.springframework.context.ResourceLoaderAware; -import org.springframework.context.annotation.DeferredImportSelector; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.AnnotationAttributes; -import org.springframework.core.annotation.Order; -import org.springframework.core.io.ResourceLoader; -import org.springframework.core.io.support.SpringFactoriesLoader; -import org.springframework.core.type.AnnotationMetadata; - -/** - * {@link DeferredImportSelector} to handle {@link EnableAutoConfiguration - * auto-configuration}. - * - * @author Phillip Webb - * @see EnableAutoConfiguration - */ -@Order(Ordered.LOWEST_PRECEDENCE) -class EnableAutoConfigurationImportSelector implements DeferredImportSelector, - BeanClassLoaderAware, ResourceLoaderAware { - - private ClassLoader beanClassLoader; - - private ResourceLoader resourceLoader; - - @Override - public String[] selectImports(AnnotationMetadata metadata) { - try { - AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata - .getAnnotationAttributes(EnableAutoConfiguration.class.getName(), - true)); - - // Find all possible auto configuration classes - List factories = new ArrayList( - SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, - this.beanClassLoader)); - - // Remove those specifically disabled - factories.removeAll(Arrays.asList(attributes.getStringArray("exclude"))); - - // Sort - factories = new AutoConfigurationSorter(this.resourceLoader) - .getInPriorityOrder(factories); - - // Always add the ComponentScanDetector as the first in the list - factories.add(0, ComponentScanDetector.class.getName()); - - return factories.toArray(new String[factories.size()]); - } catch (IOException ex) { - throw new IllegalStateException(ex); - } - } - - @Override - public void setBeanClassLoader(ClassLoader classLoader) { - this.beanClassLoader = classLoader; - } - - @Override - public void setResourceLoader(ResourceLoader resourceLoader) { - this.resourceLoader = resourceLoader; - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/main/Spring.java b/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/main/Spring.java deleted file mode 100644 index 9122239abcd..00000000000 --- a/spring-zero-autoconfigure/src/main/java/org/springframework/bootstrap/main/Spring.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.main; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.logging.LogFactory; -import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.SpringVersion; -import org.springframework.util.ClassUtils; - -/** - * Very simple main class that can be used to launch an application from sources (class, - * package or XML). Useful for demos and testing, perhaps less for production use (where - * the {@link SpringApplication} run methods are often more convenient). - * - * @author Dave Syer - */ -@Configuration -@EnableAutoConfiguration -@ComponentScan -public class Spring { - - // FIXME can we delete this? is it used? does it belong here - - private static ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( - true); - - private static ApplicationContext context; - - /** - * @return the context if there is one - */ - public static ApplicationContext getApplicationContext() { - return context; - } - - /** - * A basic main that can be used to launch an application. - * - * @param args command line arguments - * @see SpringApplication#run(Object[], String[]) - * @see SpringApplication#run(Object, String...) - */ - public static void main(String[] args) throws Exception { - - List strings = new ArrayList(); - List sources = new ArrayList(); - - for (String arg : args) { - if (ClassUtils.isPresent(arg, null)) { - sources.add(ClassUtils.forName(arg, null)); - } else if (arg.endsWith(".xml")) { - sources.add(arg); - } else if (!scanner.findCandidateComponents(arg).isEmpty()) { - sources.add(arg); - } else { - strings.add(arg); - } - } - - if (sources.isEmpty()) { - sources.add(Spring.class); - } - - context = SpringApplication.run(sources.toArray(new Object[sources.size()]), - strings.toArray(new String[strings.size()])); - - LogFactory.getLog(Spring.class).info( - "Running Spring " + SpringVersion.getVersion() + " with sources: " - + sources); - - } - -} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/AutoConfigurationUtils.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/AutoConfigurationUtils.java new file mode 100644 index 00000000000..1eb5e34f824 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/AutoConfigurationUtils.java @@ -0,0 +1,63 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; + +/** + * Convenience class for storing base packages during component scan, for reference later + * (e.g. by JPA entity scanner). + * + * @author Phil Webb + * @author Dave Syer + */ +public abstract class AutoConfigurationUtils { + + private static String BASE_PACKAGES_BEAN = AutoConfigurationUtils.class.getName() + + ".basePackages"; + + @SuppressWarnings("unchecked") + public static List getBasePackages(BeanFactory beanFactory) { + try { + return beanFactory.getBean(BASE_PACKAGES_BEAN, List.class); + } catch (NoSuchBeanDefinitionException e) { + return Collections.emptyList(); + } + } + + public static void storeBasePackages(ConfigurableListableBeanFactory beanFactory, + List basePackages) { + if (!beanFactory.containsBean(BASE_PACKAGES_BEAN)) { + beanFactory.registerSingleton(BASE_PACKAGES_BEAN, new ArrayList( + basePackages)); + } else { + List packages = getBasePackages(beanFactory); + for (String pkg : basePackages) { + if (packages.contains(pkg)) { + packages.add(pkg); + } + } + } + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/MessageSourceAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/MessageSourceAutoConfiguration.java new file mode 100644 index 00000000000..a0655386616 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/MessageSourceAutoConfiguration.java @@ -0,0 +1,49 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ResourceBundleMessageSource; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}. + * + * @author Dave Syer + */ +@Configuration +@ConditionalOnMissingBean(MessageSource.class) +@Order(Ordered.HIGHEST_PRECEDENCE) +public class MessageSourceAutoConfiguration { + + @Value("${spring.messages.basename:messages}") + private String basename; + + @Bean + public MessageSource messageSource() { + ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); + messageSource.setBasename(this.basename); + return messageSource; + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/PropertyPlaceholderAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/PropertyPlaceholderAutoConfiguration.java new file mode 100644 index 00000000000..b766ab72739 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/PropertyPlaceholderAutoConfiguration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for + * {@link PropertySourcesPlaceholderConfigurer}. + * + * @author Phillip Webb + * @author Dave Syer + */ +@Configuration +@Order(Ordered.HIGHEST_PRECEDENCE) +public class PropertyPlaceholderAutoConfiguration { + + @Bean + @ConditionalOnMissingBean + public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer( + ApplicationContext context) { + return new PropertySourcesPlaceholderConfigurer(); + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/BatchAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/BatchAutoConfiguration.java new file mode 100644 index 00000000000..e103fe828b1 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/BatchAutoConfiguration.java @@ -0,0 +1,58 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.batch; + +import org.springframework.batch.core.launch.JobLauncher; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.CommandLineRunner; +import org.springframework.zero.ExitCodeGenerator; +import org.springframework.zero.context.annotation.ConditionalOnBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for Spring Batch. + * + * @author Dave Syer + */ +@Configuration +@ConditionalOnClass({ JobLauncher.class }) +public class BatchAutoConfiguration { + + @Bean + // Harmless to always include this, but maybe could make it conditional as well + public BatchDatabaseInitializer batchDatabaseInitializer() { + return new BatchDatabaseInitializer(); + } + + @Bean + @ConditionalOnMissingBean(CommandLineRunner.class) + @ConditionalOnBean(JobLauncher.class) + public JobLauncherCommandLineRunner jobLauncherCommandLineRunner() { + return new JobLauncherCommandLineRunner(); + } + + @Bean + @ConditionalOnMissingBean(ExitCodeGenerator.class) + @ConditionalOnBean(JobLauncher.class) + public ExitCodeGenerator jobExecutionExitCodeGenerator() { + return new JobExecutionExitCodeGenerator(); + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/BatchDatabaseInitializer.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/BatchDatabaseInitializer.java new file mode 100644 index 00000000000..0f0fb24a487 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/BatchDatabaseInitializer.java @@ -0,0 +1,60 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.batch; + +import javax.annotation.PostConstruct; +import javax.sql.DataSource; + +import org.springframework.batch.support.DatabaseType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ResourceLoader; +import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils; +import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; +import org.springframework.stereotype.Component; + +/** + * Initialize the Spring Batch schema (ignoring errors, so should be idempotent). + * + * @author Dave Syer + */ +@Component +public class BatchDatabaseInitializer { + + @Autowired + private DataSource dataSource; + + @Autowired + private ResourceLoader resourceLoader; + + @Value("${spring.batch.schema:classpath:org/springframework/batch/core/schema-@@platform@@.sql}") + private String schemaLocation = "classpath:org/springframework/batch/core/schema-@@platform@@.sql"; + + @PostConstruct + protected void initialize() throws Exception { + String platform = DatabaseType.fromMetaData(this.dataSource).toString() + .toLowerCase(); + if ("hsql".equals(platform)) { + platform = "hsqldb"; + } + ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); + populator.addScript(this.resourceLoader.getResource(this.schemaLocation.replace( + "@@platform@@", platform))); + populator.setContinueOnError(true); + DatabasePopulatorUtils.execute(populator, this.dataSource); + } +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobExecutionEvent.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobExecutionEvent.java new file mode 100644 index 00000000000..c7bb4468c26 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobExecutionEvent.java @@ -0,0 +1,46 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.batch; + +import org.springframework.batch.core.JobExecution; +import org.springframework.context.ApplicationEvent; + +/** + * Spring {@link ApplicationEvent} encapsulating a {@link JobExecution}. + * + * @author Dave Syer + */ +public class JobExecutionEvent extends ApplicationEvent { + + private JobExecution execution; + + /** + * @param execution the job execution + */ + public JobExecutionEvent(JobExecution execution) { + super(execution); + this.execution = execution; + } + + /** + * @return the job execution + */ + public JobExecution getJobExecution() { + return this.execution; + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobExecutionExitCodeGenerator.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobExecutionExitCodeGenerator.java new file mode 100644 index 00000000000..cdab3f50ef7 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobExecutionExitCodeGenerator.java @@ -0,0 +1,51 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.batch; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.batch.core.JobExecution; +import org.springframework.context.ApplicationListener; +import org.springframework.zero.ExitCodeGenerator; + +/** + * {@link ExitCodeGenerator} for {@link JobExecutionEvent}s. + * + * @author Dave Syer + */ +public class JobExecutionExitCodeGenerator implements + ApplicationListener, ExitCodeGenerator { + + private List executions = new ArrayList(); + + @Override + public void onApplicationEvent(JobExecutionEvent event) { + this.executions.add(event.getJobExecution()); + } + + @Override + public int getExitCode() { + for (JobExecution execution : this.executions) { + if (execution.getStatus().ordinal() > 0) { + return execution.getStatus().ordinal(); + } + } + return 0; + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobLauncherCommandLineRunner.java new file mode 100644 index 00000000000..d022441bcf7 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/batch/JobLauncherCommandLineRunner.java @@ -0,0 +1,82 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.batch; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Properties; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.batch.core.Job; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobExecutionException; +import org.springframework.batch.core.converter.DefaultJobParametersConverter; +import org.springframework.batch.core.converter.JobParametersConverter; +import org.springframework.batch.core.launch.JobLauncher; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.ApplicationEventPublisherAware; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import org.springframework.zero.CommandLineRunner; + +/** + * {@link CommandLineRunner} to {@link JobLauncher launch} Spring Batch jobs. + * + * @author Dave Syer + */ +@Component +public class JobLauncherCommandLineRunner implements CommandLineRunner, + ApplicationEventPublisherAware { + + private static Log logger = LogFactory.getLog(JobLauncherCommandLineRunner.class); + + @Autowired(required = false) + private JobParametersConverter converter = new DefaultJobParametersConverter(); + + @Autowired + private JobLauncher jobLauncher; + + @Autowired(required = false) + private Collection jobs = Collections.emptySet(); + + private ApplicationEventPublisher publisher; + + @Override + public void setApplicationEventPublisher(ApplicationEventPublisher publisher) { + this.publisher = publisher; + } + + @Override + public void run(String... args) throws JobExecutionException { + logger.info("Running default command line with: " + Arrays.asList(args)); + launchJobFromProperties(StringUtils.splitArrayElementsIntoProperties(args, "=")); + } + + protected void launchJobFromProperties(Properties properties) + throws JobExecutionException { + for (Job job : this.jobs) { + JobExecution execution = this.jobLauncher.run(job, + this.converter.getJobParameters(properties)); + if (this.publisher != null) { + this.publisher.publishEvent(new JobExecutionEvent(execution)); + } + } + } +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfiguration.java new file mode 100644 index 00000000000..cc676d0b3cc --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfiguration.java @@ -0,0 +1,40 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.data; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for Spring Data's JPA Repositories. + * + * @author Phillip Webb + * @see EnableJpaRepositories + */ +@Configuration +@ConditionalOnClass(JpaRepository.class) +@ConditionalOnMissingBean(JpaRepositoryFactoryBean.class) +@Import(JpaRepositoriesAutoConfigureRegistrar.class) +public class JpaRepositoriesAutoConfiguration { + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java new file mode 100644 index 00000000000..ab10117d9fd --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java @@ -0,0 +1,122 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.data; + +import java.util.Collection; +import java.util.List; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanClassLoaderAware; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; +import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.core.io.ResourceLoader; +import org.springframework.core.type.AnnotationMetadata; +import org.springframework.core.type.StandardAnnotationMetadata; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension; +import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource; +import org.springframework.data.repository.config.RepositoryBeanDefinitionBuilder; +import org.springframework.data.repository.config.RepositoryBeanNameGenerator; +import org.springframework.data.repository.config.RepositoryConfiguration; +import org.springframework.data.repository.config.RepositoryConfigurationExtension; +import org.springframework.util.Assert; +import org.springframework.zero.autoconfigure.AutoConfigurationUtils; + +/** + * {@link ImportBeanDefinitionRegistrar} used to auto-configure Spring Data JPA + * Repositories. + * + * @author Phillip Webb + */ +class JpaRepositoriesAutoConfigureRegistrar implements ImportBeanDefinitionRegistrar, + BeanFactoryAware, BeanClassLoaderAware { + + private BeanFactory beanFactory; + + private ClassLoader beanClassLoader; + + @Override + public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, + final BeanDefinitionRegistry registry) { + + final ResourceLoader resourceLoader = new DefaultResourceLoader(); + final AnnotationRepositoryConfigurationSource configurationSource = getConfigurationSource(); + final RepositoryConfigurationExtension extension = new JpaRepositoryConfigExtension(); + extension.registerBeansForRoot(registry, configurationSource); + + final RepositoryBeanNameGenerator generator = new RepositoryBeanNameGenerator(); + generator.setBeanClassLoader(this.beanClassLoader); + + Collection> repositoryConfigurations = extension + .getRepositoryConfigurations(configurationSource, resourceLoader); + + for (final RepositoryConfiguration repositoryConfiguration : repositoryConfigurations) { + RepositoryBeanDefinitionBuilder builder = new RepositoryBeanDefinitionBuilder( + repositoryConfiguration, extension); + BeanDefinitionBuilder definitionBuilder = builder.build(registry, + resourceLoader); + extension.postProcess(definitionBuilder, configurationSource); + + String beanName = generator.generateBeanName( + definitionBuilder.getBeanDefinition(), registry); + registry.registerBeanDefinition(beanName, + definitionBuilder.getBeanDefinition()); + } + } + + private AnnotationRepositoryConfigurationSource getConfigurationSource() { + StandardAnnotationMetadata metadata = new StandardAnnotationMetadata( + EnableJpaRepositoriesConfiguration.class, true); + AnnotationRepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource( + metadata, EnableJpaRepositories.class) { + + @Override + public java.lang.Iterable getBasePackages() { + return JpaRepositoriesAutoConfigureRegistrar.this.getBasePackages(); + }; + }; + return configurationSource; + } + + protected Iterable getBasePackages() { + List basePackages = AutoConfigurationUtils + .getBasePackages(this.beanFactory); + Assert.notEmpty( + basePackages, + "Unable to find JPA repository base packages, please define " + + "a @ComponentScan annotation or disable JpaRepositoriesAutoConfigure"); + return basePackages; + } + + @Override + public void setBeanFactory(BeanFactory beanFactory) throws BeansException { + this.beanFactory = beanFactory; + } + + @Override + public void setBeanClassLoader(ClassLoader classLoader) { + this.beanClassLoader = classLoader; + } + + @EnableJpaRepositories + private static class EnableJpaRepositoriesConfiguration { + } +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/AbstractDataSourceConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/AbstractDataSourceConfiguration.java new file mode 100644 index 00000000000..27530273174 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/AbstractDataSourceConfiguration.java @@ -0,0 +1,86 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import org.springframework.beans.factory.BeanCreationException; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.util.StringUtils; + +/** + * Base class for configuration of a database pool. + * + * @author Dave Syer + */ +public class AbstractDataSourceConfiguration { + + // TODO: add pool parameters + + @Value("${spring.database.driverClassName:}") + private String driverClassName; + + @Value("${spring.database.url:}") + private String url; + + @Value("${spring.database.username:sa}") + private String username; + + @Value("${spring.database.password:}") + private String password; + + protected String getDriverClassName() { + if (StringUtils.hasText(this.driverClassName)) { + return this.driverClassName; + } + EmbeddedDatabaseType embeddedDatabaseType = EmbeddedDatabaseConfiguration + .getEmbeddedDatabaseType(); + this.driverClassName = EmbeddedDatabaseConfiguration + .getEmbeddedDatabaseDriverClass(embeddedDatabaseType); + if (!StringUtils.hasText(this.driverClassName)) { + throw new BeanCreationException( + "Cannot determine embedded database driver class for database type " + + embeddedDatabaseType + + ". If you want an embedded database please put a supoprted one on the classpath."); + } + return this.driverClassName; + } + + protected String getUrl() { + if (StringUtils.hasText(this.url)) { + return this.url; + } + EmbeddedDatabaseType embeddedDatabaseType = EmbeddedDatabaseConfiguration + .getEmbeddedDatabaseType(); + this.url = EmbeddedDatabaseConfiguration + .getEmbeddedDatabaseUrl(embeddedDatabaseType); + if (!StringUtils.hasText(this.url)) { + throw new BeanCreationException( + "Cannot determine embedded database url for database type " + + embeddedDatabaseType + + ". If you want an embedded database please put a supported on on the classpath."); + } + return this.url; + } + + protected String getUsername() { + return this.username; + } + + protected String getPassword() { + return this.password; + } +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfiguration.java new file mode 100644 index 00000000000..fb7f497d7d9 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfiguration.java @@ -0,0 +1,68 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import java.sql.SQLException; + +import javax.annotation.PreDestroy; +import javax.sql.DataSource; + +import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.dao.DataAccessResourceFailureException; + +/** + * Configuration for a Commons DBCP database pool. The DBCP pool is popular but not + * recommended in high volume environments (the Tomcat DataSource is more reliable). + * + * @author Dave Syer + */ +@Configuration +public class BasicDataSourceConfiguration extends AbstractDataSourceConfiguration { + + private static Log logger = LogFactory.getLog(BasicDataSourceConfiguration.class); + + private BasicDataSource pool; + + @Bean + public DataSource dataSource() { + logger.info("Hint: using Commons DBCP BasicDataSource. It's going to work, " + + "but the Tomcat DataSource is more reliable."); + this.pool = new BasicDataSource(); + this.pool.setDriverClassName(getDriverClassName()); + this.pool.setUrl(getUrl()); + this.pool.setUsername(getUsername()); + this.pool.setPassword(getPassword()); + return this.pool; + } + + @PreDestroy + public void close() { + if (this.pool != null) { + try { + this.pool.close(); + } catch (SQLException e) { + throw new DataAccessResourceFailureException( + "Could not close data source", e); + } + } + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/DataSourceAutoConfiguration.java new file mode 100644 index 00000000000..fde6f45943a --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -0,0 +1,294 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.sql.DataSource; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.BeanFactoryUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Condition; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.core.io.Resource; +import org.springframework.core.type.AnnotatedTypeMetadata; +import org.springframework.jdbc.core.JdbcOperations; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils; +import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; +import org.springframework.util.ClassUtils; +import org.springframework.util.StringUtils; +import org.springframework.zero.context.annotation.ConditionLogUtils; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for {@link DataSource}. + * + * @author Dave Syer + */ +@Configuration +@ConditionalOnClass(EmbeddedDatabaseType.class /* Spring JDBC */) +@ConditionalOnMissingBean(DataSource.class) +public class DataSourceAutoConfiguration { + + // FIXME see above + + private static Log logger = LogFactory.getLog(DataSourceAutoConfiguration.class); + + @Autowired(required = false) + private DataSource dataSource; + + @Autowired + private ApplicationContext applicationContext; + + @Conditional(DataSourceAutoConfiguration.EmbeddedDatabaseCondition.class) + @Import(EmbeddedDatabaseConfiguration.class) + protected static class EmbeddedConfiguration { + } + + @Conditional(DataSourceAutoConfiguration.TomcatDatabaseCondition.class) + @Import(TomcatDataSourceConfiguration.class) + protected static class TomcatConfiguration { + } + + @Conditional(DataSourceAutoConfiguration.BasicDatabaseCondition.class) + @Import(BasicDataSourceConfiguration.class) + protected static class DbcpConfiguration { + } + + @Configuration + @Conditional(DataSourceAutoConfiguration.SomeDatabaseCondition.class) + // FIXME: make this @ConditionalOnBean(DataSource.class) + protected static class JdbcTemplateConfiguration { + + @Autowired(required = false) + private DataSource dataSource; + + @Bean + @ConditionalOnMissingBean(JdbcOperations.class) + public JdbcOperations jdbcTemplate() { + return new JdbcTemplate(this.dataSource); + } + + @Bean + @ConditionalOnMissingBean(NamedParameterJdbcOperations.class) + public NamedParameterJdbcOperations namedParameterJdbcTemplate() { + return new NamedParameterJdbcTemplate(this.dataSource); + } + + } + + // FIXME: DB platform + @Value("${spring.database.schema:classpath*:schema-${spring.database.platform:all}.sql}") + private String schemaLocations = ""; + + @PostConstruct + protected void initialize() throws Exception { + if (this.dataSource == null) { + logger.debug("No DataSource found so not initializing"); + return; + } + ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); + boolean exists = false; + List resources = new ArrayList(); + for (String location : StringUtils + .commaDelimitedListToStringArray(this.schemaLocations)) { + resources + .addAll(Arrays.asList(this.applicationContext.getResources(location))); + } + for (Resource resource : resources) { + if (resource.exists()) { + exists = true; + populator.addScript(resource); + populator.setContinueOnError(true); + } + } + if (exists) { + DatabasePopulatorUtils.execute(populator, this.dataSource); + } + } + + static class SomeDatabaseCondition implements Condition { + + protected Log logger = LogFactory.getLog(getClass()); + + private Condition tomcatCondition = new TomcatDatabaseCondition(); + + private Condition dbcpCondition = new BasicDatabaseCondition(); + + private Condition embeddedCondition = new EmbeddedDatabaseCondition(); + + @Override + public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { + + String checking = ConditionLogUtils.getPrefix(this.logger, metadata); + + if (this.tomcatCondition.matches(context, metadata) + || this.dbcpCondition.matches(context, metadata) + || this.embeddedCondition.matches(context, metadata)) { + if (this.logger.isDebugEnabled()) { + this.logger.debug(checking + + "Existing auto database detected: match result true"); + } + return true; + } + if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors( + context.getBeanFactory(), DataSource.class, true, false).length > 0) { + if (this.logger.isDebugEnabled()) { + this.logger + .debug(checking + + "Existing bean configured database detected: match result true"); + } + return true; + } + if (this.logger.isDebugEnabled()) { + this.logger + .debug(checking + + "Existing bean configured database not detected: match result false"); + } + return false; + } + + } + + static class TomcatDatabaseCondition extends NonEmbeddedDatabaseCondition { + + @Override + protected String getDataSourecClassName() { + return "org.apache.tomcat.jdbc.pool.DataSource"; + } + + } + + static class BasicDatabaseCondition extends NonEmbeddedDatabaseCondition { + + private Condition condition = new TomcatDatabaseCondition(); + + @Override + protected String getDataSourecClassName() { + return "org.apache.commons.dbcp.BasicDataSource"; + } + + @Override + public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { + if (this.condition.matches(context, metadata)) { + return false; // prefer Tomcat pool + } + return super.matches(context, metadata); + } + } + + static abstract class NonEmbeddedDatabaseCondition implements Condition { + + protected Log logger = LogFactory.getLog(getClass()); + + protected abstract String getDataSourecClassName(); + + @Override + public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { + + String checking = ConditionLogUtils.getPrefix(this.logger, metadata); + + if (!ClassUtils.isPresent(getDataSourecClassName(), null)) { + if (this.logger.isDebugEnabled()) { + this.logger.debug(checking + "Tomcat DataSource pool not found"); + } + return false; + } + String driverClassName = context.getEnvironment().getProperty( + "spring.database.driverClassName"); + String url = context.getEnvironment().getProperty("spring.database.url"); + if (this.logger.isDebugEnabled()) { + this.logger.debug(checking + + "Spring JDBC detected (embedded database type is " + + EmbeddedDatabaseConfiguration.getEmbeddedDatabaseType() + ")."); + } + if (driverClassName == null) { + driverClassName = EmbeddedDatabaseConfiguration + .getEmbeddedDatabaseDriverClass(EmbeddedDatabaseConfiguration + .getEmbeddedDatabaseType()); + } + if (url == null) { + url = EmbeddedDatabaseConfiguration + .getEmbeddedDatabaseUrl(EmbeddedDatabaseConfiguration + .getEmbeddedDatabaseType()); + } + if (driverClassName != null && url != null + && ClassUtils.isPresent(driverClassName, null)) { + if (this.logger.isDebugEnabled()) { + this.logger.debug(checking + "Driver class " + driverClassName + + " found"); + } + return true; + } + if (this.logger.isDebugEnabled()) { + this.logger.debug(checking + "Driver class " + driverClassName + + " not found"); + } + return false; + } + + } + + static class EmbeddedDatabaseCondition implements Condition { + + protected Log logger = LogFactory.getLog(getClass()); + + private Condition tomcatCondition = new TomcatDatabaseCondition(); + + private Condition dbcpCondition = new BasicDatabaseCondition(); + + @Override + public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { + + String checking = ConditionLogUtils.getPrefix(this.logger, metadata); + + if (this.tomcatCondition.matches(context, metadata) + || this.dbcpCondition.matches(context, metadata)) { + if (this.logger.isDebugEnabled()) { + this.logger + .debug(checking + + "Existing non-embedded database detected: match result false"); + } + return false; + } + if (this.logger.isDebugEnabled()) { + this.logger.debug(checking + + "Spring JDBC detected (embedded database type is " + + EmbeddedDatabaseConfiguration.getEmbeddedDatabaseType() + ")."); + } + return EmbeddedDatabaseConfiguration.getEmbeddedDatabaseType() != null; + } + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java new file mode 100644 index 00000000000..3d45e73d028 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java @@ -0,0 +1,58 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.zero.context.annotation.ConditionalOnBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for + * {@link DataSourceTransactionManager}. + * + * @author Dave Syer + */ +@Configuration +@ConditionalOnClass({ JdbcTemplate.class, PlatformTransactionManager.class }) +public class DataSourceTransactionManagerAutoConfiguration implements Ordered { + + @Override + public int getOrder() { + return Integer.MAX_VALUE; + } + + @Autowired(required = false) + private DataSource dataSource; + + @Bean + @ConditionalOnMissingBean(name = "transactionManager") + @ConditionalOnBean(DataSource.class) + public PlatformTransactionManager transactionManager() { + return new DataSourceTransactionManager(this.dataSource); + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java new file mode 100644 index 00000000000..a1208565f4a --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java @@ -0,0 +1,99 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.annotation.PreDestroy; +import javax.sql.DataSource; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.util.ClassUtils; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for embedded databases. + * + * @author Phillip Webb + */ +@Configuration +public class EmbeddedDatabaseConfiguration { + + private static final Map EMBEDDED_DATABASE_DRIVER_CLASSES; + private static final Map EMBEDDED_DATABASE_URLS; + + private EmbeddedDatabase database; + + static { + + EMBEDDED_DATABASE_DRIVER_CLASSES = new LinkedHashMap(); + EMBEDDED_DATABASE_DRIVER_CLASSES.put(EmbeddedDatabaseType.H2, "org.h2.Driver"); + EMBEDDED_DATABASE_DRIVER_CLASSES.put(EmbeddedDatabaseType.DERBY, + "org.apache.derby.jdbc.EmbeddedDriver"); + EMBEDDED_DATABASE_DRIVER_CLASSES.put(EmbeddedDatabaseType.HSQL, + "org.hsqldb.jdbcDriver"); + + EMBEDDED_DATABASE_URLS = new LinkedHashMap(); + EMBEDDED_DATABASE_URLS.put(EmbeddedDatabaseType.H2, + "jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1"); + EMBEDDED_DATABASE_URLS.put(EmbeddedDatabaseType.DERBY, + "jdbc:derby:memory:testdb;create=true"); + EMBEDDED_DATABASE_URLS.put(EmbeddedDatabaseType.HSQL, "jdbc:hsqldb:mem:testdb"); + + } + + @Bean + public DataSource dataSource() { + EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() + .setType(getEmbeddedDatabaseType()); + this.database = builder.build(); + return this.database; + } + + @PreDestroy + public void close() { + if (this.database != null) { + this.database.shutdown(); + } + } + + public static String getEmbeddedDatabaseDriverClass( + EmbeddedDatabaseType embeddedDatabaseType) { + return EMBEDDED_DATABASE_DRIVER_CLASSES.get(embeddedDatabaseType); + } + + public static String getEmbeddedDatabaseUrl(EmbeddedDatabaseType embeddedDatabaseType) { + return EMBEDDED_DATABASE_URLS.get(embeddedDatabaseType); + } + + public static EmbeddedDatabaseType getEmbeddedDatabaseType() { + for (Map.Entry entry : EMBEDDED_DATABASE_DRIVER_CLASSES + .entrySet()) { + if (ClassUtils.isPresent(entry.getValue(), + EmbeddedDatabaseConfiguration.class.getClassLoader())) { + return entry.getKey(); + } + } + return null; + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/TomcatDataSourceConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/TomcatDataSourceConfiguration.java new file mode 100644 index 00000000000..dc58696595d --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/TomcatDataSourceConfiguration.java @@ -0,0 +1,53 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import javax.annotation.PreDestroy; +import javax.sql.DataSource; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Configuration for a Tomcat database pool. The Tomcat pool provides superior performance + * and tends not to deadlock in high volume environments. + * + * @author Dave Syer + */ +@Configuration +public class TomcatDataSourceConfiguration extends AbstractDataSourceConfiguration { + + private org.apache.tomcat.jdbc.pool.DataSource pool; + + @Bean + public DataSource dataSource() { + this.pool = new org.apache.tomcat.jdbc.pool.DataSource(); + this.pool.setDriverClassName(getDriverClassName()); + this.pool.setUrl(getUrl()); + this.pool.setUsername(getUsername()); + this.pool.setPassword(getPassword()); + return this.pool; + } + + @PreDestroy + public void close() { + if (this.pool != null) { + this.pool.close(); + } + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java new file mode 100644 index 00000000000..db15240e525 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java @@ -0,0 +1,98 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.orm.jpa; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.hibernate.ejb.HibernateEntityManager; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.orm.jpa.JpaVendorAdapter; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.Database; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.util.StringUtils; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for Hibernate JPA. + * + * @author Phillip Webb + */ +@Configuration +@ConditionalOnClass(HibernateEntityManager.class) +@EnableTransactionManagement +public class HibernateJpaAutoConfiguration extends JpaAutoConfiguration { + + public static enum DDLAUTO { + none, validate, update, create, create_drop; + @Override + public String toString() { + return this.name().toLowerCase().replace("_", "-"); + } + } + + private static final Map EMBEDDED_DATABASE_DIALECTS; + static { + EMBEDDED_DATABASE_DIALECTS = new LinkedHashMap(); + EMBEDDED_DATABASE_DIALECTS.put(EmbeddedDatabaseType.HSQL, + "org.hibernate.dialect.HSQLDialect"); + } + + @Value("${spring.jpa.databasePlatform:${spring.jpa.database_platform:}}") + private String databasePlatform; + + @Value("${spring.jpa.database:DEFAULT}") + private Database database = Database.DEFAULT; + + @Value("${spring.jpa.showSql:${spring.jpa.show_sql:false}}") + private boolean showSql; + + @Value("${spring.jpa.ddlAuto:${spring.jpa.ddl_auto:none}}") + private DDLAUTO ddlAuto; + + @Bean + @Override + public JpaVendorAdapter jpaVendorAdapter() { + HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); + adapter.setShowSql(this.showSql); + if (StringUtils.hasText(this.databasePlatform)) { + adapter.setDatabasePlatform(this.databasePlatform); + } + adapter.setDatabase(this.database); + return adapter; + } + + @Override + protected void configure( + LocalContainerEntityManagerFactoryBean entityManagerFactoryBean) { + Map properties = entityManagerFactoryBean.getJpaPropertyMap(); + // FIXME: detect EhCache + properties.put("hibernate.cache.provider_class", + "org.hibernate.cache.HashtableCacheProvider"); + if (this.ddlAuto != DDLAUTO.none) { + properties.put("hibernate.hbm2ddl.auto", this.ddlAuto.toString()); + } + + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/JpaAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/JpaAutoConfiguration.java new file mode 100644 index 00000000000..f94aac2fc09 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/JpaAutoConfiguration.java @@ -0,0 +1,114 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.orm.jpa; + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.sql.DataSource; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.JpaVendorAdapter; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.util.Assert; +import org.springframework.zero.autoconfigure.AutoConfigurationUtils; +import org.springframework.zero.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.zero.context.annotation.ConditionalOnBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * Base {@link EnableAutoConfiguration Auto-configuration} for JPA. + * + * @author Phillip Webb + */ +@ConditionalOnClass({ LocalContainerEntityManagerFactoryBean.class, + EnableTransactionManagement.class, EntityManager.class }) +@ConditionalOnBean(DataSource.class) +public abstract class JpaAutoConfiguration implements BeanFactoryAware { + + private ConfigurableListableBeanFactory beanFactory; + + @Bean + public PlatformTransactionManager transactionManager() { + return new JpaTransactionManager(entityManagerFactory().getObject()); + } + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); + entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter()); + entityManagerFactoryBean.setDataSource(getDataSource()); + entityManagerFactoryBean.setPackagesToScan(getPackagesToScan()); + configure(entityManagerFactoryBean); + return entityManagerFactoryBean; + } + + /** + * Determines if the {@code dataSource} being used by Spring was created from + * {@link EmbeddedDatabaseConfiguration}. + * @return true if the data source was auto-configured. + */ + protected boolean isAutoConfiguredDataSource() { + try { + BeanDefinition beanDefinition = this.beanFactory + .getBeanDefinition("dataSource"); + return EmbeddedDatabaseConfiguration.class.getName().equals( + beanDefinition.getFactoryBeanName()); + } catch (NoSuchBeanDefinitionException e) { + return false; + } + } + + @Bean + public abstract JpaVendorAdapter jpaVendorAdapter(); + + protected DataSource getDataSource() { + try { + return this.beanFactory.getBean("dataSource", DataSource.class); + } catch (RuntimeException e) { + return this.beanFactory.getBean(DataSource.class); + } + } + + protected String[] getPackagesToScan() { + List basePackages = AutoConfigurationUtils + .getBasePackages(this.beanFactory); + Assert.notEmpty(basePackages, + "Unable to find JPA packages to scan, please define " + + "a @ComponentScan annotation or disable JpaAutoConfiguration"); + return basePackages.toArray(new String[basePackages.size()]); + } + + protected void configure( + LocalContainerEntityManagerFactoryBean entityManagerFactoryBean) { + } + + @Override + public void setBeanFactory(BeanFactory beanFactory) throws BeansException { + this.beanFactory = (ConfigurableListableBeanFactory) beanFactory; + } +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java new file mode 100644 index 00000000000..7ced0ad9a0b --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java @@ -0,0 +1,162 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.thymeleaf; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Collection; +import java.util.Collections; + +import javax.servlet.Servlet; + +import nz.net.ultraq.web.thymeleaf.LayoutDialect; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.core.io.ResourceLoader; +import org.springframework.zero.autoconfigure.web.WebMvcAutoConfiguration; +import org.springframework.zero.context.annotation.AutoConfigureAfter; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.ConditionalOnMissingClass; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; +import org.thymeleaf.TemplateProcessingParameters; +import org.thymeleaf.resourceresolver.IResourceResolver; +import org.thymeleaf.spring3.SpringTemplateEngine; +import org.thymeleaf.spring3.view.ThymeleafViewResolver; +import org.thymeleaf.templateresolver.ITemplateResolver; +import org.thymeleaf.templateresolver.TemplateResolver; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for Thymeleaf templating. + * + * @author Dave Syer + */ +@Configuration +@ConditionalOnClass(SpringTemplateEngine.class) +@AutoConfigureAfter(WebMvcAutoConfiguration.class) +public class ThymeleafAutoConfiguration { + + @Configuration + @ConditionalOnMissingBean(name = "defaultTemplateResolver") + protected static class DefaultTemplateResolverConfiguration { + + @Autowired + private ResourceLoader resourceLoader = new DefaultResourceLoader(); + + @Value("${spring.template.prefix:classpath:/templates/}") + private String prefix = "classpath:/templates/"; + + @Value("${spring.template.suffix:.html}") + private String suffix = ".html"; + + @Value("${spring.template.cache:true}") + private boolean cacheable; + + @Value("${spring.template.mode:HTML5}") + private String templateMode = "HTML5"; + + @Bean + public ITemplateResolver defaultTemplateResolver() { + TemplateResolver resolver = new TemplateResolver(); + resolver.setResourceResolver(new IResourceResolver() { + @Override + public InputStream getResourceAsStream( + TemplateProcessingParameters templateProcessingParameters, + String resourceName) { + try { + return DefaultTemplateResolverConfiguration.this.resourceLoader + .getResource(resourceName).getInputStream(); + } catch (IOException e) { + return null; + } + } + + @Override + public String getName() { + return "SPRING"; + } + }); + resolver.setPrefix(this.prefix); + resolver.setSuffix(this.suffix); + resolver.setTemplateMode(this.templateMode); + resolver.setCacheable(this.cacheable); + return resolver; + } + + } + + @Configuration + @ConditionalOnMissingClass("nz.net.ultraq.web.thymeleaf.LayoutDialect") + @ConditionalOnMissingBean(SpringTemplateEngine.class) + protected static class ThymeleafDefaultConfiguration { + + @Autowired + private Collection templateResolvers = Collections.emptySet(); + + @Bean + public SpringTemplateEngine templateEngine() { + SpringTemplateEngine engine = new SpringTemplateEngine(); + for (ITemplateResolver templateResolver : this.templateResolvers) { + engine.addTemplateResolver(templateResolver); + } + return engine; + } + + } + + @Configuration + @ConditionalOnClass(name = "nz.net.ultraq.web.thymeleaf.LayoutDialect") + @ConditionalOnMissingBean(SpringTemplateEngine.class) + protected static class ThymeleafWebLayoutConfiguration { + + @Autowired + private Collection templateResolvers = Collections.emptySet(); + + @Bean + public SpringTemplateEngine templateEngine() { + SpringTemplateEngine engine = new SpringTemplateEngine(); + for (ITemplateResolver templateResolver : this.templateResolvers) { + engine.addTemplateResolver(templateResolver); + } + engine.addDialect(new LayoutDialect()); + return engine; + } + + } + + @Configuration + @ConditionalOnClass({ Servlet.class }) + protected static class ThymeleafViewResolverConfiguration { + + @Autowired + private SpringTemplateEngine templateEngine; + + @Bean + @ConditionalOnMissingBean(name = "thymeleafViewResolver") + public ThymeleafViewResolver thymeleafViewResolver() { + ThymeleafViewResolver resolver = new ThymeleafViewResolver(); + resolver.setTemplateEngine(this.templateEngine); + return resolver; + } + + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java new file mode 100644 index 00000000000..06de4d1a134 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java @@ -0,0 +1,103 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.web; + +import javax.servlet.Servlet; + +import org.apache.catalina.startup.Tomcat; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.util.Loader; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; +import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer; +import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor; +import org.springframework.zero.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.ServletContextInitializer; +import org.springframework.zero.context.embedded.jetty.JettyEmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for an embedded servlet containers. + * + * @author Phillip Webb + * @author Dave Syer + */ +@Order(Ordered.HIGHEST_PRECEDENCE) +public class EmbeddedServletContainerAutoConfiguration { + + /** + * Support {@link EmbeddedServletContainerCustomizerBeanPostProcessor} to apply + * {@link EmbeddedServletContainerCustomizer}s. + */ + @Bean + @ConditionalOnMissingBean(value = EmbeddedServletContainerCustomizerBeanPostProcessor.class, considerHierarchy = false) + public EmbeddedServletContainerCustomizerBeanPostProcessor embeddedServletContainerCustomizerBeanPostProcessor() { + return new EmbeddedServletContainerCustomizerBeanPostProcessor(); + } + + /** + * Add the {@link DispatcherServlet} unless the user has defined their own + * {@link ServletContextInitializer}s. + */ + @ConditionalOnClass(DispatcherServlet.class) + public static class DispatcherServletConfiguration { + + @Bean + @ConditionalOnMissingBean(value = { ServletContextInitializer.class, + Servlet.class }, considerHierarchy = false) + public DispatcherServlet dispatcherServlet() { + return new DispatcherServlet(); + } + } + + /** + * Nested configuration for if Tomcat is being used. + */ + @Configuration + @ConditionalOnClass({ Servlet.class, Tomcat.class }) + @ConditionalOnMissingBean(value = EmbeddedServletContainerFactory.class, considerHierarchy = false) + public static class EmbeddedTomcat { + + @Bean + public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() { + return new TomcatEmbeddedServletContainerFactory(); + } + + } + + /** + * Nested configuration if Jetty is being used. + */ + @Configuration + @ConditionalOnClass({ Servlet.class, Server.class, Loader.class }) + @ConditionalOnMissingBean(value = EmbeddedServletContainerFactory.class, considerHierarchy = false) + public static class EmbeddedJetty { + + @Bean + public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() { + return new JettyEmbeddedServletContainerFactory(); + } + + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/MultipartAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/MultipartAutoConfiguration.java new file mode 100644 index 00000000000..416ded34328 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/MultipartAutoConfiguration.java @@ -0,0 +1,48 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.web; + +import javax.servlet.MultipartConfigElement; +import javax.servlet.Servlet; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; +import org.springframework.zero.context.annotation.ConditionalOnBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; +import org.springframework.zero.context.embedded.EmbeddedWebApplicationContext; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for multi-part uploads. Adds a + * {@link StandardServletMultipartResolver} when a {@link MultipartConfigElement} bean is + * defined. The {@link EmbeddedWebApplicationContext} will associated the + * {@link MultipartConfigElement} bean to any {@link Servlet} beans. + * + * @author Greg Turnquist + */ +@Configuration +@ConditionalOnClass({ Servlet.class, StandardServletMultipartResolver.class }) +@ConditionalOnBean(MultipartConfigElement.class) +public class MultipartAutoConfiguration { + + @Bean + public StandardServletMultipartResolver multipartResolver() { + return new StandardServletMultipartResolver(); + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/ServerPropertiesAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/ServerPropertiesAutoConfiguration.java new file mode 100644 index 00000000000..d3a2a344ac0 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/ServerPropertiesAutoConfiguration.java @@ -0,0 +1,106 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.web; + +import org.apache.catalina.valves.AccessLogValve; +import org.apache.catalina.valves.RemoteIpValve; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.util.StringUtils; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; +import org.springframework.zero.context.annotation.EnableConfigurationProperties; +import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer; +import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; +import org.springframework.zero.properties.ServerProperties; +import org.springframework.zero.properties.ServerProperties.Tomcat; + +/** + * {@link EnableAutoConfiguration Auto-configuration} that configures the + * {@link ConfigurableEmbeddedServletContainerFactory} from a {@link ServerProperties} + * bean. + * + * @author Dave Syer + */ +@Configuration +@EnableConfigurationProperties +public class ServerPropertiesAutoConfiguration implements + EmbeddedServletContainerCustomizer, ApplicationContextAware { + + private ApplicationContext applicationContext; + + @Bean(name = "org.springframework.zero.properties.ServerProperties") + @ConditionalOnMissingBean + public ServerProperties serverProperties() { + return new ServerProperties(); + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + this.applicationContext = applicationContext; + } + + @Override + public void customize(ConfigurableEmbeddedServletContainerFactory factory) { + + // Need to do a look up here to make it lazy + ServerProperties server = this.applicationContext.getBean(ServerProperties.class); + + factory.setPort(server.getPort()); + factory.setAddress(server.getAddress()); + factory.setContextPath(server.getContextPath()); + + if (factory instanceof TomcatEmbeddedServletContainerFactory) { + configureTomcat((TomcatEmbeddedServletContainerFactory) factory, server); + } + + } + + private void configureTomcat(TomcatEmbeddedServletContainerFactory tomcatFactory, + ServerProperties configuration) { + + Tomcat tomcat = configuration.getTomcat(); + if (tomcat.getBasedir() != null) { + tomcatFactory.setBaseDirectory(tomcat.getBasedir()); + } + + String remoteIpHeader = tomcat.getRemoteIpHeader(); + String protocolHeader = tomcat.getProtocolHeader(); + + if (StringUtils.hasText(remoteIpHeader) || StringUtils.hasText(protocolHeader)) { + RemoteIpValve valve = new RemoteIpValve(); + valve.setRemoteIpHeader(remoteIpHeader); + valve.setProtocolHeader(protocolHeader); + tomcatFactory.addContextValves(valve); + } + + String pattern = tomcat.getAccessLogPattern(); + if (pattern != null) { + AccessLogValve valve = new AccessLogValve(); + valve.setPattern(pattern); + valve.setSuffix(".log"); + tomcatFactory.addContextValves(valve); + } + + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfiguration.java new file mode 100644 index 00000000000..0b9cdec01a2 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfiguration.java @@ -0,0 +1,157 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.web; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + +import javax.servlet.Servlet; + +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.ListableBeanFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.convert.converter.GenericConverter; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.format.Formatter; +import org.springframework.format.FormatterRegistry; +import org.springframework.web.accept.ContentNegotiationManager; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.web.servlet.HandlerAdapter; +import org.springframework.web.servlet.HandlerMapping; +import org.springframework.web.servlet.View; +import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; +import org.springframework.web.servlet.resource.ResourceHttpRequestHandler; +import org.springframework.web.servlet.view.BeanNameViewResolver; +import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; +import org.springframework.zero.context.annotation.AutoConfigureAfter; +import org.springframework.zero.context.annotation.ConditionalOnBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} for {@link EnableWebMvc Web MVC}. + * + * @author Phillip Webb + * @author Dave Syer + */ +@Configuration +@ConditionalOnClass({ Servlet.class, DispatcherServlet.class, + WebMvcConfigurerAdapter.class }) +@ConditionalOnMissingBean({ HandlerAdapter.class, HandlerMapping.class }) +@Order(Ordered.HIGHEST_PRECEDENCE + 10) +@AutoConfigureAfter(EmbeddedServletContainerAutoConfiguration.class) +public class WebMvcAutoConfiguration { + + // Defined as a nested config to ensure WebMvcConfigurerAdapter it not read when not + // on the classpath + @EnableWebMvc + public static class WebMvcAutoConfigurationAdapter extends WebMvcConfigurerAdapter { + + @Autowired + private ListableBeanFactory beanFactory; + + @ConditionalOnBean(View.class) + @Bean + public BeanNameViewResolver beanNameViewResolver() { + BeanNameViewResolver resolver = new BeanNameViewResolver(); + resolver.setOrder(0); + return resolver; + } + + @ConditionalOnBean(View.class) + @Bean + public ContentNegotiatingViewResolver viewResolver(BeanFactory beanFactory) { + ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver(); + resolver.setContentNegotiationManager(beanFactory + .getBean(ContentNegotiationManager.class)); + return resolver; + } + + @Override + public void configureDefaultServletHandling( + DefaultServletHandlerConfigurer configurer) { + configurer.enable(); + } + + @Override + public void addFormatters(FormatterRegistry registry) { + for (Converter converter : getBeansOfType(Converter.class)) { + registry.addConverter(converter); + } + + for (GenericConverter converter : getBeansOfType(GenericConverter.class)) { + registry.addConverter(converter); + } + + for (Formatter formatter : getBeansOfType(Formatter.class)) { + registry.addFormatter(formatter); + } + } + + private Collection getBeansOfType(Class type) { + return this.beanFactory.getBeansOfType(type).values(); + } + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + // FIXME exposing the root classpath is a security risk + // eg http://localhost:8080/org/springframework/zero/Banner.class + registry.addResourceHandler("/resources/**").addResourceLocations("/") + .addResourceLocations("classpath:/META-INF/resources/") + .addResourceLocations("classpath:/resources/") + .addResourceLocations("classpath:/"); + registry.addResourceHandler("/**").addResourceLocations("/") + .addResourceLocations("classpath:/META-INF/resources/") + .addResourceLocations("classpath:/static/") + .addResourceLocations("classpath:/"); + } + + @Configuration + public static class FaviconConfiguration { + + @Bean + public SimpleUrlHandlerMapping faviconHandlerMapping() { + SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping(); + mapping.setOrder(Integer.MIN_VALUE + 1); + mapping.setUrlMap(Collections.singletonMap("**/favicon.ico", + faviconRequestHandler())); + return mapping; + } + + @Bean + protected ResourceHttpRequestHandler faviconRequestHandler() { + ResourceHttpRequestHandler requestHandler = new ResourceHttpRequestHandler(); + requestHandler.setLocations(Arrays + . asList(new ClassPathResource("/"))); + return requestHandler; + } + } + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigurationSorter.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigurationSorter.java new file mode 100644 index 00000000000..d119823f60b --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigurationSorter.java @@ -0,0 +1,172 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.context.annotation; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.springframework.core.OrderComparator; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.core.io.ResourceLoader; +import org.springframework.core.type.AnnotationMetadata; +import org.springframework.core.type.classreading.CachingMetadataReaderFactory; +import org.springframework.core.type.classreading.MetadataReader; +import org.springframework.util.Assert; + +/** + * Sort {@link EnableAutoConfiguration auto-configuration} classes into priority order by + * reading {@link Ordered} and {@link AutoConfigureAfter} annotations (without loading + * classes). + * + * @author Phillip Webb + */ +class AutoConfigurationSorter { + + private CachingMetadataReaderFactory metadataReaderFactory; + + public AutoConfigurationSorter(ResourceLoader resourceLoader) { + Assert.notNull(resourceLoader, "ResourceLoader must not be null"); + this.metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader); + } + + public List getInPriorityOrder(Collection classNames) + throws IOException { + List autoConfigurationClasses = new ArrayList(); + for (String className : classNames) { + autoConfigurationClasses.add(new AutoConfigurationClass(className)); + } + + // Sort initially by order + Collections.sort(autoConfigurationClasses, OrderComparator.INSTANCE); + + // Then respect @AutoConfigureAfter + autoConfigurationClasses = sortByAfterAnnotation(autoConfigurationClasses); + + List orderedClassNames = new ArrayList(); + for (AutoConfigurationClass autoConfigurationClass : autoConfigurationClasses) { + orderedClassNames.add(autoConfigurationClass.toString()); + } + return orderedClassNames; + } + + private List sortByAfterAnnotation( + Collection autoConfigurationClasses) + throws IOException { + List tosort = new ArrayList( + autoConfigurationClasses); + Set sorted = new LinkedHashSet(); + Set processing = new LinkedHashSet(); + while (!tosort.isEmpty()) { + doSortByAfterAnnotation(tosort, sorted, processing, null); + } + return new ArrayList(sorted); + } + + private void doSortByAfterAnnotation(List tosort, + Set sorted, Set processing, + AutoConfigurationClass current) throws IOException { + + if (current == null) { + current = tosort.remove(0); + } + + processing.add(current); + + for (AutoConfigurationClass after : current.getAfter()) { + Assert.state(!processing.contains(after), + "Cycle @AutoConfigureAfter detected between " + current + " and " + + after); + if (!sorted.contains(after) && tosort.contains(after)) { + doSortByAfterAnnotation(tosort, sorted, processing, after); + } + } + + processing.remove(current); + sorted.add(current); + } + + private class AutoConfigurationClass implements Ordered { + + private final String className; + + private final int order; + + private List after; + + private Map afterAnnotation; + + public AutoConfigurationClass(String className) throws IOException { + + this.className = className; + + MetadataReader metadataReader = AutoConfigurationSorter.this.metadataReaderFactory + .getMetadataReader(className); + AnnotationMetadata metadata = metadataReader.getAnnotationMetadata(); + + // Read @Order annotation + Map orderedAnnotation = metadata + .getAnnotationAttributes(Order.class.getName()); + this.order = (orderedAnnotation == null ? Ordered.LOWEST_PRECEDENCE + : (Integer) orderedAnnotation.get("value")); + + // Read @AutoConfigureAfter annotation + this.afterAnnotation = metadata.getAnnotationAttributes( + AutoConfigureAfter.class.getName(), true); + } + + @Override + public int getOrder() { + return this.order; + } + + public List getAfter() throws IOException { + if (this.after == null) { + if (this.afterAnnotation == null) { + this.after = Collections.emptyList(); + } else { + this.after = new ArrayList(); + for (String afterClass : (String[]) this.afterAnnotation.get("value")) { + this.after.add(new AutoConfigurationClass(afterClass)); + } + } + } + return this.after; + } + + @Override + public String toString() { + return this.className; + } + + @Override + public int hashCode() { + return this.className.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return this.className.equals(((AutoConfigurationClass) obj).className); + } + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigureAfter.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigureAfter.java new file mode 100644 index 00000000000..74d636f8d91 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigureAfter.java @@ -0,0 +1,33 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.context.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Hint for that an {@link EnableAutoConfiguration auto-configuration} should be applied + * after the specified auto-configuration classes. + * + * @author Phillip Webb + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ ElementType.TYPE }) +public @interface AutoConfigureAfter { + Class[] value(); +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/ComponentScanDetector.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/ComponentScanDetector.java new file mode 100644 index 00000000000..f8f4509953e --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/ComponentScanDetector.java @@ -0,0 +1,154 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.context.annotation; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.support.AbstractBeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.cglib.proxy.Enhancer; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; +import org.springframework.core.annotation.AnnotationAttributes; +import org.springframework.core.type.AnnotationMetadata; +import org.springframework.core.type.StandardAnnotationMetadata; +import org.springframework.core.type.classreading.MetadataReader; +import org.springframework.core.type.classreading.MetadataReaderFactory; +import org.springframework.core.type.classreading.SimpleMetadataReaderFactory; +import org.springframework.util.ClassUtils; +import org.springframework.util.StringUtils; +import org.springframework.zero.autoconfigure.AutoConfigurationUtils; + +/** + * Helper to detect a component scan declared in the enclosing context (normally on a + * {@code @Configuration} class). Once the component scan is detected, the base packages + * are stored for retrieval later. + * + * @author Dave Syer + * @author Phillip Webb + * @see AutoConfigurationUtils + */ +class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactoryAware { + + private final Log logger = LogFactory.getLog(getClass()); + + private BeanFactory beanFactory; + + private MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); + + @Override + public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, + final BeanDefinitionRegistry registry) { + storeComponentScanBasePackages(); + } + + private void storeComponentScanBasePackages() { + if (this.beanFactory instanceof ConfigurableListableBeanFactory) { + storeComponentScanBasePackages((ConfigurableListableBeanFactory) this.beanFactory); + } else { + if (this.logger.isWarnEnabled()) { + this.logger + .warn("Unable to read @ComponentScan annotations for auto-configure"); + } + } + } + + private void storeComponentScanBasePackages( + ConfigurableListableBeanFactory beanFactory) { + List basePackages = new ArrayList(); + for (String beanName : beanFactory.getBeanDefinitionNames()) { + BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName); + String[] basePackagesAttribute = (String[]) beanDefinition + .getAttribute("componentScanBasePackages"); + if (basePackagesAttribute != null) { + basePackages.addAll(Arrays.asList(basePackagesAttribute)); + } + AnnotationMetadata metadata = getMetadata(beanDefinition); + basePackages.addAll(getBasePackages(metadata)); + } + AutoConfigurationUtils.storeBasePackages(beanFactory, basePackages); + } + + private AnnotationMetadata getMetadata(BeanDefinition beanDefinition) { + if (beanDefinition instanceof AbstractBeanDefinition + && ((AbstractBeanDefinition) beanDefinition).hasBeanClass()) { + Class beanClass = ((AbstractBeanDefinition) beanDefinition).getBeanClass(); + if (Enhancer.isEnhanced(beanClass)) { + beanClass = beanClass.getSuperclass(); + } + return new StandardAnnotationMetadata(beanClass, true); + } + String className = beanDefinition.getBeanClassName(); + if (className != null) { + try { + MetadataReader metadataReader = this.metadataReaderFactory + .getMetadataReader(className); + return metadataReader.getAnnotationMetadata(); + } catch (IOException ex) { + if (this.logger.isDebugEnabled()) { + this.logger.debug( + "Could not find class file for introspecting @ComponentScan classes: " + + className, ex); + } + } + } + return null; + } + + private List getBasePackages(AnnotationMetadata metadata) { + AnnotationAttributes attributes = AnnotationAttributes + .fromMap((metadata == null ? null : metadata.getAnnotationAttributes( + ComponentScan.class.getName(), true))); + if (attributes != null) { + List basePackages = new ArrayList(); + addAllHavingText(basePackages, attributes.getStringArray("value")); + addAllHavingText(basePackages, attributes.getStringArray("basePackages")); + for (String packageClass : attributes.getStringArray("basePackageClasses")) { + basePackages.add(ClassUtils.getPackageName(packageClass)); + } + if (basePackages.isEmpty()) { + basePackages.add(ClassUtils.getPackageName(metadata.getClassName())); + } + return basePackages; + } + return Collections.emptyList(); + } + + private void addAllHavingText(List list, String[] strings) { + for (String s : strings) { + if (StringUtils.hasText(s)) { + list.add(s); + } + } + } + + @Override + public void setBeanFactory(BeanFactory beanFactory) throws BeansException { + this.beanFactory = beanFactory; + } +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfiguration.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfiguration.java new file mode 100644 index 00000000000..d747f1f85e9 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.context.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.core.io.support.SpringFactoriesLoader; +import org.springframework.zero.context.annotation.ConditionalOnBean; +import org.springframework.zero.context.annotation.ConditionalOnClass; +import org.springframework.zero.context.annotation.ConditionalOnMissingBean; +import org.springframework.zero.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; + +/** + * Enable auto-configuration of the Spring Application Context, attempting to guess and + * configure beans that you are likely to need. + * + * Auto-configuration classes are usually applied based on your classpath and what beans + * you have defined. For example, If you have {@code tomat-embedded.jar} on your classpath + * you are likely to want a {@link TomcatEmbeddedServletContainerFactory} (unless you have + * defined your own {@link EmbeddedServletContainerFactory} bean). + * + *

+ * Auto-configuration tries to be as intelligent as possible and will back-away as you + * define more of your own configuration. You can always manually {@link #exclude()} any + * configuration that you never want to apply. Auto-configuration is always applied after + * user-defined beans have been registered. + * + *

+ * Auto-configuration classes are regular Spring {@link Configuration} beans. They are + * located using the {@link SpringFactoriesLoader} mechanism (keyed against this class). + * Generally auto-configuration beans are {@link Conditional @Conditional} beans (most + * often using {@link ConditionalOnClass @ConditionalOnClass} and + * {@link ConditionalOnMissingBean @ConditionalOnMissingBean} annotations). + * + * @author Phillip Webb + * @see ConditionalOnBean + * @see ConditionalOnMissingBean + * @see ConditionalOnClass + * @see AutoConfigureAfter + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Import(EnableAutoConfigurationImportSelector.class) +public @interface EnableAutoConfiguration { + + /** + * Exclude specific auto-configuration classes such that they will never be applied. + */ + Class[] exclude() default {}; + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfigurationImportSelector.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfigurationImportSelector.java new file mode 100644 index 00000000000..45ad64e0dbb --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfigurationImportSelector.java @@ -0,0 +1,87 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.context.annotation; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.springframework.beans.factory.BeanClassLoaderAware; +import org.springframework.context.ResourceLoaderAware; +import org.springframework.context.annotation.DeferredImportSelector; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.AnnotationAttributes; +import org.springframework.core.annotation.Order; +import org.springframework.core.io.ResourceLoader; +import org.springframework.core.io.support.SpringFactoriesLoader; +import org.springframework.core.type.AnnotationMetadata; + +/** + * {@link DeferredImportSelector} to handle {@link EnableAutoConfiguration + * auto-configuration}. + * + * @author Phillip Webb + * @see EnableAutoConfiguration + */ +@Order(Ordered.LOWEST_PRECEDENCE) +class EnableAutoConfigurationImportSelector implements DeferredImportSelector, + BeanClassLoaderAware, ResourceLoaderAware { + + private ClassLoader beanClassLoader; + + private ResourceLoader resourceLoader; + + @Override + public String[] selectImports(AnnotationMetadata metadata) { + try { + AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata + .getAnnotationAttributes(EnableAutoConfiguration.class.getName(), + true)); + + // Find all possible auto configuration classes + List factories = new ArrayList( + SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, + this.beanClassLoader)); + + // Remove those specifically disabled + factories.removeAll(Arrays.asList(attributes.getStringArray("exclude"))); + + // Sort + factories = new AutoConfigurationSorter(this.resourceLoader) + .getInPriorityOrder(factories); + + // Always add the ComponentScanDetector as the first in the list + factories.add(0, ComponentScanDetector.class.getName()); + + return factories.toArray(new String[factories.size()]); + } catch (IOException ex) { + throw new IllegalStateException(ex); + } + } + + @Override + public void setBeanClassLoader(ClassLoader classLoader) { + this.beanClassLoader = classLoader; + } + + @Override + public void setResourceLoader(ResourceLoader resourceLoader) { + this.resourceLoader = resourceLoader; + } + +} diff --git a/spring-zero-autoconfigure/src/main/java/org/springframework/zero/main/Spring.java b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/main/Spring.java new file mode 100644 index 00000000000..37b73744637 --- /dev/null +++ b/spring-zero-autoconfigure/src/main/java/org/springframework/zero/main/Spring.java @@ -0,0 +1,95 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.main; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.logging.LogFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.SpringVersion; +import org.springframework.util.ClassUtils; +import org.springframework.zero.SpringApplication; +import org.springframework.zero.context.annotation.EnableAutoConfiguration; + +/** + * Very simple main class that can be used to launch an application from sources (class, + * package or XML). Useful for demos and testing, perhaps less for production use (where + * the {@link SpringApplication} run methods are often more convenient). + * + * @author Dave Syer + */ +@Configuration +@EnableAutoConfiguration +@ComponentScan +public class Spring { + + // FIXME can we delete this? is it used? does it belong here + + private static ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( + true); + + private static ApplicationContext context; + + /** + * @return the context if there is one + */ + public static ApplicationContext getApplicationContext() { + return context; + } + + /** + * A basic main that can be used to launch an application. + * + * @param args command line arguments + * @see SpringApplication#run(Object[], String[]) + * @see SpringApplication#run(Object, String...) + */ + public static void main(String[] args) throws Exception { + + List strings = new ArrayList(); + List sources = new ArrayList(); + + for (String arg : args) { + if (ClassUtils.isPresent(arg, null)) { + sources.add(ClassUtils.forName(arg, null)); + } else if (arg.endsWith(".xml")) { + sources.add(arg); + } else if (!scanner.findCandidateComponents(arg).isEmpty()) { + sources.add(arg); + } else { + strings.add(arg); + } + } + + if (sources.isEmpty()) { + sources.add(Spring.class); + } + + context = SpringApplication.run(sources.toArray(new Object[sources.size()]), + strings.toArray(new String[strings.size()])); + + LogFactory.getLog(Spring.class).info( + "Running Spring " + SpringVersion.getVersion() + " with sources: " + + sources); + + } + +} diff --git a/spring-zero-autoconfigure/src/main/resources/META-INF/spring.factories b/spring-zero-autoconfigure/src/main/resources/META-INF/spring.factories index 117934f2920..aed5273ce0d 100644 --- a/spring-zero-autoconfigure/src/main/resources/META-INF/spring.factories +++ b/spring-zero-autoconfigure/src/main/resources/META-INF/spring.factories @@ -1,14 +1,14 @@ # Auto Configure -org.springframework.bootstrap.context.annotation.EnableAutoConfiguration=\ -org.springframework.bootstrap.autoconfigure.MessageSourceAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.batch.BatchAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.data.JpaRepositoriesAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.jdbc.DataSourceAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.web.EmbeddedServletContainerAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.web.ServerPropertiesAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.web.MultipartAutoConfiguration,\ -org.springframework.bootstrap.autoconfigure.web.WebMvcAutoConfiguration +org.springframework.zero.context.annotation.EnableAutoConfiguration=\ +org.springframework.zero.autoconfigure.MessageSourceAutoConfiguration,\ +org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration,\ +org.springframework.zero.autoconfigure.batch.BatchAutoConfiguration,\ +org.springframework.zero.autoconfigure.data.JpaRepositoriesAutoConfiguration,\ +org.springframework.zero.autoconfigure.jdbc.DataSourceAutoConfiguration,\ +org.springframework.zero.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\ +org.springframework.zero.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\ +org.springframework.zero.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\ +org.springframework.zero.autoconfigure.web.EmbeddedServletContainerAutoConfiguration,\ +org.springframework.zero.autoconfigure.web.ServerPropertiesAutoConfiguration,\ +org.springframework.zero.autoconfigure.web.MultipartAutoConfiguration,\ +org.springframework.zero.autoconfigure.web.WebMvcAutoConfiguration diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/AdhocTestSuite.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/AdhocTestSuite.java deleted file mode 100644 index fbba0d82340..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/AdhocTestSuite.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure; - -import org.junit.Ignore; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; -import org.springframework.bootstrap.context.embedded.jetty.JettyEmbeddedServletContainerFactoryTests; -import org.springframework.bootstrap.main.SimpleMainTests; - -/** - * A test suite for probing weird ordering problems in the tests. - * - * @author Dave Syer - */ -@RunWith(Suite.class) -@SuiteClasses({ SimpleMainTests.class, JettyEmbeddedServletContainerFactoryTests.class }) -@Ignore -public class AdhocTestSuite { - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java deleted file mode 100644 index 85a9dab8f0b..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure; - -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -import org.junit.Test; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.core.env.MapPropertySource; - -import static org.junit.Assert.assertEquals; - -/** - * @author Dave Syer - */ -public class MessageSourceAutoConfigurationTests { - - private AnnotationConfigApplicationContext context; - - @Test - public void testDefaultMessageSource() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(MessageSourceAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertEquals("Foo message", - this.context.getMessage("foo", null, "Foo message", Locale.UK)); - } - - @Test - public void testMessageSourceCreated() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(MessageSourceAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - Map map = new HashMap(); - map.put("spring.messages.basename", "test/messages"); - this.context.getEnvironment().getPropertySources() - .addFirst(new MapPropertySource("test", map)); - this.context.refresh(); - assertEquals("bar", - this.context.getMessage("foo", null, "Foo message", Locale.UK)); - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/SpringJUnitTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/SpringJUnitTests.java deleted file mode 100644 index 7b2b79b4feb..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/SpringJUnitTests.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.autoconfigure; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.SpringJUnitTests.TestConfiguration; -import org.springframework.bootstrap.context.initializer.ConfigFileApplicationContextInitializer; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -/** - * @author Dave Syer - * - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = TestConfiguration.class, initializers = ConfigFileApplicationContextInitializer.class) -public class SpringJUnitTests { - - @Autowired - private ApplicationContext context; - - @Value("${foo:spam}") - private String foo = "bar"; - - @Test - public void testContextCreated() { - assertNotNull(this.context); - } - - @Test - public void testContextInitialized() { - assertEquals("bucket", this.foo); - } - - @Configuration - @Import({ PropertyPlaceholderAutoConfiguration.class }) - public static class TestConfiguration { - - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java deleted file mode 100644 index a7e8b460c85..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.batch; - -import java.util.Collection; -import java.util.Collections; - -import org.junit.Test; -import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.Job; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.JobExecutionException; -import org.springframework.batch.core.JobParameters; -import org.springframework.batch.core.Step; -import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; -import org.springframework.batch.core.job.AbstractJob; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.repository.JobRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; - -import static org.junit.Assert.assertNotNull; - -/** - * @author Dave Syer - */ -public class BatchAutoConfigurationTests { - - private AnnotationConfigApplicationContext context; - - @Test - public void testDefaultContext() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(TestConfiguration.class, BatchAutoConfiguration.class, - EmbeddedDatabaseConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(JobLauncher.class)); - } - - @Test - public void testDefinesAndLaunchesJob() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(JobConfiguration.class, BatchAutoConfiguration.class, - EmbeddedDatabaseConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - 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())); - } - - @EnableBatchProcessing - protected static class TestConfiguration { - } - - @EnableBatchProcessing - protected static class JobConfiguration { - @Autowired - private JobRepository jobRepository; - - @Bean - public Job job() { - AbstractJob job = new AbstractJob() { - - @Override - public Collection getStepNames() { - return Collections.emptySet(); - } - - @Override - public Step getStep(String stepName) { - return null; - } - - @Override - protected void doExecute(JobExecution execution) - throws JobExecutionException { - execution.setStatus(BatchStatus.COMPLETED); - } - }; - job.setJobRepository(this.jobRepository); - return job; - } - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java deleted file mode 100644 index c256deaba4d..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.batch; - -import org.junit.Test; -import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.JobExecution; - -import static org.junit.Assert.assertEquals; - -/** - * @author Dave Syer - */ -public class JobExecutionExitCodeGeneratorTests { - - private JobExecutionExitCodeGenerator generator = new JobExecutionExitCodeGenerator(); - - @Test - public void testExitCodeForRunning() { - this.generator.onApplicationEvent(new JobExecutionEvent(new JobExecution(0L))); - assertEquals(1, this.generator.getExitCode()); - } - - @Test - public void testExitCodeForCompleted() { - JobExecution execution = new JobExecution(0L); - execution.setStatus(BatchStatus.COMPLETED); - this.generator.onApplicationEvent(new JobExecutionEvent(execution)); - assertEquals(0, this.generator.getExitCode()); - } - - @Test - public void testExitCodeForFailed() { - JobExecution execution = new JobExecution(0L); - execution.setStatus(BatchStatus.FAILED); - this.generator.onApplicationEvent(new JobExecutionEvent(execution)); - assertEquals(5, this.generator.getExitCode()); - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java deleted file mode 100644 index ba13c109489..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.data; - -import javax.persistence.EntityManagerFactory; - -import org.junit.Test; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.data.test.City; -import org.springframework.bootstrap.autoconfigure.data.test.CityRepository; -import org.springframework.bootstrap.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; -import org.springframework.bootstrap.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; -import org.springframework.bootstrap.context.annotation.ComponentScanDetectorConfiguration; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.PlatformTransactionManager; - -import static org.junit.Assert.assertNotNull; - -/** - * @author Dave Syer - */ -public class JpaRepositoriesAutoConfigurationTests { - - private AnnotationConfigApplicationContext context; - - @Test - public void testDefaultRepositoryConfiguration() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(TestConfiguration.class, - ComponentScanDetectorConfiguration.class, - EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, - JpaRepositoriesAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(CityRepository.class)); - assertNotNull(this.context.getBean(PlatformTransactionManager.class)); - assertNotNull(this.context.getBean(EntityManagerFactory.class)); - } - - @Configuration - @ComponentScan(basePackageClasses = City.class) - protected static class TestConfiguration { - - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java deleted file mode 100644 index 7dbd8ac2439..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.data; - -import org.junit.Ignore; -import org.junit.Test; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.data.test.City; -import org.springframework.bootstrap.autoconfigure.data.test.CityRepository; -import org.springframework.bootstrap.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; -import org.springframework.bootstrap.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.repository.support.DomainClassConverter; -import org.springframework.mock.web.MockServletContext; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; - -import static org.junit.Assert.assertNotNull; - -/** - * @author Dave Syer - */ -@Ignore -// until spring data commons 1.6.0, jpa 1.5.0 available -public class JpaWebAutoConfigurationTests { - - private AnnotationConfigWebApplicationContext context; - - @Test - public void testDefaultRepositoryConfiguration() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.setServletContext(new MockServletContext()); - this.context.register(TestConfiguration.class, - EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, - JpaRepositoriesAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(CityRepository.class)); - assertNotNull(this.context.getBean(DomainClassConverter.class)); - } - - @Configuration - // @EnableSpringDataWebSupport - @ComponentScan(basePackageClasses = City.class) - protected static class TestConfiguration { - - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java deleted file mode 100644 index c686cf6d194..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.data.test; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -@Entity -public class City implements Serializable { - - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue - private Long id; - - @Column(nullable = false) - private String name; - - @Column(nullable = false) - private String state; - - @Column(nullable = false) - private String country; - - @Column(nullable = false) - private String map; - - protected City() { - } - - public City(String name, String country) { - super(); - this.name = name; - this.country = country; - } - - public String getName() { - return this.name; - } - - public String getState() { - return this.state; - } - - public String getCountry() { - return this.country; - } - - public String getMap() { - return this.map; - } - - @Override - public String toString() { - return getName() + "," + getState() + "," + getCountry(); - } -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java deleted file mode 100644 index 1e9e6145023..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.data.test; - -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.repository.Repository; - -public interface CityRepository extends Repository { - - Page findAll(Pageable pageable); - - Page findByNameLikeAndCountryLikeAllIgnoringCase(String name, String country, - Pageable pageable); - - City findByNameAndCountryAllIgnoringCase(String name, String country); - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java deleted file mode 100644 index 3c89dcd474b..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import javax.sql.DataSource; - -import org.junit.Test; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import static org.junit.Assert.assertNotNull; - -/** - * @author Dave Syer - */ -public class BasicDataSourceConfigurationTests { - - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - - @Test - public void testDataSourceExists() throws Exception { - this.context.register(BasicDataSourceConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(DataSource.class)); - this.context.close(); - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java deleted file mode 100644 index aa8cde1b99b..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import java.util.HashMap; -import java.util.Map; - -import javax.sql.DataSource; - -import org.apache.commons.dbcp.BasicDataSource; -import org.junit.Test; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.MapPropertySource; -import org.springframework.jdbc.core.JdbcOperations; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; -import org.springframework.util.ClassUtils; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -/** - * @author Dave Syer - */ -public class DataSourceAutoConfigurationTests { - - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - - @Test - public void testDefaultDataSourceExists() throws Exception { - this.context.register(DataSourceAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(DataSource.class)); - } - - @Test - public void testDefaultDataSourceCanBeOverridden() throws Exception { - this.context.register(TestDataSourceConfiguration.class, - DataSourceAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - DataSource dataSource = this.context.getBean(DataSource.class); - assertTrue("DataSource is wrong type: " + dataSource, - dataSource instanceof BasicDataSource); - } - - @Test - public void testJdbcTemplateExists() throws Exception { - this.context.register(DataSourceAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - JdbcTemplate jdbcTemplate = this.context.getBean(JdbcTemplate.class); - assertNotNull(jdbcTemplate); - assertNotNull(jdbcTemplate.getDataSource()); - } - - @Test - public void testNamedParameterJdbcTemplateExists() throws Exception { - this.context.register(DataSourceAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(NamedParameterJdbcOperations.class)); - } - - @Test - public void testDataSourceInitialized() throws Exception { - this.context.register(DataSourceAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - Map map = new HashMap(); - map.put("spring.database.schema", - ClassUtils.addResourcePathToPackagePath(getClass(), "schema.sql")); - this.context.getEnvironment().getPropertySources() - .addFirst(new MapPropertySource("test", map)); - this.context.refresh(); - DataSource dataSource = this.context.getBean(DataSource.class); - assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource); - assertNotNull(dataSource); - JdbcOperations template = new JdbcTemplate(dataSource); - assertEquals(new Integer(0), - template.queryForObject("SELECT COUNT(*) from FOO", Integer.class)); - } - - @Configuration - static class TestDataSourceConfiguration { - - private BasicDataSource pool; - - @Bean - public DataSource dataSource() { - this.pool = new BasicDataSource(); - this.pool.setDriverClassName("org.hsqldb.jdbcDriver"); - this.pool.setUrl("jdbc:hsqldb:overridedb"); - this.pool.setUsername("sa"); - return this.pool; - } - - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java deleted file mode 100644 index 3ab6041ab7a..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import javax.sql.DataSource; - -import org.junit.Test; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -/** - * @author Dave Syer - */ -public class DataSourceTransactionManagerAutoConfigurationTests { - - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - - @Test - public void testDataSourceExists() throws Exception { - this.context.register(EmbeddedDatabaseConfiguration.class, - DataSourceTransactionManagerAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(DataSource.class)); - assertNotNull(this.context.getBean(DataSourceTransactionManager.class)); - } - - @Test - public void testNoDataSourceExists() throws Exception { - this.context.register(DataSourceTransactionManagerAutoConfiguration.class); - this.context.refresh(); - assertEquals(0, this.context.getBeanNamesForType(DataSource.class).length); - assertEquals( - 0, - this.context.getBeanNamesForType(DataSourceTransactionManager.class).length); - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java deleted file mode 100644 index 3b48d612d37..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import javax.sql.DataSource; - -import org.junit.Test; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import static org.junit.Assert.assertNotNull; - -/** - * @author Dave Syer - */ -public class EmbeddedDatabaseConfigurationTests { - - private AnnotationConfigApplicationContext context; - - @Test - public void testDefaultEmbeddedDatabase() throws Exception { - this.context = new AnnotationConfigApplicationContext(); - this.context.register(EmbeddedDatabaseConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(DataSource.class)); - this.context.close(); - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java deleted file mode 100644 index 8efdfebb994..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.jdbc; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import javax.sql.DataSource; - -import org.junit.After; -import org.junit.Test; -import org.springframework.beans.factory.BeanCreationException; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.util.ReflectionUtils; - -import static org.junit.Assert.assertNotNull; - -/** - * @author Dave Syer - */ -public class TomcatDataSourceConfigurationTests { - - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - - private Map old; - - private Map map; - - @After - public void restore() { - if (this.map != null && this.old != null) { - this.map.putAll(this.old); - } - } - - @Test - public void testDataSourceExists() throws Exception { - this.context.register(TomcatDataSourceConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(DataSource.class)); - } - - @Test(expected = BeanCreationException.class) - public void testBadUrl() throws Exception { - this.map = getField(EmbeddedDatabaseConfiguration.class, "EMBEDDED_DATABASE_URLS"); - this.old = new HashMap(this.map); - this.map.clear(); - this.context.register(TomcatDataSourceConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(DataSource.class)); - } - - @Test(expected = BeanCreationException.class) - public void testBadDriverClass() throws Exception { - this.map = getField(EmbeddedDatabaseConfiguration.class, - "EMBEDDED_DATABASE_DRIVER_CLASSES"); - this.old = new HashMap(this.map); - this.map.clear(); - this.context.register(TomcatDataSourceConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(DataSource.class)); - } - - @SuppressWarnings("unchecked") - public static T getField(Class target, String name) { - Field field = ReflectionUtils.findField(target, name, null); - ReflectionUtils.makeAccessible(field); - return (T) ReflectionUtils.getField(field, target); - } -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java deleted file mode 100644 index 18577f7aa9e..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.orm.jpa; - -import javax.sql.DataSource; - -import org.junit.Test; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; -import org.springframework.bootstrap.autoconfigure.orm.jpa.test.City; -import org.springframework.bootstrap.context.annotation.ComponentScanDetectorConfiguration; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.orm.jpa.JpaTransactionManager; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -/** - * @author Dave Syer - */ -public class HibernateJpaAutoConfigurationTests { - - private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - - @Test - public void testEntityManagerCreated() throws Exception { - this.context.register(ComponentScanDetectorConfiguration.class, - EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class, TestConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(DataSource.class)); - assertNotNull(this.context.getBean(JpaTransactionManager.class)); - } - - @Test - public void testDataSourceTransactionManagerNotCreated() throws Exception { - this.context.register(ComponentScanDetectorConfiguration.class, - EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, - DataSourceTransactionManagerAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class, TestConfiguration.class); - this.context.refresh(); - assertNotNull(this.context.getBean(DataSource.class)); - assertTrue(this.context.getBean("transactionManager") instanceof JpaTransactionManager); - } - - @ComponentScan(basePackageClasses = { City.class }) - protected static class TestConfiguration { - - } -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java deleted file mode 100644 index 1b161879388..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.orm.jpa.test; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -@Entity -public class City implements Serializable { - - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue - private Long id; - - @Column(nullable = false) - private String name; - - @Column(nullable = false) - private String state; - - @Column(nullable = false) - private String country; - - @Column(nullable = false) - private String map; - - protected City() { - } - - public City(String name, String country) { - super(); - this.name = name; - this.country = country; - } - - public String getName() { - return this.name; - } - - public String getState() { - return this.state; - } - - public String getCountry() { - return this.country; - } - - public String getMap() { - return this.map; - } - - @Override - public String toString() { - return getName() + "," + getState() + "," + getCountry(); - } -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java deleted file mode 100644 index 65e71a5f4c2..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.thymeleaf; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -import org.junit.Test; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.core.env.MapPropertySource; -import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.mock.web.MockHttpServletResponse; -import org.springframework.mock.web.MockServletContext; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.servlet.support.RequestContext; -import org.thymeleaf.TemplateEngine; -import org.thymeleaf.context.Context; -import org.thymeleaf.spring3.view.ThymeleafView; -import org.thymeleaf.spring3.view.ThymeleafViewResolver; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * @author Dave Syer - */ -public class ThymeleafAutoConfigurationTests { - - @Test - public void createFromConfigClass() throws Exception { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - context.register(ThymeleafAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - Map map = new HashMap(); - map.put("spring.template.mode", "XHTML"); - map.put("spring.template.suffix", ""); - context.getEnvironment().getPropertySources() - .addFirst(new MapPropertySource("test", map)); - context.refresh(); - TemplateEngine engine = context.getBean(TemplateEngine.class); - Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar")); - String result = engine.process("template.txt", attrs); - assertEquals("bar", result); - context.close(); - } - - @Test - public void createLayoutFromConfigClass() throws Exception { - AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); - context.register(ThymeleafAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - MockServletContext servletContext = new MockServletContext(); - context.setServletContext(servletContext); - context.refresh(); - ThymeleafView view = (ThymeleafView) context.getBean(ThymeleafViewResolver.class) - .resolveViewName("view", Locale.UK); - MockHttpServletResponse response = new MockHttpServletResponse(); - MockHttpServletRequest request = new MockHttpServletRequest(); - request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, context); - view.render(Collections.singletonMap("foo", "bar"), request, response); - String result = response.getContentAsString(); - assertTrue("Wrong result: " + result, result.contains("Content")); - assertTrue("Wrong result: " + result, result.contains("bar")); - context.close(); - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java deleted file mode 100644 index 362a8fd81a5..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.web; - -import javax.servlet.Servlet; - -import org.junit.Test; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.bootstrap.context.annotation.ConditionalOnExpression; -import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; -import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.MockEmbeddedServletContainerFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Component; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.verify; - -/** - * Tests for {@link EmbeddedServletContainerAutoConfiguration}. - * - * @author Dave Syer - */ -public class EmbeddedServletContainerAutoConfigurationTests { - - private AnnotationConfigEmbeddedWebApplicationContext context; - - @Test - public void createFromConfigClass() throws Exception { - this.context = new AnnotationConfigEmbeddedWebApplicationContext( - EmbeddedContainerConfiguration.class, - EmbeddedServletContainerAutoConfiguration.class); - verifyContext(); - } - - @Test - public void containerHasNoServletContext() throws Exception { - this.context = new AnnotationConfigEmbeddedWebApplicationContext( - EmbeddedContainerConfiguration.class, - EnsureContainerHasNoServletContext.class, - EmbeddedServletContainerAutoConfiguration.class); - verifyContext(); - } - - @Test - public void customizeContainerThroughCallback() throws Exception { - this.context = new AnnotationConfigEmbeddedWebApplicationContext( - EmbeddedContainerConfiguration.class, - CallbackEmbeddedContainerCustomizer.class, - EmbeddedServletContainerAutoConfiguration.class); - verifyContext(); - assertEquals(9000, getContainerFactory().getPort()); - } - - private void verifyContext() { - MockEmbeddedServletContainerFactory containerFactory = getContainerFactory(); - Servlet servlet = this.context.getBean(Servlet.class); - verify(containerFactory.getServletContext()).addServlet("dispatcherServlet", - servlet); - } - - private MockEmbeddedServletContainerFactory getContainerFactory() { - return this.context.getBean(MockEmbeddedServletContainerFactory.class); - } - - @Configuration - @ConditionalOnExpression("true") - public static class EmbeddedContainerConfiguration { - - @Bean - public EmbeddedServletContainerFactory containerFactory() { - return new MockEmbeddedServletContainerFactory(); - } - - } - - @Component - public static class EnsureContainerHasNoServletContext implements BeanPostProcessor { - - @Override - public Object postProcessBeforeInitialization(Object bean, String beanName) - throws BeansException { - if (bean instanceof ConfigurableEmbeddedServletContainerFactory) { - MockEmbeddedServletContainerFactory containerFactory = (MockEmbeddedServletContainerFactory) bean; - assertNull(containerFactory.getServletContext()); - } - return bean; - } - - @Override - public Object postProcessAfterInitialization(Object bean, String beanName) { - return bean; - } - - } - - @Component - public static class CallbackEmbeddedContainerCustomizer implements - EmbeddedServletContainerCustomizer { - @Override - public void customize(ConfigurableEmbeddedServletContainerFactory factory) { - factory.setPort(9000); - } - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java deleted file mode 100644 index a9e29fc7c6b..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.web; - -import javax.servlet.MultipartConfigElement; - -import org.junit.After; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; -import org.springframework.bootstrap.context.embedded.jetty.JettyEmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.multipart.MultipartResolver; -import org.springframework.web.multipart.support.StandardServletMultipartResolver; -import org.springframework.web.servlet.DispatcherServlet; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; - -/** - * Tests for {@link MultipartAutoConfiguration}. Tests an empty configuration, no - * multipart configuration, and a multipart configuration (with both Jetty and Tomcat). - * - * @author Greg Turnquist - * @author Dave Syer - */ -public class MultipartAutoConfigurationTests { - - private AnnotationConfigEmbeddedWebApplicationContext context; - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @After - public void close() { - if (this.context != null) { - this.context.close(); - } - } - - @Test - public void containerWithNothing() { - this.context = new AnnotationConfigEmbeddedWebApplicationContext( - ContainerWithNothing.class, - EmbeddedServletContainerAutoConfiguration.class, - MultipartAutoConfiguration.class); - DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class); - assertNull(servlet.getMultipartResolver()); - assertEquals(0, - this.context.getBeansOfType(StandardServletMultipartResolver.class) - .size()); - assertEquals(0, this.context.getBeansOfType(MultipartResolver.class).size()); - } - - @Configuration - public static class ContainerWithNothing { - } - - @Test - public void containerWithNoMultipartJettyConfiguration() { - this.context = new AnnotationConfigEmbeddedWebApplicationContext( - ContainerWithNoMultipartJetty.class, - EmbeddedServletContainerAutoConfiguration.class, - MultipartAutoConfiguration.class); - DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class); - assertNull(servlet.getMultipartResolver()); - assertEquals(0, - this.context.getBeansOfType(StandardServletMultipartResolver.class) - .size()); - assertEquals(0, this.context.getBeansOfType(MultipartResolver.class).size()); - verifyServletWorks(); - } - - @Configuration - public static class ContainerWithNoMultipartJetty { - @Bean - JettyEmbeddedServletContainerFactory containerFactory() { - return new JettyEmbeddedServletContainerFactory(); - } - - @Bean - WebController controller() { - return new WebController(); - } - } - - @Test - public void containerWithNoMultipartTomcatConfiguration() { - this.context = new AnnotationConfigEmbeddedWebApplicationContext( - ContainerWithNoMultipartTomcat.class, - EmbeddedServletContainerAutoConfiguration.class, - MultipartAutoConfiguration.class); - DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class); - assertNull(servlet.getMultipartResolver()); - assertEquals(0, - this.context.getBeansOfType(StandardServletMultipartResolver.class) - .size()); - assertEquals(0, this.context.getBeansOfType(MultipartResolver.class).size()); - verifyServletWorks(); - } - - @Test - public void containerWithAutomatedMultipartJettyConfiguration() { - this.context = new AnnotationConfigEmbeddedWebApplicationContext( - ContainerWithEverythingJetty.class, - EmbeddedServletContainerAutoConfiguration.class, - MultipartAutoConfiguration.class); - this.context.getBean(MultipartConfigElement.class); - assertSame(this.context.getBean(DispatcherServlet.class).getMultipartResolver(), - this.context.getBean(StandardServletMultipartResolver.class)); - verifyServletWorks(); - } - - @Test - public void containerWithAutomatedMultipartTomcatConfiguration() { - this.context = new AnnotationConfigEmbeddedWebApplicationContext( - ContainerWithEverythingTomcat.class, - EmbeddedServletContainerAutoConfiguration.class, - MultipartAutoConfiguration.class); - this.context.getBean(MultipartConfigElement.class); - assertSame(this.context.getBean(DispatcherServlet.class).getMultipartResolver(), - this.context.getBean(StandardServletMultipartResolver.class)); - verifyServletWorks(); - } - - private void verifyServletWorks() { - RestTemplate restTemplate = new RestTemplate(); - assertEquals(restTemplate.getForObject("http://localhost:8080/", String.class), - "Hello"); - } - - @Configuration - public static class ContainerWithNoMultipartTomcat { - - @Bean - TomcatEmbeddedServletContainerFactory containerFactory() { - return new TomcatEmbeddedServletContainerFactory(); - } - - @Bean - WebController controller() { - return new WebController(); - } - } - - @Configuration - public static class ContainerWithEverythingJetty { - @Bean - MultipartConfigElement multipartConfigElement() { - return new MultipartConfigElement(""); - } - - @Bean - JettyEmbeddedServletContainerFactory containerFactory() { - return new JettyEmbeddedServletContainerFactory(); - } - - @Bean - WebController webController() { - return new WebController(); - } - } - - @Configuration - @EnableWebMvc - public static class ContainerWithEverythingTomcat { - @Bean - MultipartConfigElement multipartConfigElement() { - return new MultipartConfigElement(""); - } - - @Bean - TomcatEmbeddedServletContainerFactory containerFactory() { - return new TomcatEmbeddedServletContainerFactory(); - } - - @Bean - WebController webController() { - return new WebController(); - } - } - - @Controller - public static class WebController { - @RequestMapping("/") - public @ResponseBody - String index() { - return "Hello"; - } - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java deleted file mode 100644 index ec089dc2c76..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.autoconfigure.web; - -import java.io.File; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; -import org.springframework.bootstrap.TestUtils; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; -import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor; -import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; -import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.bootstrap.properties.ServerProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -/** - * Tests for {@link ServerPropertiesAutoConfiguration}. - * - * @author Dave Syer - */ -public class ServerPropertiesConfigurationTests { - - private static ConfigurableEmbeddedServletContainerFactory containerFactory; - - private AnnotationConfigEmbeddedWebApplicationContext context; - - @Before - public void init() { - containerFactory = Mockito - .mock(ConfigurableEmbeddedServletContainerFactory.class); - } - - @After - public void close() { - if (this.context != null) { - this.context.close(); - } - } - - @Test - public void createFromConfigClass() throws Exception { - this.context = new AnnotationConfigEmbeddedWebApplicationContext(); - this.context.register(Config.class, ServerPropertiesAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - TestUtils.addEnviroment(this.context, "server.port:9000"); - this.context.refresh(); - ServerProperties server = this.context.getBean(ServerProperties.class); - assertNotNull(server); - assertEquals(9000, server.getPort()); - Mockito.verify(containerFactory).setPort(9000); - } - - @Test - public void tomcatProperties() throws Exception { - containerFactory = Mockito.mock(TomcatEmbeddedServletContainerFactory.class); - this.context = new AnnotationConfigEmbeddedWebApplicationContext(); - this.context.register(Config.class, ServerPropertiesAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - TestUtils.addEnviroment(this.context, "server.tomcat.basedir:target/foo"); - this.context.refresh(); - ServerProperties server = this.context.getBean(ServerProperties.class); - assertNotNull(server); - assertEquals(new File("target/foo"), server.getTomcat().getBasedir()); - Mockito.verify(containerFactory).setPort(8080); - } - - @Configuration - protected static class Config { - - @Bean - public EmbeddedServletContainerFactory containerFactory() { - return ServerPropertiesConfigurationTests.containerFactory; - } - - @Bean - public EmbeddedServletContainerCustomizerBeanPostProcessor embeddedServletContainerCustomizerBeanPostProcessor() { - return new EmbeddedServletContainerCustomizerBeanPostProcessor(); - } - - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java deleted file mode 100644 index 5829e32c1ec..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.autoconfigure.web; - -import org.junit.Ignore; - -/** - * Tests for {@link WebMvcAutoConfiguration}. - * - * @author Phillip Webb - */ -@Ignore -public class WebMvcAutoConfigurationTests { - // FIXME - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java deleted file mode 100644 index d3d2110ec41..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.bootstrap.context.annotation; - -import java.util.Arrays; -import java.util.List; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.core.io.DefaultResourceLoader; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -/** - * Tests for {@link AutoConfigurationSorter}. - * - * @author Phillip Webb - */ -public class AutoConfigurationSorterTest { - - private static final String LOWEST = OrderLowest.class.getName(); - private static final String HIGHEST = OrderHighest.class.getName(); - private static final String A = AutoConfigureA.class.getName(); - private static final String B = AutoConfigureB.class.getName(); - private static final String C = AutoConfigureC.class.getName(); - private static final String D = AutoConfigureD.class.getName(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - private AutoConfigurationSorter sorter; - - @Before - public void setup() { - this.sorter = new AutoConfigurationSorter(new DefaultResourceLoader()); - } - - @Test - public void byOrderAnnotation() throws Exception { - List actual = this.sorter.getInPriorityOrder(Arrays.asList(LOWEST, - HIGHEST)); - assertThat(actual, equalTo(Arrays.asList(HIGHEST, LOWEST))); - } - - @Test - public void byAutoConfigureAfter() throws Exception { - List actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B, C)); - assertThat(actual, equalTo(Arrays.asList(C, B, A))); - } - - @Test - public void byAutoConfigureAfterWithMissing() throws Exception { - List actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B)); - assertThat(actual, equalTo(Arrays.asList(B, A))); - } - - @Test - public void byAutoConfigureAfterWithCycle() throws Exception { - this.thrown.expect(IllegalStateException.class); - this.thrown.expectMessage("Cycle"); - this.sorter.getInPriorityOrder(Arrays.asList(A, B, C, D)); - } - - @Order(Ordered.LOWEST_PRECEDENCE) - public static class OrderLowest { - } - - @Order(Ordered.HIGHEST_PRECEDENCE) - public static class OrderHighest { - } - - @AutoConfigureAfter(AutoConfigureB.class) - public static class AutoConfigureA { - } - - @AutoConfigureAfter({ AutoConfigureC.class, AutoConfigureD.class }) - public static class AutoConfigureB { - } - - public static class AutoConfigureC { - } - - @AutoConfigureAfter(AutoConfigureA.class) - public static class AutoConfigureD { - } -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java deleted file mode 100644 index b01272650bb..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.context.annotation; - -import org.springframework.context.annotation.Import; - -/** - * Simple configuration to import {@link ComponentScanDetector} for tests. - * - * @author Phillip Webb - */ -@Import(ComponentScanDetector.class) -public class ComponentScanDetectorConfiguration { - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java deleted file mode 100644 index 40a7606345f..00000000000 --- a/spring-zero-autoconfigure/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.main; - -import org.junit.After; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.util.ClassUtils; - -import static org.junit.Assert.assertNotNull; - -/** - * @author Dave Syer - */ -public class SimpleMainTests { - - private ApplicationContext context; - - @After - public void close() { - if (this.context instanceof ConfigurableApplicationContext) { - ((ConfigurableApplicationContext) this.context).close(); - } - } - - @Test - public void emptyApplicationContext() throws Exception { - Spring.main(new String[0]); - this.context = Spring.getApplicationContext(); - assertNotNull(this.context); - } - - @Test - public void basePackageScan() throws Exception { - Spring.main(new String[] { ClassUtils.getPackageName(Spring.class) }); - this.context = Spring.getApplicationContext(); - assertNotNull(this.context); - } - - @Test - public void xmlContext() throws Exception { - Spring.main(new String[] { Spring.class.getName(), - "org/springframework/bootstrap/sample-beans.xml" }); - this.context = Spring.getApplicationContext(); - assertNotNull(this.context); - } - -} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/AdhocTestSuite.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/AdhocTestSuite.java new file mode 100644 index 00000000000..a0bf3f333f0 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/AdhocTestSuite.java @@ -0,0 +1,36 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure; + +import org.junit.Ignore; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; +import org.springframework.zero.context.embedded.jetty.JettyEmbeddedServletContainerFactoryTests; +import org.springframework.zero.main.SimpleMainTests; + +/** + * A test suite for probing weird ordering problems in the tests. + * + * @author Dave Syer + */ +@RunWith(Suite.class) +@SuiteClasses({ SimpleMainTests.class, JettyEmbeddedServletContainerFactoryTests.class }) +@Ignore +public class AdhocTestSuite { + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/MessageSourceAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/MessageSourceAutoConfigurationTests.java new file mode 100644 index 00000000000..504421bfa64 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/MessageSourceAutoConfigurationTests.java @@ -0,0 +1,62 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.core.env.MapPropertySource; +import org.springframework.zero.autoconfigure.MessageSourceAutoConfiguration; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; + +import static org.junit.Assert.assertEquals; + +/** + * @author Dave Syer + */ +public class MessageSourceAutoConfigurationTests { + + private AnnotationConfigApplicationContext context; + + @Test + public void testDefaultMessageSource() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(MessageSourceAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertEquals("Foo message", + this.context.getMessage("foo", null, "Foo message", Locale.UK)); + } + + @Test + public void testMessageSourceCreated() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(MessageSourceAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + Map map = new HashMap(); + map.put("spring.messages.basename", "test/messages"); + this.context.getEnvironment().getPropertySources() + .addFirst(new MapPropertySource("test", map)); + this.context.refresh(); + assertEquals("bar", + this.context.getMessage("foo", null, "Foo message", Locale.UK)); + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/SpringJUnitTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/SpringJUnitTests.java new file mode 100644 index 00000000000..585ea7791f3 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/SpringJUnitTests.java @@ -0,0 +1,64 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.autoconfigure; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.SpringJUnitTests.TestConfiguration; +import org.springframework.zero.context.initializer.ConfigFileApplicationContextInitializer; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = TestConfiguration.class, initializers = ConfigFileApplicationContextInitializer.class) +public class SpringJUnitTests { + + @Autowired + private ApplicationContext context; + + @Value("${foo:spam}") + private String foo = "bar"; + + @Test + public void testContextCreated() { + assertNotNull(this.context); + } + + @Test + public void testContextInitialized() { + assertEquals("bucket", this.foo); + } + + @Configuration + @Import({ PropertyPlaceholderAutoConfiguration.class }) + public static class TestConfiguration { + + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/batch/BatchAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/batch/BatchAutoConfigurationTests.java new file mode 100644 index 00000000000..efc393b29b9 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/batch/BatchAutoConfigurationTests.java @@ -0,0 +1,107 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.batch; + +import java.util.Collection; +import java.util.Collections; + +import org.junit.Test; +import org.springframework.batch.core.BatchStatus; +import org.springframework.batch.core.Job; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobExecutionException; +import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.Step; +import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; +import org.springframework.batch.core.job.AbstractJob; +import org.springframework.batch.core.launch.JobLauncher; +import org.springframework.batch.core.repository.JobRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.batch.BatchAutoConfiguration; +import org.springframework.zero.autoconfigure.batch.JobLauncherCommandLineRunner; +import org.springframework.zero.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; + +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + */ +public class BatchAutoConfigurationTests { + + private AnnotationConfigApplicationContext context; + + @Test + public void testDefaultContext() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(TestConfiguration.class, BatchAutoConfiguration.class, + EmbeddedDatabaseConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(JobLauncher.class)); + } + + @Test + public void testDefinesAndLaunchesJob() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(JobConfiguration.class, BatchAutoConfiguration.class, + EmbeddedDatabaseConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + 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())); + } + + @EnableBatchProcessing + protected static class TestConfiguration { + } + + @EnableBatchProcessing + protected static class JobConfiguration { + @Autowired + private JobRepository jobRepository; + + @Bean + public Job job() { + AbstractJob job = new AbstractJob() { + + @Override + public Collection getStepNames() { + return Collections.emptySet(); + } + + @Override + public Step getStep(String stepName) { + return null; + } + + @Override + protected void doExecute(JobExecution execution) + throws JobExecutionException { + execution.setStatus(BatchStatus.COMPLETED); + } + }; + job.setJobRepository(this.jobRepository); + return job; + } + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java new file mode 100644 index 00000000000..4f582039e27 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java @@ -0,0 +1,56 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.batch; + +import org.junit.Test; +import org.springframework.batch.core.BatchStatus; +import org.springframework.batch.core.JobExecution; +import org.springframework.zero.autoconfigure.batch.JobExecutionEvent; +import org.springframework.zero.autoconfigure.batch.JobExecutionExitCodeGenerator; + +import static org.junit.Assert.assertEquals; + +/** + * @author Dave Syer + */ +public class JobExecutionExitCodeGeneratorTests { + + private JobExecutionExitCodeGenerator generator = new JobExecutionExitCodeGenerator(); + + @Test + public void testExitCodeForRunning() { + this.generator.onApplicationEvent(new JobExecutionEvent(new JobExecution(0L))); + assertEquals(1, this.generator.getExitCode()); + } + + @Test + public void testExitCodeForCompleted() { + JobExecution execution = new JobExecution(0L); + execution.setStatus(BatchStatus.COMPLETED); + this.generator.onApplicationEvent(new JobExecutionEvent(execution)); + assertEquals(0, this.generator.getExitCode()); + } + + @Test + public void testExitCodeForFailed() { + JobExecution execution = new JobExecution(0L); + execution.setStatus(BatchStatus.FAILED); + this.generator.onApplicationEvent(new JobExecutionEvent(execution)); + assertEquals(5, this.generator.getExitCode()); + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java new file mode 100644 index 00000000000..75ec5efb885 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java @@ -0,0 +1,63 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.data; + +import javax.persistence.EntityManagerFactory; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.data.JpaRepositoriesAutoConfiguration; +import org.springframework.zero.autoconfigure.data.test.City; +import org.springframework.zero.autoconfigure.data.test.CityRepository; +import org.springframework.zero.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.zero.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.zero.context.annotation.ComponentScanDetectorConfiguration; + +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + */ +public class JpaRepositoriesAutoConfigurationTests { + + private AnnotationConfigApplicationContext context; + + @Test + public void testDefaultRepositoryConfiguration() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(TestConfiguration.class, + ComponentScanDetectorConfiguration.class, + EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, + JpaRepositoriesAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(CityRepository.class)); + assertNotNull(this.context.getBean(PlatformTransactionManager.class)); + assertNotNull(this.context.getBean(EntityManagerFactory.class)); + } + + @Configuration + @ComponentScan(basePackageClasses = City.class) + protected static class TestConfiguration { + + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/JpaWebAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/JpaWebAutoConfigurationTests.java new file mode 100644 index 00000000000..35c3084e2ca --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/JpaWebAutoConfigurationTests.java @@ -0,0 +1,64 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.data; + +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.repository.support.DomainClassConverter; +import org.springframework.mock.web.MockServletContext; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.data.JpaRepositoriesAutoConfiguration; +import org.springframework.zero.autoconfigure.data.test.City; +import org.springframework.zero.autoconfigure.data.test.CityRepository; +import org.springframework.zero.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.zero.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; + +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + */ +@Ignore +// until spring data commons 1.6.0, jpa 1.5.0 available +public class JpaWebAutoConfigurationTests { + + private AnnotationConfigWebApplicationContext context; + + @Test + public void testDefaultRepositoryConfiguration() throws Exception { + this.context = new AnnotationConfigWebApplicationContext(); + this.context.setServletContext(new MockServletContext()); + this.context.register(TestConfiguration.class, + EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, + JpaRepositoriesAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(CityRepository.class)); + assertNotNull(this.context.getBean(DomainClassConverter.class)); + } + + @Configuration + // @EnableSpringDataWebSupport + @ComponentScan(basePackageClasses = City.class) + protected static class TestConfiguration { + + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/test/City.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/test/City.java new file mode 100644 index 00000000000..9ce6daa1e02 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/test/City.java @@ -0,0 +1,76 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.data.test; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class City implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue + private Long id; + + @Column(nullable = false) + private String name; + + @Column(nullable = false) + private String state; + + @Column(nullable = false) + private String country; + + @Column(nullable = false) + private String map; + + protected City() { + } + + public City(String name, String country) { + super(); + this.name = name; + this.country = country; + } + + public String getName() { + return this.name; + } + + public String getState() { + return this.state; + } + + public String getCountry() { + return this.country; + } + + public String getMap() { + return this.map; + } + + @Override + public String toString() { + return getName() + "," + getState() + "," + getCountry(); + } +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/test/CityRepository.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/test/CityRepository.java new file mode 100644 index 00000000000..7b7ff2d61a3 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/data/test/CityRepository.java @@ -0,0 +1,32 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.data.test; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.repository.Repository; + +public interface CityRepository extends Repository { + + Page findAll(Pageable pageable); + + Page findByNameLikeAndCountryLikeAllIgnoringCase(String name, String country, + Pageable pageable); + + City findByNameAndCountryAllIgnoringCase(String name, String country); + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java new file mode 100644 index 00000000000..6eb40b37593 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java @@ -0,0 +1,42 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.zero.autoconfigure.jdbc.BasicDataSourceConfiguration; + +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + */ +public class BasicDataSourceConfigurationTests { + + private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + + @Test + public void testDataSourceExists() throws Exception { + this.context.register(BasicDataSourceConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(DataSource.class)); + this.context.close(); + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java new file mode 100644 index 00000000000..8bfa4203e98 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -0,0 +1,119 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.commons.dbcp.BasicDataSource; +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.MapPropertySource; +import org.springframework.jdbc.core.JdbcOperations; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; +import org.springframework.util.ClassUtils; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.jdbc.DataSourceAutoConfiguration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +/** + * @author Dave Syer + */ +public class DataSourceAutoConfigurationTests { + + private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + + @Test + public void testDefaultDataSourceExists() throws Exception { + this.context.register(DataSourceAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(DataSource.class)); + } + + @Test + public void testDefaultDataSourceCanBeOverridden() throws Exception { + this.context.register(TestDataSourceConfiguration.class, + DataSourceAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + DataSource dataSource = this.context.getBean(DataSource.class); + assertTrue("DataSource is wrong type: " + dataSource, + dataSource instanceof BasicDataSource); + } + + @Test + public void testJdbcTemplateExists() throws Exception { + this.context.register(DataSourceAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + JdbcTemplate jdbcTemplate = this.context.getBean(JdbcTemplate.class); + assertNotNull(jdbcTemplate); + assertNotNull(jdbcTemplate.getDataSource()); + } + + @Test + public void testNamedParameterJdbcTemplateExists() throws Exception { + this.context.register(DataSourceAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(NamedParameterJdbcOperations.class)); + } + + @Test + public void testDataSourceInitialized() throws Exception { + this.context.register(DataSourceAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + Map map = new HashMap(); + map.put("spring.database.schema", + ClassUtils.addResourcePathToPackagePath(getClass(), "schema.sql")); + this.context.getEnvironment().getPropertySources() + .addFirst(new MapPropertySource("test", map)); + this.context.refresh(); + DataSource dataSource = this.context.getBean(DataSource.class); + assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource); + assertNotNull(dataSource); + JdbcOperations template = new JdbcTemplate(dataSource); + assertEquals(new Integer(0), + template.queryForObject("SELECT COUNT(*) from FOO", Integer.class)); + } + + @Configuration + static class TestDataSourceConfiguration { + + private BasicDataSource pool; + + @Bean + public DataSource dataSource() { + this.pool = new BasicDataSource(); + this.pool.setDriverClassName("org.hsqldb.jdbcDriver"); + this.pool.setUrl("jdbc:hsqldb:overridedb"); + this.pool.setUsername("sa"); + return this.pool; + } + + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java new file mode 100644 index 00000000000..5920d0e11da --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java @@ -0,0 +1,56 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.zero.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.zero.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + */ +public class DataSourceTransactionManagerAutoConfigurationTests { + + private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + + @Test + public void testDataSourceExists() throws Exception { + this.context.register(EmbeddedDatabaseConfiguration.class, + DataSourceTransactionManagerAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(DataSource.class)); + assertNotNull(this.context.getBean(DataSourceTransactionManager.class)); + } + + @Test + public void testNoDataSourceExists() throws Exception { + this.context.register(DataSourceTransactionManagerAutoConfiguration.class); + this.context.refresh(); + assertEquals(0, this.context.getBeanNamesForType(DataSource.class).length); + assertEquals( + 0, + this.context.getBeanNamesForType(DataSourceTransactionManager.class).length); + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java new file mode 100644 index 00000000000..3df8fa63f2b --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java @@ -0,0 +1,43 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.zero.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; + +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + */ +public class EmbeddedDatabaseConfigurationTests { + + private AnnotationConfigApplicationContext context; + + @Test + public void testDefaultEmbeddedDatabase() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(EmbeddedDatabaseConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(DataSource.class)); + this.context.close(); + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java new file mode 100644 index 00000000000..49a10d279f1 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java @@ -0,0 +1,90 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.jdbc; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.junit.After; +import org.junit.Test; +import org.springframework.beans.factory.BeanCreationException; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.util.ReflectionUtils; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.zero.autoconfigure.jdbc.TomcatDataSourceConfiguration; + +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + */ +public class TomcatDataSourceConfigurationTests { + + private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + + private Map old; + + private Map map; + + @After + public void restore() { + if (this.map != null && this.old != null) { + this.map.putAll(this.old); + } + } + + @Test + public void testDataSourceExists() throws Exception { + this.context.register(TomcatDataSourceConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(DataSource.class)); + } + + @Test(expected = BeanCreationException.class) + public void testBadUrl() throws Exception { + this.map = getField(EmbeddedDatabaseConfiguration.class, "EMBEDDED_DATABASE_URLS"); + this.old = new HashMap(this.map); + this.map.clear(); + this.context.register(TomcatDataSourceConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(DataSource.class)); + } + + @Test(expected = BeanCreationException.class) + public void testBadDriverClass() throws Exception { + this.map = getField(EmbeddedDatabaseConfiguration.class, + "EMBEDDED_DATABASE_DRIVER_CLASSES"); + this.old = new HashMap(this.map); + this.map.clear(); + this.context.register(TomcatDataSourceConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(DataSource.class)); + } + + @SuppressWarnings("unchecked") + public static T getField(Class target, String name) { + Field field = ReflectionUtils.findField(target, name, null); + ReflectionUtils.makeAccessible(field); + return (T) ReflectionUtils.getField(field, target); + } +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java new file mode 100644 index 00000000000..8d2460f6370 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java @@ -0,0 +1,67 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.orm.jpa; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.zero.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.zero.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.zero.autoconfigure.orm.jpa.test.City; +import org.springframework.zero.context.annotation.ComponentScanDetectorConfiguration; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +/** + * @author Dave Syer + */ +public class HibernateJpaAutoConfigurationTests { + + private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + + @Test + public void testEntityManagerCreated() throws Exception { + this.context.register(ComponentScanDetectorConfiguration.class, + EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class, TestConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(DataSource.class)); + assertNotNull(this.context.getBean(JpaTransactionManager.class)); + } + + @Test + public void testDataSourceTransactionManagerNotCreated() throws Exception { + this.context.register(ComponentScanDetectorConfiguration.class, + EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, + DataSourceTransactionManagerAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class, TestConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(DataSource.class)); + assertTrue(this.context.getBean("transactionManager") instanceof JpaTransactionManager); + } + + @ComponentScan(basePackageClasses = { City.class }) + protected static class TestConfiguration { + + } +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/orm/jpa/test/City.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/orm/jpa/test/City.java new file mode 100644 index 00000000000..c630aff5482 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/orm/jpa/test/City.java @@ -0,0 +1,76 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.orm.jpa.test; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class City implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue + private Long id; + + @Column(nullable = false) + private String name; + + @Column(nullable = false) + private String state; + + @Column(nullable = false) + private String country; + + @Column(nullable = false) + private String map; + + protected City() { + } + + public City(String name, String country) { + super(); + this.name = name; + this.country = country; + } + + public String getName() { + return this.name; + } + + public String getState() { + return this.state; + } + + public String getCountry() { + return this.country; + } + + public String getMap() { + return this.map; + } + + @Override + public String toString() { + return getName() + "," + getState() + "," + getCountry(); + } +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java new file mode 100644 index 00000000000..3e205f1d506 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java @@ -0,0 +1,85 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.thymeleaf; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.core.env.MapPropertySource; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.mock.web.MockServletContext; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import org.springframework.web.servlet.support.RequestContext; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; +import org.thymeleaf.TemplateEngine; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring3.view.ThymeleafView; +import org.thymeleaf.spring3.view.ThymeleafViewResolver; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * @author Dave Syer + */ +public class ThymeleafAutoConfigurationTests { + + @Test + public void createFromConfigClass() throws Exception { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + context.register(ThymeleafAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + Map map = new HashMap(); + map.put("spring.template.mode", "XHTML"); + map.put("spring.template.suffix", ""); + context.getEnvironment().getPropertySources() + .addFirst(new MapPropertySource("test", map)); + context.refresh(); + TemplateEngine engine = context.getBean(TemplateEngine.class); + Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar")); + String result = engine.process("template.txt", attrs); + assertEquals("bar", result); + context.close(); + } + + @Test + public void createLayoutFromConfigClass() throws Exception { + AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); + context.register(ThymeleafAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + MockServletContext servletContext = new MockServletContext(); + context.setServletContext(servletContext); + context.refresh(); + ThymeleafView view = (ThymeleafView) context.getBean(ThymeleafViewResolver.class) + .resolveViewName("view", Locale.UK); + MockHttpServletResponse response = new MockHttpServletResponse(); + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, context); + view.render(Collections.singletonMap("foo", "bar"), request, response); + String result = response.getContentAsString(); + assertTrue("Wrong result: " + result, result.contains("Content")); + assertTrue("Wrong result: " + result, result.contains("bar")); + context.close(); + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java new file mode 100644 index 00000000000..472ebdf9bf2 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java @@ -0,0 +1,126 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.web; + +import javax.servlet.Servlet; + +import org.junit.Test; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; +import org.springframework.zero.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.zero.context.annotation.ConditionalOnExpression; +import org.springframework.zero.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; +import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer; +import org.springframework.zero.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.MockEmbeddedServletContainerFactory; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.verify; + +/** + * Tests for {@link EmbeddedServletContainerAutoConfiguration}. + * + * @author Dave Syer + */ +public class EmbeddedServletContainerAutoConfigurationTests { + + private AnnotationConfigEmbeddedWebApplicationContext context; + + @Test + public void createFromConfigClass() throws Exception { + this.context = new AnnotationConfigEmbeddedWebApplicationContext( + EmbeddedContainerConfiguration.class, + EmbeddedServletContainerAutoConfiguration.class); + verifyContext(); + } + + @Test + public void containerHasNoServletContext() throws Exception { + this.context = new AnnotationConfigEmbeddedWebApplicationContext( + EmbeddedContainerConfiguration.class, + EnsureContainerHasNoServletContext.class, + EmbeddedServletContainerAutoConfiguration.class); + verifyContext(); + } + + @Test + public void customizeContainerThroughCallback() throws Exception { + this.context = new AnnotationConfigEmbeddedWebApplicationContext( + EmbeddedContainerConfiguration.class, + CallbackEmbeddedContainerCustomizer.class, + EmbeddedServletContainerAutoConfiguration.class); + verifyContext(); + assertEquals(9000, getContainerFactory().getPort()); + } + + private void verifyContext() { + MockEmbeddedServletContainerFactory containerFactory = getContainerFactory(); + Servlet servlet = this.context.getBean(Servlet.class); + verify(containerFactory.getServletContext()).addServlet("dispatcherServlet", + servlet); + } + + private MockEmbeddedServletContainerFactory getContainerFactory() { + return this.context.getBean(MockEmbeddedServletContainerFactory.class); + } + + @Configuration + @ConditionalOnExpression("true") + public static class EmbeddedContainerConfiguration { + + @Bean + public EmbeddedServletContainerFactory containerFactory() { + return new MockEmbeddedServletContainerFactory(); + } + + } + + @Component + public static class EnsureContainerHasNoServletContext implements BeanPostProcessor { + + @Override + public Object postProcessBeforeInitialization(Object bean, String beanName) + throws BeansException { + if (bean instanceof ConfigurableEmbeddedServletContainerFactory) { + MockEmbeddedServletContainerFactory containerFactory = (MockEmbeddedServletContainerFactory) bean; + assertNull(containerFactory.getServletContext()); + } + return bean; + } + + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) { + return bean; + } + + } + + @Component + public static class CallbackEmbeddedContainerCustomizer implements + EmbeddedServletContainerCustomizer { + @Override + public void customize(ConfigurableEmbeddedServletContainerFactory factory) { + factory.setPort(9000); + } + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/MultipartAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/MultipartAutoConfigurationTests.java new file mode 100644 index 00000000000..624f1f78a2c --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/MultipartAutoConfigurationTests.java @@ -0,0 +1,217 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.web; + +import javax.servlet.MultipartConfigElement; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.zero.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.zero.autoconfigure.web.MultipartAutoConfiguration; +import org.springframework.zero.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; +import org.springframework.zero.context.embedded.jetty.JettyEmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; + +/** + * Tests for {@link MultipartAutoConfiguration}. Tests an empty configuration, no + * multipart configuration, and a multipart configuration (with both Jetty and Tomcat). + * + * @author Greg Turnquist + * @author Dave Syer + */ +public class MultipartAutoConfigurationTests { + + private AnnotationConfigEmbeddedWebApplicationContext context; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @After + public void close() { + if (this.context != null) { + this.context.close(); + } + } + + @Test + public void containerWithNothing() { + this.context = new AnnotationConfigEmbeddedWebApplicationContext( + ContainerWithNothing.class, + EmbeddedServletContainerAutoConfiguration.class, + MultipartAutoConfiguration.class); + DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class); + assertNull(servlet.getMultipartResolver()); + assertEquals(0, + this.context.getBeansOfType(StandardServletMultipartResolver.class) + .size()); + assertEquals(0, this.context.getBeansOfType(MultipartResolver.class).size()); + } + + @Configuration + public static class ContainerWithNothing { + } + + @Test + public void containerWithNoMultipartJettyConfiguration() { + this.context = new AnnotationConfigEmbeddedWebApplicationContext( + ContainerWithNoMultipartJetty.class, + EmbeddedServletContainerAutoConfiguration.class, + MultipartAutoConfiguration.class); + DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class); + assertNull(servlet.getMultipartResolver()); + assertEquals(0, + this.context.getBeansOfType(StandardServletMultipartResolver.class) + .size()); + assertEquals(0, this.context.getBeansOfType(MultipartResolver.class).size()); + verifyServletWorks(); + } + + @Configuration + public static class ContainerWithNoMultipartJetty { + @Bean + JettyEmbeddedServletContainerFactory containerFactory() { + return new JettyEmbeddedServletContainerFactory(); + } + + @Bean + WebController controller() { + return new WebController(); + } + } + + @Test + public void containerWithNoMultipartTomcatConfiguration() { + this.context = new AnnotationConfigEmbeddedWebApplicationContext( + ContainerWithNoMultipartTomcat.class, + EmbeddedServletContainerAutoConfiguration.class, + MultipartAutoConfiguration.class); + DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class); + assertNull(servlet.getMultipartResolver()); + assertEquals(0, + this.context.getBeansOfType(StandardServletMultipartResolver.class) + .size()); + assertEquals(0, this.context.getBeansOfType(MultipartResolver.class).size()); + verifyServletWorks(); + } + + @Test + public void containerWithAutomatedMultipartJettyConfiguration() { + this.context = new AnnotationConfigEmbeddedWebApplicationContext( + ContainerWithEverythingJetty.class, + EmbeddedServletContainerAutoConfiguration.class, + MultipartAutoConfiguration.class); + this.context.getBean(MultipartConfigElement.class); + assertSame(this.context.getBean(DispatcherServlet.class).getMultipartResolver(), + this.context.getBean(StandardServletMultipartResolver.class)); + verifyServletWorks(); + } + + @Test + public void containerWithAutomatedMultipartTomcatConfiguration() { + this.context = new AnnotationConfigEmbeddedWebApplicationContext( + ContainerWithEverythingTomcat.class, + EmbeddedServletContainerAutoConfiguration.class, + MultipartAutoConfiguration.class); + this.context.getBean(MultipartConfigElement.class); + assertSame(this.context.getBean(DispatcherServlet.class).getMultipartResolver(), + this.context.getBean(StandardServletMultipartResolver.class)); + verifyServletWorks(); + } + + private void verifyServletWorks() { + RestTemplate restTemplate = new RestTemplate(); + assertEquals(restTemplate.getForObject("http://localhost:8080/", String.class), + "Hello"); + } + + @Configuration + public static class ContainerWithNoMultipartTomcat { + + @Bean + TomcatEmbeddedServletContainerFactory containerFactory() { + return new TomcatEmbeddedServletContainerFactory(); + } + + @Bean + WebController controller() { + return new WebController(); + } + } + + @Configuration + public static class ContainerWithEverythingJetty { + @Bean + MultipartConfigElement multipartConfigElement() { + return new MultipartConfigElement(""); + } + + @Bean + JettyEmbeddedServletContainerFactory containerFactory() { + return new JettyEmbeddedServletContainerFactory(); + } + + @Bean + WebController webController() { + return new WebController(); + } + } + + @Configuration + @EnableWebMvc + public static class ContainerWithEverythingTomcat { + @Bean + MultipartConfigElement multipartConfigElement() { + return new MultipartConfigElement(""); + } + + @Bean + TomcatEmbeddedServletContainerFactory containerFactory() { + return new TomcatEmbeddedServletContainerFactory(); + } + + @Bean + WebController webController() { + return new WebController(); + } + } + + @Controller + public static class WebController { + @RequestMapping("/") + public @ResponseBody + String index() { + return "Hello"; + } + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/ServerPropertiesConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/ServerPropertiesConfigurationTests.java new file mode 100644 index 00000000000..713fc168c6f --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/ServerPropertiesConfigurationTests.java @@ -0,0 +1,106 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.autoconfigure.web; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.zero.TestUtils; +import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.zero.autoconfigure.web.ServerPropertiesAutoConfiguration; +import org.springframework.zero.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; +import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor; +import org.springframework.zero.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; +import org.springframework.zero.properties.ServerProperties; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * Tests for {@link ServerPropertiesAutoConfiguration}. + * + * @author Dave Syer + */ +public class ServerPropertiesConfigurationTests { + + private static ConfigurableEmbeddedServletContainerFactory containerFactory; + + private AnnotationConfigEmbeddedWebApplicationContext context; + + @Before + public void init() { + containerFactory = Mockito + .mock(ConfigurableEmbeddedServletContainerFactory.class); + } + + @After + public void close() { + if (this.context != null) { + this.context.close(); + } + } + + @Test + public void createFromConfigClass() throws Exception { + this.context = new AnnotationConfigEmbeddedWebApplicationContext(); + this.context.register(Config.class, ServerPropertiesAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + TestUtils.addEnviroment(this.context, "server.port:9000"); + this.context.refresh(); + ServerProperties server = this.context.getBean(ServerProperties.class); + assertNotNull(server); + assertEquals(9000, server.getPort()); + Mockito.verify(containerFactory).setPort(9000); + } + + @Test + public void tomcatProperties() throws Exception { + containerFactory = Mockito.mock(TomcatEmbeddedServletContainerFactory.class); + this.context = new AnnotationConfigEmbeddedWebApplicationContext(); + this.context.register(Config.class, ServerPropertiesAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + TestUtils.addEnviroment(this.context, "server.tomcat.basedir:target/foo"); + this.context.refresh(); + ServerProperties server = this.context.getBean(ServerProperties.class); + assertNotNull(server); + assertEquals(new File("target/foo"), server.getTomcat().getBasedir()); + Mockito.verify(containerFactory).setPort(8080); + } + + @Configuration + protected static class Config { + + @Bean + public EmbeddedServletContainerFactory containerFactory() { + return ServerPropertiesConfigurationTests.containerFactory; + } + + @Bean + public EmbeddedServletContainerCustomizerBeanPostProcessor embeddedServletContainerCustomizerBeanPostProcessor() { + return new EmbeddedServletContainerCustomizerBeanPostProcessor(); + } + + } + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfigurationTests.java new file mode 100644 index 00000000000..84813d0ba00 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfigurationTests.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.autoconfigure.web; + +import org.junit.Ignore; +import org.springframework.zero.autoconfigure.web.WebMvcAutoConfiguration; + +/** + * Tests for {@link WebMvcAutoConfiguration}. + * + * @author Phillip Webb + */ +@Ignore +public class WebMvcAutoConfigurationTests { + // FIXME + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/context/annotation/AutoConfigurationSorterTest.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/context/annotation/AutoConfigurationSorterTest.java new file mode 100644 index 00000000000..855927731a0 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/context/annotation/AutoConfigurationSorterTest.java @@ -0,0 +1,106 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.zero.context.annotation; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.zero.context.annotation.AutoConfigurationSorter; +import org.springframework.zero.context.annotation.AutoConfigureAfter; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link AutoConfigurationSorter}. + * + * @author Phillip Webb + */ +public class AutoConfigurationSorterTest { + + private static final String LOWEST = OrderLowest.class.getName(); + private static final String HIGHEST = OrderHighest.class.getName(); + private static final String A = AutoConfigureA.class.getName(); + private static final String B = AutoConfigureB.class.getName(); + private static final String C = AutoConfigureC.class.getName(); + private static final String D = AutoConfigureD.class.getName(); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + private AutoConfigurationSorter sorter; + + @Before + public void setup() { + this.sorter = new AutoConfigurationSorter(new DefaultResourceLoader()); + } + + @Test + public void byOrderAnnotation() throws Exception { + List actual = this.sorter.getInPriorityOrder(Arrays.asList(LOWEST, + HIGHEST)); + assertThat(actual, equalTo(Arrays.asList(HIGHEST, LOWEST))); + } + + @Test + public void byAutoConfigureAfter() throws Exception { + List actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B, C)); + assertThat(actual, equalTo(Arrays.asList(C, B, A))); + } + + @Test + public void byAutoConfigureAfterWithMissing() throws Exception { + List actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B)); + assertThat(actual, equalTo(Arrays.asList(B, A))); + } + + @Test + public void byAutoConfigureAfterWithCycle() throws Exception { + this.thrown.expect(IllegalStateException.class); + this.thrown.expectMessage("Cycle"); + this.sorter.getInPriorityOrder(Arrays.asList(A, B, C, D)); + } + + @Order(Ordered.LOWEST_PRECEDENCE) + public static class OrderLowest { + } + + @Order(Ordered.HIGHEST_PRECEDENCE) + public static class OrderHighest { + } + + @AutoConfigureAfter(AutoConfigureB.class) + public static class AutoConfigureA { + } + + @AutoConfigureAfter({ AutoConfigureC.class, AutoConfigureD.class }) + public static class AutoConfigureB { + } + + public static class AutoConfigureC { + } + + @AutoConfigureAfter(AutoConfigureA.class) + public static class AutoConfigureD { + } +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/context/annotation/ComponentScanDetectorConfiguration.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/context/annotation/ComponentScanDetectorConfiguration.java new file mode 100644 index 00000000000..e35802a9bc4 --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/context/annotation/ComponentScanDetectorConfiguration.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.context.annotation; + +import org.springframework.context.annotation.Import; +import org.springframework.zero.context.annotation.ComponentScanDetector; + +/** + * Simple configuration to import {@link ComponentScanDetector} for tests. + * + * @author Phillip Webb + */ +@Import(ComponentScanDetector.class) +public class ComponentScanDetectorConfiguration { + +} diff --git a/spring-zero-autoconfigure/src/test/java/org/springframework/zero/main/SimpleMainTests.java b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/main/SimpleMainTests.java new file mode 100644 index 00000000000..7bdd74f4c0c --- /dev/null +++ b/spring-zero-autoconfigure/src/test/java/org/springframework/zero/main/SimpleMainTests.java @@ -0,0 +1,64 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.zero.main; + +import org.junit.After; +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.util.ClassUtils; +import org.springframework.zero.main.Spring; + +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + */ +public class SimpleMainTests { + + private ApplicationContext context; + + @After + public void close() { + if (this.context instanceof ConfigurableApplicationContext) { + ((ConfigurableApplicationContext) this.context).close(); + } + } + + @Test + public void emptyApplicationContext() throws Exception { + Spring.main(new String[0]); + this.context = Spring.getApplicationContext(); + assertNotNull(this.context); + } + + @Test + public void basePackageScan() throws Exception { + Spring.main(new String[] { ClassUtils.getPackageName(Spring.class) }); + this.context = Spring.getApplicationContext(); + assertNotNull(this.context); + } + + @Test + public void xmlContext() throws Exception { + Spring.main(new String[] { Spring.class.getName(), + "org/springframework/zero/sample-beans.xml" }); + this.context = Spring.getApplicationContext(); + assertNotNull(this.context); + } + +} diff --git a/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/annotation/testProperties.xml b/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/annotation/testProperties.xml deleted file mode 100644 index c04d85080c4..00000000000 --- a/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/annotation/testProperties.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml b/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml deleted file mode 100644 index c4a4d1737a0..00000000000 --- a/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/context/embedded/exampleEmbeddedWebApplicationConfiguration.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/sample-beans.xml b/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/sample-beans.xml deleted file mode 100644 index 3658eb12749..00000000000 --- a/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/sample-beans.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/spring-zero-autoconfigure/src/test/resources/fixme/static/css/style.css b/spring-zero-autoconfigure/src/test/resources/fixme/static/css/style.css deleted file mode 100644 index 301dc39263e..00000000000 --- a/spring-zero-autoconfigure/src/test/resources/fixme/static/css/style.css +++ /dev/null @@ -1 +0,0 @@ -body: {background: red} \ No newline at end of file diff --git a/spring-zero-autoconfigure/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql b/spring-zero-autoconfigure/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql deleted file mode 100644 index 38de8810573..00000000000 --- a/spring-zero-autoconfigure/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE FOO ( - id INTEGER IDENTITY PRIMARY KEY, - name VARCHAR(30), -); \ No newline at end of file diff --git a/spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql b/spring-zero-autoconfigure/src/test/resources/org/springframework/zero/autoconfigure/jdbc/schema.sql similarity index 100% rename from spring-zero-autoconfigure/src/test/resources/fixme/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql rename to spring-zero-autoconfigure/src/test/resources/org/springframework/zero/autoconfigure/jdbc/schema.sql diff --git a/spring-zero-cli/pom.xml b/spring-zero-cli/pom.xml index 8dfb51468dc..6b25178ff0f 100644 --- a/spring-zero-cli/pom.xml +++ b/spring-zero-cli/pom.xml @@ -11,7 +11,7 @@ jar ${basedir}/.. - org.springframework.bootstrap.cli.SpringBootstrapCli + org.springframework.zero.cli.SpringZeroCli diff --git a/spring-zero-cli/samples/actuator.groovy b/spring-zero-cli/samples/actuator.groovy index fad95cded8d..56d341d611c 100644 --- a/spring-zero-cli/samples/actuator.groovy +++ b/spring-zero-cli/samples/actuator.groovy @@ -1,6 +1,6 @@ package org.test -@Grab("org.springframework.bootstrap:spring-bootstrap-actuator:0.5.0.BUILD-SNAPSHOT") +@Grab("org.springframework.zero:spring-zero-actuator:0.5.0.BUILD-SNAPSHOT") @Controller class SampleController { diff --git a/spring-zero-cli/samples/template.groovy b/spring-zero-cli/samples/template.groovy index eab92331121..719311dd269 100644 --- a/spring-zero-cli/samples/template.groovy +++ b/spring-zero-cli/samples/template.groovy @@ -1,6 +1,6 @@ package org.test -import static org.springframework.bootstrap.cli.template.GroovyTemplate.template; +import static org.springframework.zero.cli.template.GroovyTemplate.template; @Component class Example implements CommandLineRunner { diff --git a/spring-zero-cli/src/main/assembly/descriptor.xml b/spring-zero-cli/src/main/assembly/descriptor.xml index 7d2b776f58f..2f25a1f0ed1 100644 --- a/spring-zero-cli/src/main/assembly/descriptor.xml +++ b/spring-zero-cli/src/main/assembly/descriptor.xml @@ -23,7 +23,7 @@ - org.springframework.bootstrap:spring-bootstrap-cli:jar:* + org.springframework.zero:spring-zero-cli:jar:* lib diff --git a/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java b/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java deleted file mode 100644 index f8e59e31944..00000000000 --- a/spring-zero-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.bootstrap.cli; - -import java.util.Arrays; -import java.util.Collections; -import java.util.EnumSet; -import java.util.Set; - -/** - * Runtime exception wrapper that defines additional {@link Option}s that are understood - * by the {@link SpringBootstrapCli}. - * - * @author Phillip Webb - */ -public class BootstrapCliException extends RuntimeException { - - private static final long serialVersionUID = 0L; - - private final EnumSet