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/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/eclipse/org.eclipse.jdt.core.prefs b/eclipse/org.eclipse.jdt.core.prefs index f544b17104a..3301c45fecb 100644 --- a/eclipse/org.eclipse.jdt.core.prefs +++ b/eclipse/org.eclipse.jdt.core.prefs @@ -193,11 +193,11 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert diff --git a/pom.xml b/pom.xml index 452f74d91a0..eb221adb12f 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-bootstrap + spring-autoconfigure + spring-starters + spring-actuator + spring-launcher + spring-package-maven-plugin + spring-cli + spring-zero-intergration-tests + @@ -82,7 +65,6 @@ 2.7 - org.apache.maven.plugins maven-dependency-plugin 2.6 @@ -106,6 +88,10 @@ maven-jar-plugin 2.4 + + maven-javadoc-plugin + 2.9 + maven-plugin-plugin 3.2 @@ -118,10 +104,6 @@ maven-shade-plugin 2.0 - - maven-surefire-plugin - 2.13 - maven-site-plugin 3.2 @@ -131,17 +113,28 @@ 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 + exec-maven-plugin + 1.2.1 + + + org.codehaus.mojo + sonar-maven-plugin + 2.0 + + + org.codehaus.mojo + versions-maven-plugin + 2.0 + @@ -160,11 +153,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 +167,17 @@ attach-javadocs - verify jar - - - maven-source-plugin attach-sources - verify jar-no-fork @@ -206,16 +194,11 @@ **/Abstract*.java - junit:junit - - file:/dev/./urandom - org.codehaus.mojo versions-maven-plugin - 2.0 @@ -224,7 +207,7 @@ ch.qos.logback logback-classic - 1.0.7 + 1.0.10 com.fasterxml.jackson.core @@ -286,6 +269,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 +349,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 +385,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 +420,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 +455,6 @@ spring-beans ${spring.version} - - org.springframework - spring-expression - ${spring.version} - org.springframework spring-core @@ -460,17 +478,7 @@ org.springframework - spring-web - ${spring.version} - - - org.springframework - spring-jms - ${spring.version} - - - org.springframework - spring-webmvc + spring-expression ${spring.version} @@ -478,6 +486,11 @@ spring-jdbc ${spring.version} + + org.springframework + spring-jms + ${spring.version} + org.springframework spring-orm @@ -504,16 +517,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 +548,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 +621,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 +664,21 @@ + + jdk8 + + 1.8 + + + + + maven-javadoc-plugin + + -Xdoclint:none -quiet + + + + + - diff --git a/spring-bootstrap-actuator/README.md b/spring-actuator/README.md similarity index 93% rename from spring-bootstrap-actuator/README.md rename to spring-actuator/README.md index 109a8ae69b6..aac0cb5bc61 100644 --- a/spring-bootstrap-actuator/README.md +++ b/spring-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-bootstrap-actuator/docs/Features.md b/spring-actuator/docs/Features.md similarity index 95% rename from spring-bootstrap-actuator/docs/Features.md rename to spring-actuator/docs/Features.md index 29528d63092..e84748eb8fa 100644 --- a/spring-bootstrap-actuator/docs/Features.md +++ b/spring-actuator/docs/Features.md @@ -1,7 +1,7 @@ -# Spring Bootstrap Actuator Feature Guide +# Spring Actuator Feature Guide -Here are some (most, hopefully all) the features of Spring Bootstrap -Actuator with some commentary to help you start using them. We +Here are some (most, hopefully all) the features of Spring 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. @@ -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 Bootstap 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. @@ -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 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 @@ -177,7 +177,6 @@ to change the default values imperatively in Java, so get more control over the process. You can do this by declaring a bean of the same type in your application context, e.g. for the server properties: - @AssertMissingBean(ServerProperties.class) @Bean public ServerProperties serverProperties() { ServerProperties server = new ServerProperties(); @@ -185,10 +184,6 @@ type in your application context, e.g. for the server properties: return server; } -Note the use of `@AssertMissingBean` to guard against any mistakes -where the bean is already defined (and therefore might already have -been bound). - ## Server Configuration The `ServerProperties` are bound to application properties, and @@ -217,7 +212,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 Actuator 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 +256,7 @@ this. ## Customizing Logging -Spring Bootstrap uses SLF4J for logging, but leaves the implementation +Spring Actuator 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 +285,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 +parsing their configuration files. See the default configurations in `spring-bootstrap.jar` for examples. ## Application Context Initializers -To add additional application context initializers to the Bootstrap +To add additional application context initializers to the bootstrap 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-bootstrap-actuator/pom.xml b/spring-actuator/pom.xml similarity index 76% rename from spring-bootstrap-actuator/pom.xml rename to spring-actuator/pom.xml index 884f8360708..65b4a208bc9 100644 --- a/spring-bootstrap-actuator/pom.xml +++ b/spring-actuator/pom.xml @@ -3,21 +3,29 @@ 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-actuator jar + + ${basedir}/.. + + - org.springframework.bootstrap - spring-bootstrap + ${project.groupId} + spring-autoconfigure ${project.version} - org.springframework - spring-webmvc + com.fasterxml.jackson.core + jackson-databind + + + org.hibernate + hibernate-validator org.springframework @@ -25,7 +33,13 @@ org.springframework - spring-expression + spring-context + + + + javax.servlet + javax.servlet-api + true org.springframework @@ -33,17 +47,9 @@ test - javax.servlet - javax.servlet-api - provided - - - org.hibernate - hibernate-validator - - - com.fasterxml.jackson.core - jackson-databind + org.springframework + spring-webmvc + true org.springframework.security @@ -60,6 +66,14 @@ tomcat-embed-core true + + + ${project.groupId} + spring-bootstrap + ${project.version} + tests + test + 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-actuator/src/main/java/org/springframework/actuate/audit/AuditEvent.java similarity index 98% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java rename to spring-actuator/src/main/java/org/springframework/actuate/audit/AuditEvent.java index 0d6cec47242..73b26542470 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEvent.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/audit/AuditEvent.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.audit; +package org.springframework.actuate.audit; import java.io.Serializable; import java.util.Collections; @@ -93,7 +93,8 @@ public class AuditEvent implements Serializable { if (entry.contains("=")) { int index = entry.indexOf("="); result.put(entry.substring(0, index), entry.substring(index + 1)); - } else { + } + else { result.put(entry, null); } } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java b/spring-actuator/src/main/java/org/springframework/actuate/audit/AuditEventRepository.java similarity index 95% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java rename to spring-actuator/src/main/java/org/springframework/actuate/audit/AuditEventRepository.java index 839f03494d4..874fdbb7dd9 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/AuditEventRepository.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/audit/AuditEventRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.audit; +package org.springframework.actuate.audit; import java.util.Date; import java.util.List; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java b/spring-actuator/src/main/java/org/springframework/actuate/audit/InMemoryAuditEventRepository.java similarity index 97% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java rename to spring-actuator/src/main/java/org/springframework/actuate/audit/InMemoryAuditEventRepository.java index f7d8ff97b6d..399863364be 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepository.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/audit/InMemoryAuditEventRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.audit; +package org.springframework.actuate.audit; import java.util.ArrayList; import java.util.Collections; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java b/spring-actuator/src/main/java/org/springframework/actuate/audit/listener/AuditApplicationEvent.java similarity index 94% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java rename to spring-actuator/src/main/java/org/springframework/actuate/audit/listener/AuditApplicationEvent.java index 08141f95b8d..2fe8910e3c0 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditApplicationEvent.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/audit/listener/AuditApplicationEvent.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.audit.listener; +package org.springframework.actuate.audit.listener; import java.util.Date; import java.util.Map; -import org.springframework.bootstrap.actuate.audit.AuditEvent; +import org.springframework.actuate.audit.AuditEvent; import org.springframework.context.ApplicationEvent; import org.springframework.util.Assert; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java b/spring-actuator/src/main/java/org/springframework/actuate/audit/listener/AuditListener.java similarity index 87% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java rename to spring-actuator/src/main/java/org/springframework/actuate/audit/listener/AuditListener.java index 169eccf3819..78c07fdad0d 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/audit/listener/AuditListener.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/audit/listener/AuditListener.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.audit.listener; +package org.springframework.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.actuate.audit.AuditEvent; +import org.springframework.actuate.audit.AuditEventRepository; import org.springframework.context.ApplicationListener; /** diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/AuditAutoConfiguration.java similarity index 71% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/AuditAutoConfiguration.java index 1775234d2a4..22fd35ec0a1 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/AuditAutoConfiguration.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.actuate.autoconfigure; +import org.springframework.actuate.audit.AuditEvent; +import org.springframework.actuate.audit.AuditEventRepository; +import org.springframework.actuate.audit.InMemoryAuditEventRepository; +import org.springframework.actuate.audit.listener.AuditListener; +import org.springframework.actuate.security.AuthenticationAuditListener; +import org.springframework.actuate.security.AuthorizationAuditListener; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/EndpointAutoConfiguration.java similarity index 77% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/EndpointAutoConfiguration.java index f4f00830bdc..0c1c56404c2 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/EndpointAutoConfiguration.java @@ -13,34 +13,35 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; + +package org.springframework.actuate.autoconfigure; import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; +import org.springframework.actuate.endpoint.BeansEndpoint; +import org.springframework.actuate.endpoint.DumpEndpoint; +import org.springframework.actuate.endpoint.Endpoint; +import org.springframework.actuate.endpoint.EnvironmentEndpoint; +import org.springframework.actuate.endpoint.HealthEndpoint; +import org.springframework.actuate.endpoint.InfoEndpoint; +import org.springframework.actuate.endpoint.MetricsEndpoint; +import org.springframework.actuate.endpoint.PublicMetrics; +import org.springframework.actuate.endpoint.ShutdownEndpoint; +import org.springframework.actuate.endpoint.TraceEndpoint; +import org.springframework.actuate.endpoint.VanillaPublicMetrics; +import org.springframework.actuate.health.HealthIndicator; +import org.springframework.actuate.health.VanillaHealthIndicator; +import org.springframework.actuate.metrics.InMemoryMetricRepository; +import org.springframework.actuate.metrics.MetricRepository; +import org.springframework.actuate.trace.InMemoryTraceRepository; +import org.springframework.actuate.trace.TraceRepository; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.ConfigurableEnvironment; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java similarity index 82% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java index aa3731398b8..a2ce8775e2e 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java @@ -14,27 +14,27 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.actuate.autoconfigure; import javax.servlet.Servlet; +import org.springframework.actuate.endpoint.Endpoint; +import org.springframework.actuate.endpoint.mvc.EndpointHandlerAdapter; +import org.springframework.actuate.endpoint.mvc.EndpointHandlerMapping; +import org.springframework.actuate.properties.ManagementServerProperties; +import org.springframework.autoconfigure.AutoConfigureAfter; +import org.springframework.autoconfigure.EnableAutoConfiguration; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.autoconfigure.web.WebMvcAutoConfiguration; 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.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; -import org.springframework.bootstrap.properties.ServerProperties; +import org.springframework.bootstrap.context.embedded.properties.ServerProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationListener; @@ -67,9 +67,6 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, private ApplicationContext applicationContext; - @Autowired(required = false) - private ServerProperties serverProperties = new ServerProperties(); - @Autowired(required = false) private ManagementServerProperties managementServerProperties = new ManagementServerProperties(); @@ -140,7 +137,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, ServerProperties serverProperties; try { serverProperties = beanFactory.getBean(ServerProperties.class); - } catch (NoSuchBeanDefinitionException ex) { + } + catch (NoSuchBeanDefinitionException ex) { serverProperties = new ServerProperties(); } @@ -148,7 +146,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, try { managementServerProperties = beanFactory .getBean(ManagementServerProperties.class); - } catch (NoSuchBeanDefinitionException ex) { + } + catch (NoSuchBeanDefinitionException ex) { managementServerProperties = new ManagementServerProperties(); } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java similarity index 88% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java index f7100904299..96d9948346e 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java @@ -13,18 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; + +package org.springframework.actuate.autoconfigure; import javax.servlet.Filter; +import org.springframework.actuate.endpoint.mvc.EndpointHandlerAdapter; +import org.springframework.actuate.endpoint.mvc.EndpointHandlerMapping; +import org.springframework.actuate.properties.ManagementServerProperties; 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.condition.ConditionalOnBean; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainer; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/ErrorMvcAutoConfiguration.java similarity index 80% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/ErrorMvcAutoConfiguration.java index b95a8f0730b..0f77f010a3d 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ErrorMvcAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/ErrorMvcAutoConfiguration.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.actuate.autoconfigure; import javax.servlet.Servlet; +import org.springframework.actuate.web.BasicErrorController; +import org.springframework.actuate.web.ErrorController; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.bootstrap.context.embedded.ErrorPage; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java similarity index 65% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java index b0eb62af8c4..cda2d971b09 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java @@ -13,14 +13,15 @@ * 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; +package org.springframework.actuate.autoconfigure; + +import org.springframework.actuate.properties.ManagementServerProperties; +import org.springframework.autoconfigure.AutoConfigureAfter; +import org.springframework.autoconfigure.EnableAutoConfiguration; +import org.springframework.autoconfigure.web.ServerPropertiesAutoConfiguration; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -35,7 +36,7 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties public class ManagementServerPropertiesAutoConfiguration { - @Bean(name = "org.springframework.bootstrap.actuate.properties.ManagementServerProperties") + @Bean(name = "org.springframework.actuate.properties.ManagementServerProperties") @ConditionalOnMissingBean public ManagementServerProperties serverProperties() { return new ManagementServerProperties(); diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/MetricFilterAutoConfiguration.java similarity index 87% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/MetricFilterAutoConfiguration.java index a7d6ef87151..1ff656bd446 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/MetricFilterAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.actuate.autoconfigure; import java.io.IOException; @@ -27,13 +27,13 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.springframework.actuate.metrics.CounterService; +import org.springframework.actuate.metrics.GaugeService; +import org.springframework.autoconfigure.AutoConfigureAfter; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.bootstrap.context.condition.ConditionalOnBean; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; @@ -83,7 +83,8 @@ public class MetricFilterAutoConfiguration { && (response instanceof HttpServletResponse)) { doFilter((HttpServletRequest) request, (HttpServletResponse) response, chain); - } else { + } + else { chain.doFilter(request, response); } } @@ -96,7 +97,8 @@ public class MetricFilterAutoConfiguration { stopWatch.start(); try { chain.doFilter(request, response); - } finally { + } + finally { stopWatch.stop(); String gaugeKey = getKey("response" + suffix); MetricFilterAutoConfiguration.this.gaugeService.set(gaugeKey, @@ -109,7 +111,8 @@ public class MetricFilterAutoConfiguration { private int getStatus(HttpServletResponse response) { try { return response.getStatus(); - } catch (Exception e) { + } + catch (Exception ex) { return UNDEFINED_HTTP_STATUS; } } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java similarity index 66% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java index 5a369b10634..ae9132b1682 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.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.actuate.metrics.CounterService; +import org.springframework.actuate.metrics.DefaultCounterService; +import org.springframework.actuate.metrics.DefaultGaugeService; +import org.springframework.actuate.metrics.GaugeService; +import org.springframework.actuate.metrics.InMemoryMetricRepository; +import org.springframework.actuate.metrics.MetricRepository; +import org.springframework.autoconfigure.EnableAutoConfiguration; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/SecurityAutoConfiguration.java similarity index 91% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/SecurityAutoConfiguration.java index e232eccc3ed..9a3ad6b6bbe 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/SecurityAutoConfiguration.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.actuate.autoconfigure; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.springframework.actuate.endpoint.Endpoint; +import org.springframework.actuate.endpoint.mvc.EndpointHandlerMapping; +import org.springframework.actuate.properties.SecurityProperties; +import org.springframework.actuate.web.ErrorController; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; @@ -84,7 +84,7 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationEn @EnableConfigurationProperties public class SecurityAutoConfiguration { - @Bean(name = "org.springframework.bootstrap.actuate.properties.SecurityProperties") + @Bean(name = "org.springframework.actuate.properties.SecurityProperties") @ConditionalOnMissingBean public SecurityProperties securityProperties() { return new SecurityProperties(); diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java similarity index 74% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java index 7375df5792f..bedc829059f 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.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.actuate.trace.InMemoryTraceRepository; +import org.springframework.actuate.trace.TraceRepository; +import org.springframework.autoconfigure.EnableAutoConfiguration; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java similarity index 78% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java index 1c79e2b234c..81efc9ed0e0 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java @@ -13,18 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; + +package org.springframework.actuate.autoconfigure; import javax.servlet.Servlet; +import org.springframework.actuate.trace.TraceRepository; +import org.springframework.actuate.trace.WebRequestTraceFilter; +import org.springframework.autoconfigure.AutoConfigureAfter; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.bootstrap.context.condition.ConditionalOnClass; import org.springframework.context.annotation.Bean; import org.springframework.web.servlet.DispatcherServlet; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/AbstractEndpoint.java similarity index 96% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/AbstractEndpoint.java index 4d4030d12e5..86bb2d551d0 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/AbstractEndpoint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/ActionEndpoint.java similarity index 93% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/ActionEndpoint.java index f82aa338ec9..2c7139de7b1 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ActionEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/ActionEndpoint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; /** * Tagging interface used to indicate that {@link Endpoint} that performs some action. diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/BeansEndpoint.java similarity index 94% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/BeansEndpoint.java index 922c7a0ce30..c71b513e0ca 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/BeansEndpoint.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import org.springframework.beans.BeansException; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.support.LiveBeansView; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/DumpEndpoint.java similarity index 91% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/DumpEndpoint.java index 887bc10fbc3..754c2078f3f 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/DumpEndpoint.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.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; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; /** * {@link Endpoint} to expose thread info. diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/Endpoint.java similarity index 96% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/Endpoint.java index ada04a4f66e..a1770d22248 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/Endpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/Endpoint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import org.springframework.http.MediaType; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/EnvironmentEndpoint.java similarity index 95% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/EnvironmentEndpoint.java index ab948c7caf6..42e09427a6a 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/EnvironmentEndpoint.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import java.util.LinkedHashMap; import java.util.Map; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; import org.springframework.context.EnvironmentAware; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.EnumerablePropertySource; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/HealthEndpoint.java similarity index 87% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/HealthEndpoint.java index 122cc9f6589..0da4f1e6b3e 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/HealthEndpoint.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; -import org.springframework.bootstrap.actuate.health.HealthIndicator; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; +import org.springframework.actuate.health.HealthIndicator; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; import org.springframework.util.Assert; /** diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/InfoEndpoint.java similarity index 92% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/InfoEndpoint.java index c2a3e81f355..701dd82e35c 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/InfoEndpoint.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; import org.springframework.util.Assert; /** diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/MetricsEndpoint.java similarity index 89% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/MetricsEndpoint.java index 3af5cfa7965..508fa696077 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/MetricsEndpoint.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.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.actuate.metrics.Metric; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; import org.springframework.util.Assert; /** diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/PublicMetrics.java similarity index 88% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/PublicMetrics.java index c99b624ee2f..72836aef623 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/PublicMetrics.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/PublicMetrics.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import java.util.Collection; -import org.springframework.bootstrap.actuate.metrics.Metric; +import org.springframework.actuate.metrics.Metric; /** * Interface to expose specific {@link Metric}s via a {@link MetricsEndpoint}. diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/ShutdownEndpoint.java similarity index 89% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/ShutdownEndpoint.java index e57f4208c3b..7a10b7684e0 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/ShutdownEndpoint.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import java.util.Collections; import java.util.Map; +import org.springframework.actuate.properties.ManagementServerProperties; 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.bootstrap.context.properties.ConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ConfigurableApplicationContext; @@ -61,7 +61,9 @@ public class ShutdownEndpoint extends AbstractEndpoint> impl public void run() { try { Thread.sleep(500L); - } catch (InterruptedException e) { + } + catch (InterruptedException ex) { + // Swallow exception and continue } ShutdownEndpoint.this.context.close(); } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/TraceEndpoint.java similarity index 84% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/TraceEndpoint.java index 632cd6e3b73..3fdbc9acbbd 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpoint.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/TraceEndpoint.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.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.actuate.trace.Trace; +import org.springframework.actuate.trace.TraceRepository; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; import org.springframework.util.Assert; /** diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/VanillaPublicMetrics.java similarity index 89% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/VanillaPublicMetrics.java index a7c81471507..44fcf1f0715 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetrics.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/VanillaPublicMetrics.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.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.actuate.metrics.Metric; +import org.springframework.actuate.metrics.MetricRepository; import org.springframework.util.Assert; /** diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerAdapter.java similarity index 94% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerAdapter.java index e75e16e3de1..c7984ae2b45 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapter.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerAdapter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint.mvc; +package org.springframework.actuate.endpoint.mvc; import java.util.ArrayList; import java.util.Arrays; @@ -28,7 +28,7 @@ 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.actuate.endpoint.Endpoint; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; @@ -50,9 +50,9 @@ import com.fasterxml.jackson.databind.SerializationFeature; * @author Phillip Webb * @see EndpointHandlerMapping */ -public class EndpointHandlerAdapter implements HandlerAdapter { +public final class EndpointHandlerAdapter implements HandlerAdapter { - private static final Log logger = LogFactory.getLog(EndpointHandlerAdapter.class); + private final Log logger = LogFactory.getLog(getClass()); private static final MediaType MEDIA_TYPE_APPLICATION = new MediaType("application"); @@ -102,8 +102,8 @@ public class EndpointHandlerAdapter implements HandlerAdapter { if (messageConverter.canWrite(resultClass, selectedMediaType)) { ((HttpMessageConverter) messageConverter).write(result, selectedMediaType, outputMessage); - if (logger.isDebugEnabled()) { - logger.debug("Written [" + result + "] as \"" + if (this.logger.isDebugEnabled()) { + this.logger.debug("Written [" + result + "] as \"" + selectedMediaType + "\" using [" + messageConverter + "]"); } @@ -112,7 +112,8 @@ public class EndpointHandlerAdapter implements HandlerAdapter { } } throw new HttpMediaTypeNotAcceptableException(this.allSupportedMediaTypes); - } finally { + } + finally { outputMessage.close(); } } @@ -179,7 +180,8 @@ public class EndpointHandlerAdapter implements HandlerAdapter { if (mediaType.isConcrete()) { selectedMediaType = mediaType; break; - } else if (mediaType.equals(MediaType.ALL) + } + else if (mediaType.equals(MediaType.ALL) || mediaType.equals(MEDIA_TYPE_APPLICATION)) { selectedMediaType = MediaType.APPLICATION_OCTET_STREAM; break; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerMapping.java similarity index 95% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java rename to spring-actuator/src/main/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerMapping.java index 4af570b19cb..b37634c9941 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMapping.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerMapping.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint.mvc; + +package org.springframework.actuate.endpoint.mvc; import java.util.ArrayList; import java.util.Collection; @@ -22,10 +23,10 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; +import org.springframework.actuate.endpoint.ActionEndpoint; +import org.springframework.actuate.endpoint.Endpoint; 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; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java b/spring-actuator/src/main/java/org/springframework/actuate/fixme/ManagementServerConfiguration.java similarity index 93% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java rename to spring-actuator/src/main/java/org/springframework/actuate/fixme/ManagementServerConfiguration.java index 55d86a25f68..bfcd5a159d6 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/fixme/ManagementServerConfiguration.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/fixme/ManagementServerConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.fixme; +package org.springframework.actuate.fixme; import java.io.IOException; @@ -24,14 +24,14 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; +import org.springframework.actuate.properties.ManagementServerProperties; +import org.springframework.actuate.web.BasicErrorController; 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.condition.ConditionalOnBean; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java b/spring-actuator/src/main/java/org/springframework/actuate/health/HealthIndicator.java similarity index 94% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java rename to spring-actuator/src/main/java/org/springframework/actuate/health/HealthIndicator.java index cfddd81751f..11e85dd672d 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/HealthIndicator.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/health/HealthIndicator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.health; +package org.springframework.actuate.health; /** * Strategy interface used to provide an indication of application health. diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java b/spring-actuator/src/main/java/org/springframework/actuate/health/VanillaHealthIndicator.java similarity index 94% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java rename to spring-actuator/src/main/java/org/springframework/actuate/health/VanillaHealthIndicator.java index afb22b9e914..968a6249a9a 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicator.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/health/VanillaHealthIndicator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.health; +package org.springframework.actuate.health; /** * Default implementation of {@link HealthIndicator} that simply returns "ok". diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java b/spring-actuator/src/main/java/org/springframework/actuate/metrics/CounterService.java similarity index 95% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java rename to spring-actuator/src/main/java/org/springframework/actuate/metrics/CounterService.java index 767161dd049..a42d0012665 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/CounterService.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/metrics/CounterService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; /** * A service that can be used to increment, decrement and reset a {@link Metric}. diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java b/spring-actuator/src/main/java/org/springframework/actuate/metrics/DefaultCounterService.java similarity index 95% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java rename to spring-actuator/src/main/java/org/springframework/actuate/metrics/DefaultCounterService.java index 905c313d84e..973dd0b54fa 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterService.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/metrics/DefaultCounterService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; import java.util.Date; @@ -54,7 +54,8 @@ public class DefaultCounterService implements CounterService { private String wrap(String metricName) { if (metricName.startsWith("counter")) { return metricName; - } else { + } + else { return "counter." + metricName; } } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java b/spring-actuator/src/main/java/org/springframework/actuate/metrics/DefaultGaugeService.java similarity index 95% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java rename to spring-actuator/src/main/java/org/springframework/actuate/metrics/DefaultGaugeService.java index 139afb28f91..39cb28733da 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeService.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/metrics/DefaultGaugeService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; import java.util.Date; @@ -43,7 +43,8 @@ public class DefaultGaugeService implements GaugeService { private String wrap(String metricName) { if (metricName.startsWith("gauge")) { return metricName; - } else { + } + else { return "gauge." + metricName; } } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java b/spring-actuator/src/main/java/org/springframework/actuate/metrics/GaugeService.java similarity index 94% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java rename to spring-actuator/src/main/java/org/springframework/actuate/metrics/GaugeService.java index 801ef8ef95b..c682a2c9a48 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/GaugeService.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/metrics/GaugeService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; /** * A service that can be used to manage a {@link Metric} as a gauge. diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java b/spring-actuator/src/main/java/org/springframework/actuate/metrics/InMemoryMetricRepository.java similarity index 96% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java rename to spring-actuator/src/main/java/org/springframework/actuate/metrics/InMemoryMetricRepository.java index 3fe196cbf70..7480b479865 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepository.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/metrics/InMemoryMetricRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; import java.util.ArrayList; import java.util.Collection; @@ -37,7 +37,8 @@ public class InMemoryMetricRepository implements MetricRepository { Metric metric = current.getMetric(); this.metrics.replace(metricName, current, new Measurement(timestamp, metric.increment(amount))); - } else { + } + else { this.metrics.putIfAbsent(metricName, new Measurement(timestamp, new Metric( metricName, amount))); } @@ -50,7 +51,8 @@ public class InMemoryMetricRepository implements MetricRepository { Metric metric = current.getMetric(); this.metrics.replace(metricName, current, new Measurement(timestamp, metric.set(value))); - } else { + } + else { this.metrics.putIfAbsent(metricName, new Measurement(timestamp, new Metric( metricName, value))); } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java b/spring-actuator/src/main/java/org/springframework/actuate/metrics/Measurement.java similarity index 97% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java rename to spring-actuator/src/main/java/org/springframework/actuate/metrics/Measurement.java index 5401927f774..653707da9ef 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Measurement.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/metrics/Measurement.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; import java.util.Date; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java b/spring-actuator/src/main/java/org/springframework/actuate/metrics/Metric.java similarity index 98% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java rename to spring-actuator/src/main/java/org/springframework/actuate/metrics/Metric.java index f92cbb3d9ea..2250a3f9a1b 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/Metric.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/metrics/Metric.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java b/spring-actuator/src/main/java/org/springframework/actuate/metrics/MetricRepository.java similarity index 95% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java rename to spring-actuator/src/main/java/org/springframework/actuate/metrics/MetricRepository.java index 6a54b893a79..291cc13b29b 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/metrics/MetricRepository.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/metrics/MetricRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; import java.util.Collection; import java.util.Date; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java b/spring-actuator/src/main/java/org/springframework/actuate/properties/ManagementServerProperties.java similarity index 91% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java rename to spring-actuator/src/main/java/org/springframework/actuate/properties/ManagementServerProperties.java index 6d6ac346dfa..86429bbd01e 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/properties/ManagementServerProperties.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.properties; +package org.springframework.actuate.properties; import java.net.InetAddress; import javax.validation.constraints.NotNull; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.bootstrap.properties.ServerProperties; +import org.springframework.bootstrap.context.embedded.properties.ServerProperties; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; /** * Properties for the management server (e.g. port and path settings). diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java b/spring-actuator/src/main/java/org/springframework/actuate/properties/SecurityProperties.java similarity index 95% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java rename to spring-actuator/src/main/java/org/springframework/actuate/properties/SecurityProperties.java index 1ea56222c41..ca866889a6c 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/SecurityProperties.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/properties/SecurityProperties.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.properties; +package org.springframework.actuate.properties; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; import org.springframework.security.config.annotation.web.configurers.SessionCreationPolicy; /** diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java b/spring-actuator/src/main/java/org/springframework/actuate/security/AuthenticationAuditListener.java similarity index 92% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java rename to spring-actuator/src/main/java/org/springframework/actuate/security/AuthenticationAuditListener.java index 26e4431cc85..ecf10b7bd2c 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListener.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/security/AuthenticationAuditListener.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.security; +package org.springframework.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.actuate.audit.AuditEvent; +import org.springframework.actuate.audit.listener.AuditApplicationEvent; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.context.ApplicationListener; @@ -48,9 +48,11 @@ public class AuthenticationAuditListener implements public void onApplicationEvent(AbstractAuthenticationEvent event) { if (event instanceof AbstractAuthenticationFailureEvent) { onAuthenticationFailureEvent((AbstractAuthenticationFailureEvent) event); - } else if (event instanceof AuthenticationSwitchUserEvent) { + } + else if (event instanceof AuthenticationSwitchUserEvent) { onAuthenticationSwitchUserEvent((AuthenticationSwitchUserEvent) event); - } else { + } + else { onAuthenticationEvent(event); } } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java b/spring-actuator/src/main/java/org/springframework/actuate/security/AuthorizationAuditListener.java similarity index 91% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java rename to spring-actuator/src/main/java/org/springframework/actuate/security/AuthorizationAuditListener.java index 816d384bcb5..f0df73c7bb5 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListener.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/security/AuthorizationAuditListener.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.security; +package org.springframework.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.actuate.audit.AuditEvent; +import org.springframework.actuate.audit.listener.AuditApplicationEvent; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.context.ApplicationListener; @@ -48,7 +48,8 @@ public class AuthorizationAuditListener implements public void onApplicationEvent(AbstractAuthorizationEvent event) { if (event instanceof AuthenticationCredentialsNotFoundEvent) { onAuthenticationCredentialsNotFoundEvent((AuthenticationCredentialsNotFoundEvent) event); - } else if (event instanceof AuthorizationFailureEvent) { + } + else if (event instanceof AuthorizationFailureEvent) { onAuthorizationFailureEvent((AuthorizationFailureEvent) event); } } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java b/spring-actuator/src/main/java/org/springframework/actuate/trace/InMemoryTraceRepository.java similarity index 96% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java rename to spring-actuator/src/main/java/org/springframework/actuate/trace/InMemoryTraceRepository.java index 7e4e71fe67b..16b3aa61c5b 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepository.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/trace/InMemoryTraceRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.trace; +package org.springframework.actuate.trace; import java.util.ArrayList; import java.util.Collections; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java b/spring-actuator/src/main/java/org/springframework/actuate/trace/Trace.java similarity index 96% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java rename to spring-actuator/src/main/java/org/springframework/actuate/trace/Trace.java index 4f211420044..bfa9951e9c3 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/Trace.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/trace/Trace.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.trace; +package org.springframework.actuate.trace; import java.util.Date; import java.util.Map; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java b/spring-actuator/src/main/java/org/springframework/actuate/trace/TraceRepository.java similarity index 95% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java rename to spring-actuator/src/main/java/org/springframework/actuate/trace/TraceRepository.java index 78d8f189eb2..eb93239c770 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/TraceRepository.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/trace/TraceRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.trace; +package org.springframework.actuate.trace; import java.util.List; import java.util.Map; diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java b/spring-actuator/src/main/java/org/springframework/actuate/trace/WebRequestTraceFilter.java similarity index 92% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java rename to spring-actuator/src/main/java/org/springframework/actuate/trace/WebRequestTraceFilter.java index e1c893ce970..d3543cefa5f 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilter.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/trace/WebRequestTraceFilter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.trace; +package org.springframework.actuate.trace; import java.io.IOException; import java.util.Collections; @@ -46,7 +46,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; */ public class WebRequestTraceFilter implements Filter, Ordered { - final Log logger = LogFactory.getLog(WebRequestTraceFilter.class); + private final Log logger = LogFactory.getLog(WebRequestTraceFilter.class); private boolean dumpRequests = false; @@ -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; @@ -100,8 +101,9 @@ public class WebRequestTraceFilter implements Filter, Ordered { .get("headers"); this.logger.trace("Headers: " + this.objectMapper.writeValueAsString(headers)); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Cannot create JSON", e); + } + catch (JsonProcessingException ex) { + throw new IllegalStateException("Cannot create JSON", ex); } } } @@ -120,7 +122,8 @@ public class WebRequestTraceFilter implements Filter, Ordered { Object value = values; if (values.size() == 1) { value = values.get(0); - } else if (values.isEmpty()) { + } + else if (values.isEmpty()) { value = ""; } map.put(name, value); @@ -133,9 +136,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-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java b/spring-actuator/src/main/java/org/springframework/actuate/web/BasicErrorController.java similarity index 89% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java rename to spring-actuator/src/main/java/org/springframework/actuate/web/BasicErrorController.java index 2497ec58bd9..5929cae533f 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/BasicErrorController.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/web/BasicErrorController.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.web; +package org.springframework.actuate.web; import java.io.PrintWriter; import java.io.StringWriter; @@ -47,6 +47,8 @@ import org.springframework.web.servlet.ModelAndView; @Controller public class BasicErrorController implements ErrorController { + private static final String ERROR_KEY = "error"; + private Log logger = LogFactory.getLog(BasicErrorController.class); @Value("${error.path:/error}") @@ -60,7 +62,7 @@ public class BasicErrorController implements ErrorController { @RequestMapping(value = "${error.path:/error}", produces = "text/html") public ModelAndView errorHtml(HttpServletRequest request) { Map map = error(request); - return new ModelAndView("error", map); + return new ModelAndView(ERROR_KEY, map); } @RequestMapping(value = "${error.path:/error}") @@ -75,9 +77,10 @@ public class BasicErrorController implements ErrorController { int status = 999; if (obj != null) { status = (Integer) obj; - map.put("error", HttpStatus.valueOf(status).getReasonPhrase()); - } else { - map.put("error", "None"); + map.put(ERROR_KEY, HttpStatus.valueOf(status).getReasonPhrase()); + } + else { + map.put(ERROR_KEY, "None"); } map.put("status", status); if (error != null) { @@ -94,15 +97,17 @@ public class BasicErrorController implements ErrorController { map.put("trace", stackTrace.toString()); } this.logger.error(error); - } else { + } + 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); + } + catch (Exception ex) { + map.put(ERROR_KEY, ex.getClass().getName()); + map.put("message", ex.getMessage()); + this.logger.error(ex); return map; } } diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java b/spring-actuator/src/main/java/org/springframework/actuate/web/ErrorController.java similarity index 94% rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java rename to spring-actuator/src/main/java/org/springframework/actuate/web/ErrorController.java index d7f3973c5c7..f9952eb41ad 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/web/ErrorController.java +++ b/spring-actuator/src/main/java/org/springframework/actuate/web/ErrorController.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.web; +package org.springframework.actuate.web; import org.springframework.stereotype.Controller; diff --git a/spring-actuator/src/main/resources/META-INF/spring.factories b/spring-actuator/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000000..0c8c1c617e8 --- /dev/null +++ b/spring-actuator/src/main/resources/META-INF/spring.factories @@ -0,0 +1,11 @@ +org.springframework.autoconfigure.EnableAutoConfiguration=\ +org.springframework.actuate.autoconfigure.AuditAutoConfiguration,\ +org.springframework.actuate.autoconfigure.EndpointAutoConfiguration,\ +org.springframework.actuate.autoconfigure.EndpointWebMvcAutoConfiguration,\ +org.springframework.actuate.autoconfigure.ErrorMvcAutoConfiguration,\ +org.springframework.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration,\ +org.springframework.actuate.autoconfigure.MetricFilterAutoConfiguration,\ +org.springframework.actuate.autoconfigure.MetricRepositoryAutoConfiguration,\ +org.springframework.actuate.autoconfigure.SecurityAutoConfiguration,\ +org.springframework.actuate.autoconfigure.TraceRepositoryAutoConfiguration,\ +org.springframework.actuate.autoconfigure.TraceWebFilterAutoConfiguration diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java b/spring-actuator/src/test/java/org/springframework/actuate/audit/AuditEventTests.java similarity index 93% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/audit/AuditEventTests.java index 362ef5773b1..114adff90e3 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/AuditEventTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/audit/AuditEventTests.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.audit; +package org.springframework.actuate.audit; import java.util.Collections; import org.junit.Test; +import org.springframework.actuate.audit.AuditEvent; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java b/spring-actuator/src/test/java/org/springframework/actuate/audit/InMemoryAuditEventRepositoryTests.java similarity index 89% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/audit/InMemoryAuditEventRepositoryTests.java index efc7b0f9a03..f35d85aee14 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/InMemoryAuditEventRepositoryTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/audit/InMemoryAuditEventRepositoryTests.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.audit; +package org.springframework.actuate.audit; import java.util.Date; import org.junit.Test; +import org.springframework.actuate.audit.AuditEvent; +import org.springframework.actuate.audit.InMemoryAuditEventRepository; import static org.junit.Assert.assertEquals; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java b/spring-actuator/src/test/java/org/springframework/actuate/audit/listener/AuditListenerTests.java similarity index 80% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/audit/listener/AuditListenerTests.java index 5c63c2ab947..5ffdba06503 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/audit/listener/AuditListenerTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/audit/listener/AuditListenerTests.java @@ -13,13 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.actuate.audit.listener; + +package org.springframework.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 org.springframework.actuate.audit.AuditEvent; +import org.springframework.actuate.audit.AuditEventRepository; +import org.springframework.actuate.audit.listener.AuditApplicationEvent; +import org.springframework.actuate.audit.listener.AuditListener; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/AuditAutoConfigurationTests.java similarity index 84% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/AuditAutoConfigurationTests.java index ffaeaf12a11..9718dc805bb 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/AuditAutoConfigurationTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/AuditAutoConfigurationTests.java @@ -14,13 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.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.actuate.audit.AuditEventRepository; +import org.springframework.actuate.audit.InMemoryAuditEventRepository; +import org.springframework.actuate.autoconfigure.AuditAutoConfiguration; +import org.springframework.actuate.security.AuthenticationAuditListener; +import org.springframework.actuate.security.AuthorizationAuditListener; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/EndpointAutoConfigurationTests.java similarity index 80% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/EndpointAutoConfigurationTests.java index 0d1885f6055..debfb531fc5 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointAutoConfigurationTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/EndpointAutoConfigurationTests.java @@ -13,19 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; + +package org.springframework.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.actuate.autoconfigure.EndpointAutoConfiguration; +import org.springframework.actuate.endpoint.BeansEndpoint; +import org.springframework.actuate.endpoint.DumpEndpoint; +import org.springframework.actuate.endpoint.EnvironmentEndpoint; +import org.springframework.actuate.endpoint.HealthEndpoint; +import org.springframework.actuate.endpoint.InfoEndpoint; +import org.springframework.actuate.endpoint.MetricsEndpoint; +import org.springframework.actuate.endpoint.ShutdownEndpoint; +import org.springframework.actuate.endpoint.TraceEndpoint; +import org.springframework.bootstrap.TestUtils; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import static org.junit.Assert.assertEquals; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java similarity index 89% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java index 093ef5681a0..66d3862a7f2 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; + +package org.springframework.actuate.autoconfigure; import java.io.FileNotFoundException; import java.net.SocketException; @@ -22,14 +23,16 @@ 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.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; +import org.springframework.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration; +import org.springframework.actuate.endpoint.AbstractEndpoint; +import org.springframework.actuate.endpoint.Endpoint; +import org.springframework.actuate.properties.ManagementServerProperties; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.autoconfigure.web.ServerPropertiesAutoConfiguration; +import org.springframework.autoconfigure.web.WebMvcAutoConfiguration; +import org.springframework.bootstrap.TestUtils; import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -59,7 +62,8 @@ public class EndpointWebMvcAutoConfigurationTests { public void close() { try { this.applicationContext.close(); - } catch (Exception ex) { + } + catch (Exception ex) { } } @@ -166,10 +170,12 @@ public class EndpointWebMvcAutoConfigurationTests { String actual = StreamUtils.copyToString(response.getBody(), Charset.forName("UTF-8")); assertThat(actual, equalTo(expected)); - } finally { + } + finally { response.close(); } - } catch (Exception ex) { + } + catch (Exception ex) { if (expected == null) { if (SocketException.class.isInstance(ex) || FileNotFoundException.class.isInstance(ex)) { diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java similarity index 90% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java index 55182f6a5a5..65893ef8e97 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java @@ -13,10 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; + +package org.springframework.actuate.autoconfigure; import org.junit.Test; -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; +import org.springframework.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration; +import org.springframework.actuate.properties.ManagementServerProperties; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java similarity index 92% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java index ea880547724..cec7a2cd99e 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.actuate.autoconfigure; import javax.servlet.Filter; import javax.servlet.FilterChain; @@ -22,8 +22,9 @@ 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.actuate.autoconfigure.MetricFilterAutoConfiguration; +import org.springframework.actuate.metrics.CounterService; +import org.springframework.actuate.metrics.GaugeService; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java similarity index 84% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java index 733f98a2698..672d4a69e92 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/MetricRepositoryAutoConfigurationTests.java @@ -14,13 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.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.actuate.autoconfigure.MetricRepositoryAutoConfiguration; +import org.springframework.actuate.metrics.CounterService; +import org.springframework.actuate.metrics.DefaultCounterService; +import org.springframework.actuate.metrics.DefaultGaugeService; +import org.springframework.actuate.metrics.GaugeService; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/SecurityAutoConfigurationTests.java similarity index 91% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/SecurityAutoConfigurationTests.java index 11633cf97ff..1a82a5d4568 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/SecurityAutoConfigurationTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/SecurityAutoConfigurationTests.java @@ -14,10 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.actuate.autoconfigure; import org.junit.Test; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.actuate.autoconfigure.EndpointAutoConfiguration; +import org.springframework.actuate.autoconfigure.SecurityAutoConfiguration; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.mock.web.MockServletContext; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java similarity index 88% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java index 81439201cb0..fb4f41f0277 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/TraceRepositoryAutoConfigurationTests.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.actuate.autoconfigure; import org.junit.Test; -import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository; -import org.springframework.bootstrap.actuate.trace.TraceRepository; +import org.springframework.actuate.autoconfigure.TraceRepositoryAutoConfiguration; +import org.springframework.actuate.trace.InMemoryTraceRepository; +import org.springframework.actuate.trace.TraceRepository; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java similarity index 77% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java rename to spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java index ec2cb178d00..6dca0c1a765 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/autoconfigure/TraceWebFilterAutoConfigurationTest.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.autoconfigure; +package org.springframework.actuate.autoconfigure; import org.junit.Test; -import org.springframework.bootstrap.actuate.trace.WebRequestTraceFilter; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.actuate.autoconfigure.TraceRepositoryAutoConfiguration; +import org.springframework.actuate.autoconfigure.TraceWebFilterAutoConfiguration; +import org.springframework.actuate.trace.WebRequestTraceFilter; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import static org.junit.Assert.assertNotNull; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/AbstractEndpointTests.java similarity index 95% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/AbstractEndpointTests.java index c3389cfb5db..080b1763545 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/AbstractEndpointTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/AbstractEndpointTests.java @@ -14,13 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import java.util.Collections; import org.junit.Before; import org.junit.Test; -import org.springframework.bootstrap.actuate.TestUtils; +import org.springframework.actuate.endpoint.Endpoint; +import org.springframework.bootstrap.TestUtils; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.PropertySource; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/BeansEndpointTests.java similarity index 89% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/BeansEndpointTests.java index 8f0844c5b6a..deda3e4afeb 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/BeansEndpointTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/BeansEndpointTests.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import org.junit.Test; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; +import org.springframework.actuate.endpoint.BeansEndpoint; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/DumpEndpointTests.java similarity index 90% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/DumpEndpointTests.java index 70696b8dabc..481ab9fc7ef 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/DumpEndpointTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/DumpEndpointTests.java @@ -14,13 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.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.actuate.endpoint.DumpEndpoint; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/EnvironmentEndpointTests.java similarity index 89% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/EnvironmentEndpointTests.java index 59b9d7b8a1a..f4cf456cbb5 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/EnvironmentEndpointTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/EnvironmentEndpointTests.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import org.junit.Test; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; +import org.springframework.actuate.endpoint.EnvironmentEndpoint; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/HealthEndpointTests.java similarity index 87% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/HealthEndpointTests.java index ed580a2e842..42c9d655a67 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/HealthEndpointTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/HealthEndpointTests.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import org.junit.Test; -import org.springframework.bootstrap.actuate.health.HealthIndicator; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; +import org.springframework.actuate.endpoint.HealthEndpoint; +import org.springframework.actuate.health.HealthIndicator; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/InfoEndpointTests.java similarity index 89% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/InfoEndpointTests.java index 2f1c153a9dc..955331a031e 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/InfoEndpointTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/InfoEndpointTests.java @@ -14,12 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import java.util.Collections; import org.junit.Test; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; +import org.springframework.actuate.endpoint.InfoEndpoint; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/MetricsEndpointTests.java similarity index 85% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/MetricsEndpointTests.java index a85d4bde297..aae788d7346 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/MetricsEndpointTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/MetricsEndpointTests.java @@ -14,14 +14,16 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.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.actuate.endpoint.MetricsEndpoint; +import org.springframework.actuate.endpoint.PublicMetrics; +import org.springframework.actuate.metrics.Metric; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/ShutdownEndpointTests.java similarity index 88% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/ShutdownEndpointTests.java index ce01c52d3c8..babc5507cd7 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/ShutdownEndpointTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/ShutdownEndpointTests.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.actuate.endpoint; import org.junit.Test; -import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; +import org.springframework.actuate.endpoint.ShutdownEndpoint; +import org.springframework.actuate.properties.ManagementServerProperties; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/TraceEndpointTests.java similarity index 82% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/TraceEndpointTests.java index e470fa3d89a..092cbb5b1a2 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/TraceEndpointTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/TraceEndpointTests.java @@ -14,15 +14,16 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.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.actuate.endpoint.TraceEndpoint; +import org.springframework.actuate.trace.InMemoryTraceRepository; +import org.springframework.actuate.trace.Trace; +import org.springframework.actuate.trace.TraceRepository; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/VanillaPublicMetricsTests.java similarity index 86% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/VanillaPublicMetricsTests.java index faef1645dba..dcada6d2ca1 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/VanillaPublicMetricsTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/VanillaPublicMetricsTests.java @@ -14,15 +14,16 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint; +package org.springframework.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 org.springframework.actuate.endpoint.VanillaPublicMetrics; +import org.springframework.actuate.metrics.InMemoryMetricRepository; +import org.springframework.actuate.metrics.Metric; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java similarity index 86% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java index de9408d4acb..4d0e3d3736a 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerAdapterTests.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint.mvc; +package org.springframework.actuate.endpoint.mvc; import org.junit.Test; -import org.springframework.bootstrap.actuate.endpoint.Endpoint; +import org.springframework.actuate.endpoint.Endpoint; +import org.springframework.actuate.endpoint.mvc.EndpointHandlerAdapter; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerMappingTests.java similarity index 94% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerMappingTests.java index 0ed37e4739c..7f2012467e0 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/endpoint/mvc/EndpointHandlerMappingTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/endpoint/mvc/EndpointHandlerMappingTests.java @@ -14,13 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.endpoint.mvc; +package org.springframework.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.actuate.endpoint.AbstractEndpoint; +import org.springframework.actuate.endpoint.ActionEndpoint; +import org.springframework.actuate.endpoint.mvc.EndpointHandlerMapping; import org.springframework.mock.web.MockHttpServletRequest; import static org.hamcrest.Matchers.equalTo; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java b/spring-actuator/src/test/java/org/springframework/actuate/fixme/ErrorConfigurationTests.java similarity index 96% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/fixme/ErrorConfigurationTests.java index 64461112ca6..069572ffae1 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/fixme/ErrorConfigurationTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/fixme/ErrorConfigurationTests.java @@ -14,8 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.fixme; - +package org.springframework.actuate.fixme; /** * @author Dave Syer diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java b/spring-actuator/src/test/java/org/springframework/actuate/health/VanillaHealthIndicatorTests.java similarity index 90% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/health/VanillaHealthIndicatorTests.java index 780d3032e9e..bb028061046 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/health/VanillaHealthIndicatorTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/health/VanillaHealthIndicatorTests.java @@ -14,9 +14,10 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.health; +package org.springframework.actuate.health; import org.junit.Test; +import org.springframework.actuate.health.VanillaHealthIndicator; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java b/spring-actuator/src/test/java/org/springframework/actuate/metrics/DefaultCounterServiceTests.java similarity index 88% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/metrics/DefaultCounterServiceTests.java index b50b297650f..096cd82772e 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultCounterServiceTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/metrics/DefaultCounterServiceTests.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; import org.junit.Ignore; import org.junit.Test; +import org.springframework.actuate.metrics.DefaultCounterService; import static org.junit.Assert.fail; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java b/spring-actuator/src/test/java/org/springframework/actuate/metrics/DefaultGaugeServiceTests.java similarity index 89% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/metrics/DefaultGaugeServiceTests.java index 460a894edc9..11a83466ba6 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/DefaultGaugeServiceTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/metrics/DefaultGaugeServiceTests.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; +package org.springframework.actuate.metrics; import org.junit.Ignore; import org.junit.Test; +import org.springframework.actuate.metrics.DefaultGaugeService; import static org.junit.Assert.fail; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java b/spring-actuator/src/test/java/org/springframework/actuate/metrics/InMemoryMetricRepositoryTests.java similarity index 89% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/metrics/InMemoryMetricRepositoryTests.java index abc06723a8b..bea311bea42 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/metrics/InMemoryMetricRepositoryTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/metrics/InMemoryMetricRepositoryTests.java @@ -13,10 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.actuate.metrics; + +package org.springframework.actuate.metrics; import org.junit.Ignore; import org.junit.Test; +import org.springframework.actuate.metrics.InMemoryMetricRepository; import static org.junit.Assert.fail; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java b/spring-actuator/src/test/java/org/springframework/actuate/properties/SecurityPropertiesTests.java similarity index 93% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/properties/SecurityPropertiesTests.java index dc9de4458b0..8f4bd1ba5f4 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/SecurityPropertiesTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/properties/SecurityPropertiesTests.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.properties; +package org.springframework.actuate.properties; import java.util.Collections; import org.junit.Test; +import org.springframework.actuate.properties.SecurityProperties; 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; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java b/spring-actuator/src/test/java/org/springframework/actuate/security/AuthenticationAuditListenerTests.java similarity index 88% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/security/AuthenticationAuditListenerTests.java index 84e67787acf..cf453a13835 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthenticationAuditListenerTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/security/AuthenticationAuditListenerTests.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.security; +package org.springframework.actuate.security; import org.junit.Ignore; import org.junit.Test; +import org.springframework.actuate.security.AuthenticationAuditListener; import static org.junit.Assert.fail; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java b/spring-actuator/src/test/java/org/springframework/actuate/security/AuthorizationAuditListenerTests.java similarity index 88% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/security/AuthorizationAuditListenerTests.java index a06b00998dc..5de62f12e52 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/security/AuthorizationAuditListenerTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/security/AuthorizationAuditListenerTests.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.security; +package org.springframework.actuate.security; import org.junit.Ignore; import org.junit.Test; +import org.springframework.actuate.security.AuthenticationAuditListener; import static org.junit.Assert.fail; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java b/spring-actuator/src/test/java/org/springframework/actuate/trace/InMemoryTraceRepositoryTests.java similarity index 89% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/trace/InMemoryTraceRepositoryTests.java index 6342c018d41..1b134e17fa8 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/InMemoryTraceRepositoryTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/trace/InMemoryTraceRepositoryTests.java @@ -14,12 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.trace; +package org.springframework.actuate.trace; import java.util.Collections; import java.util.List; import org.junit.Test; +import org.springframework.actuate.trace.InMemoryTraceRepository; +import org.springframework.actuate.trace.Trace; import static org.junit.Assert.assertEquals; diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java b/spring-actuator/src/test/java/org/springframework/actuate/trace/WebRequestTraceFilterTests.java similarity index 89% rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java rename to spring-actuator/src/test/java/org/springframework/actuate/trace/WebRequestTraceFilterTests.java index cc291b2896f..94abd500f88 100644 --- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/trace/WebRequestTraceFilterTests.java +++ b/spring-actuator/src/test/java/org/springframework/actuate/trace/WebRequestTraceFilterTests.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.actuate.trace; +package org.springframework.actuate.trace; import java.util.Map; import org.junit.Test; +import org.springframework.actuate.trace.InMemoryTraceRepository; +import org.springframework.actuate.trace.WebRequestTraceFilter; import org.springframework.mock.web.MockHttpServletRequest; import static org.junit.Assert.assertEquals; diff --git a/spring-bootstrap-actuator/src/test/resources/git.properties b/spring-actuator/src/test/resources/git.properties similarity index 100% rename from spring-bootstrap-actuator/src/test/resources/git.properties rename to spring-actuator/src/test/resources/git.properties diff --git a/spring-autoconfigure/pom.xml b/spring-autoconfigure/pom.xml new file mode 100644 index 00000000000..0f04f0543fe --- /dev/null +++ b/spring-autoconfigure/pom.xml @@ -0,0 +1,122 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero + 0.5.0.BUILD-SNAPSHOT + + spring-autoconfigure + jar + + ${basedir}/.. + + + + + ${project.groupId} + spring-bootstrap + ${project.version} + + + + commons-dbcp + commons-dbcp + true + + + nz.net.ultraq.web.thymeleaf + thymeleaf-layout-dialect + true + + + org.apache.tomcat.embed + tomcat-embed-core + true + + + org.apache.tomcat + tomcat-jdbc + true + + + org.eclipse.jetty + jetty-webapp + true + + + org.hibernate + hibernate-entitymanager + true + + + org.hibernate.javax.persistence + hibernate-jpa-2.0-api + true + + + org.springframework + spring-jdbc + true + + + org.springframework + spring-orm + true + + + org.springframework + spring-tx + true + + + org.springframework + spring-web + true + + + org.springframework + spring-webmvc + true + + + org.springframework.batch + spring-batch-core + true + + + org.springframework.data + spring-data-jpa + true + + + org.thymeleaf + thymeleaf + true + + + org.thymeleaf + thymeleaf-spring3 + true + + + + ${project.groupId} + spring-bootstrap + ${project.version} + tests + test + + + org.hsqldb + hsqldb + test + + + org.springframework + spring-test + test + + + diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/AutoConfigurationSorter.java similarity index 98% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/AutoConfigurationSorter.java index f3f2a71b0dd..6bb5e6c25bc 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorter.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/AutoConfigurationSorter.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; + +package org.springframework.autoconfigure; import java.io.IOException; import java.util.ArrayList; @@ -143,7 +144,8 @@ class AutoConfigurationSorter { if (this.after == null) { if (this.afterAnnotation == null) { this.after = Collections.emptyList(); - } else { + } + else { this.after = new ArrayList(); for (String afterClass : (String[]) this.afterAnnotation.get("value")) { this.after.add(new AutoConfigurationClass(afterClass)); diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/AutoConfigurationUtils.java similarity index 88% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/AutoConfigurationUtils.java index 567fec748ed..703237db73d 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/AutoConfigurationUtils.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/AutoConfigurationUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure; +package org.springframework.autoconfigure; import java.util.ArrayList; import java.util.Collections; @@ -28,19 +28,20 @@ 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 Phillip Webb * @author Dave Syer */ public abstract class AutoConfigurationUtils { - private static String BASE_PACKAGES_BEAN = AutoConfigurationUtils.class.getName() - + ".basePackages"; + private static final 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) { + } + catch (NoSuchBeanDefinitionException ex) { return Collections.emptyList(); } } @@ -50,7 +51,8 @@ public abstract class AutoConfigurationUtils { if (!beanFactory.containsBean(BASE_PACKAGES_BEAN)) { beanFactory.registerSingleton(BASE_PACKAGES_BEAN, new ArrayList( basePackages)); - } else { + } + else { List packages = getBasePackages(beanFactory); for (String pkg : basePackages) { if (packages.contains(pkg)) { diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/AutoConfigureAfter.java similarity index 94% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/AutoConfigureAfter.java index c5a0d8fee30..41262f74bc9 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AutoConfigureAfter.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/AutoConfigureAfter.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; + +package org.springframework.autoconfigure; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/ComponentScanDetector.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/ComponentScanDetector.java index 35eab37d5a1..6f4ce56f6b8 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ComponentScanDetector.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/ComponentScanDetector.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.autoconfigure; import java.io.IOException; import java.util.ArrayList; @@ -31,7 +31,6 @@ 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; @@ -70,7 +69,8 @@ class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactor private void storeComponentScanBasePackages() { if (this.beanFactory instanceof ConfigurableListableBeanFactory) { storeComponentScanBasePackages((ConfigurableListableBeanFactory) this.beanFactory); - } else { + } + else { if (this.logger.isWarnEnabled()) { this.logger .warn("Unable to read @ComponentScan annotations for auto-configure"); @@ -109,7 +109,8 @@ class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactor MetadataReader metadataReader = this.metadataReaderFactory .getMetadataReader(className); return metadataReader.getAnnotationMetadata(); - } catch (IOException ex) { + } + catch (IOException ex) { if (this.logger.isDebugEnabled()) { this.logger.debug( "Could not find class file for introspecting @ComponentScan classes: " diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/EnableAutoConfiguration.java similarity index 91% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/EnableAutoConfiguration.java index 47bce123717..ed0713e0d79 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/EnableAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.autoconfigure; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -22,6 +22,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.bootstrap.context.condition.ConditionalOnBean; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; import org.springframework.context.annotation.Conditional; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/EnableAutoConfigurationImportSelector.java similarity index 96% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/EnableAutoConfigurationImportSelector.java index 63a975cac58..2c8965038db 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableAutoConfigurationImportSelector.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/EnableAutoConfigurationImportSelector.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.autoconfigure; import java.io.IOException; import java.util.ArrayList; @@ -69,7 +69,8 @@ class EnableAutoConfigurationImportSelector implements DeferredImportSelector, factories.add(0, ComponentScanDetector.class.getName()); return factories.toArray(new String[factories.size()]); - } catch (IOException ex) { + } + catch (IOException ex) { throw new IllegalStateException(ex); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/MessageSourceAutoConfiguration.java similarity index 87% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/MessageSourceAutoConfiguration.java index 30b3ad72c04..08614955196 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/MessageSourceAutoConfiguration.java @@ -14,11 +14,10 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure; +package org.springframework.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.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/PropertyPlaceholderAutoConfiguration.java similarity index 87% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/PropertyPlaceholderAutoConfiguration.java index ea5a556ac96..130ea022015 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/PropertyPlaceholderAutoConfiguration.java @@ -14,10 +14,9 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure; +package org.springframework.autoconfigure; -import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/BatchAutoConfiguration.java similarity index 82% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/BatchAutoConfiguration.java index f7e5860c44e..caf7921571d 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/BatchAutoConfiguration.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.batch; +package org.springframework.autoconfigure.batch; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.bootstrap.context.condition.ConditionalOnBean; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/BatchDatabaseInitializer.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/BatchDatabaseInitializer.java index f79a2780167..2f1a89247c0 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/BatchDatabaseInitializer.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/BatchDatabaseInitializer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.batch; +package org.springframework.autoconfigure.batch; import javax.annotation.PostConstruct; import javax.sql.DataSource; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/JobExecutionEvent.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/JobExecutionEvent.java index 332746e8d1a..45de40a4322 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionEvent.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/JobExecutionEvent.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.batch; +package org.springframework.autoconfigure.batch; import org.springframework.batch.core.JobExecution; import org.springframework.context.ApplicationEvent; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/JobExecutionExitCodeGenerator.java similarity index 96% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/JobExecutionExitCodeGenerator.java index 4ae7b1b338a..a34c38524e8 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGenerator.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/JobExecutionExitCodeGenerator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.batch; +package org.springframework.autoconfigure.batch; import java.util.ArrayList; import java.util.List; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/JobLauncherCommandLineRunner.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/JobLauncherCommandLineRunner.java index 18f2a30d6b5..6ebdaa48b5a 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/batch/JobLauncherCommandLineRunner.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.batch; +package org.springframework.autoconfigure.batch; import java.util.Arrays; import java.util.Collection; @@ -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-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/data/JpaRepositoriesAutoConfiguration.java similarity index 81% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/data/JpaRepositoriesAutoConfiguration.java index 46aa1413590..38bcd8698aa 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/data/JpaRepositoriesAutoConfiguration.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.data; +package org.springframework.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.autoconfigure.EnableAutoConfiguration; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java index 14052ff78b1..5645016437d 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/data/JpaRepositoriesAutoConfigureRegistrar.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.data; +package org.springframework.autoconfigure.data; import java.util.Collection; import java.util.List; +import org.springframework.autoconfigure.AutoConfigurationUtils; 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; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/AbstractDataSourceConfiguration.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/AbstractDataSourceConfiguration.java index 734fb369938..bbe06ebb059 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/AbstractDataSourceConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/AbstractDataSourceConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Value; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/BasicDataSourceConfiguration.java similarity index 93% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/BasicDataSourceConfiguration.java index 3363fcb4c2e..c2f3f480f2c 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/BasicDataSourceConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import java.sql.SQLException; @@ -58,9 +58,10 @@ public class BasicDataSourceConfiguration extends AbstractDataSourceConfiguratio if (this.pool != null) { try { this.pool.close(); - } catch (SQLException e) { + } + catch (SQLException ex) { throw new DataAccessResourceFailureException( - "Could not close data source", e); + "Could not close data source", ex); } } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/DataSourceAutoConfiguration.java similarity index 87% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/DataSourceAutoConfiguration.java index b7cb1090a0f..0d6955af0dc 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import java.util.ArrayList; import java.util.Arrays; @@ -25,13 +25,13 @@ import javax.sql.DataSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.bootstrap.context.condition.ConditionLogUtils; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Condition; @@ -140,7 +140,7 @@ public class DataSourceAutoConfiguration { static class SomeDatabaseCondition implements Condition { - protected Log logger = LogFactory.getLog(getClass()); + private Log logger = LogFactory.getLog(getClass()); private Condition tomcatCondition = new TomcatDatabaseCondition(); @@ -157,24 +157,22 @@ public class DataSourceAutoConfiguration { || 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"); + 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"); + 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"); + this.logger.debug(checking + "Existing bean configured database not " + + "detected: match result false"); } return false; } @@ -210,7 +208,7 @@ public class DataSourceAutoConfiguration { static abstract class NonEmbeddedDatabaseCondition implements Condition { - protected Log logger = LogFactory.getLog(getClass()); + private Log logger = LogFactory.getLog(getClass()); protected abstract String getDataSourecClassName(); @@ -225,9 +223,29 @@ public class DataSourceAutoConfiguration { } return false; } + + String driverClassName = getDriverClassName(context, checking); + String url = getUrl(context); + + 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; + } + + private String getDriverClassName(ConditionContext context, String checking) { 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 " @@ -238,31 +256,23 @@ public class DataSourceAutoConfiguration { .getEmbeddedDatabaseDriverClass(EmbeddedDatabaseConfiguration .getEmbeddedDatabaseType()); } + return driverClassName; + } + + private String getUrl(ConditionContext context) { + String url = context.getEnvironment().getProperty("spring.database.url"); 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; + return url; } - } static class EmbeddedDatabaseCondition implements Condition { - protected Log logger = LogFactory.getLog(getClass()); + private Log logger = LogFactory.getLog(getClass()); private Condition tomcatCondition = new TomcatDatabaseCondition(); @@ -276,9 +286,8 @@ public class DataSourceAutoConfiguration { 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"); + this.logger.debug(checking + "Existing non-embedded " + + "database detected: match result false"); } return false; } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java similarity index 82% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java index 5df7d0bba39..3d45dad44de 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import javax.sql.DataSource; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.bootstrap.context.condition.ConditionalOnBean; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java index fce5f3a5909..6087ebc1812 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/EmbeddedDatabaseConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import java.util.LinkedHashMap; import java.util.Map; @@ -22,7 +22,7 @@ import java.util.Map; import javax.annotation.PreDestroy; import javax.sql.DataSource; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/TomcatDataSourceConfiguration.java similarity index 96% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/TomcatDataSourceConfiguration.java index 79d9139f508..f666315dfe2 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/jdbc/TomcatDataSourceConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import javax.annotation.PreDestroy; import javax.sql.DataSource; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/main/Spring.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/main/Spring.java similarity index 89% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/main/Spring.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/main/Spring.java index 5a1f2bb5a00..554e7a985c4 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/main/Spring.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/main/Spring.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.main; +package org.springframework.autoconfigure.main; import java.util.ArrayList; import java.util.List; import org.apache.commons.logging.LogFactory; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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; @@ -39,7 +39,9 @@ import org.springframework.util.ClassUtils; @Configuration @EnableAutoConfiguration @ComponentScan -public class Spring { +public abstract class Spring { + + // FIXME can we delete this? is it used? does it belong here private static ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( true); @@ -68,11 +70,14 @@ public class Spring { for (String arg : args) { if (ClassUtils.isPresent(arg, null)) { sources.add(ClassUtils.forName(arg, null)); - } else if (arg.endsWith(".xml")) { + } + else if (arg.endsWith(".xml")) { sources.add(arg); - } else if (!scanner.findCandidateComponents(arg).isEmpty()) { + } + else if (!scanner.findCandidateComponents(arg).isEmpty()) { sources.add(arg); - } else { + } + else { strings.add(arg); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java similarity index 84% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java index 6db6ba0633e..f01a4d105fb 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.orm.jpa; +package org.springframework.autoconfigure.orm.jpa; import java.util.LinkedHashMap; import java.util.Map; import org.hibernate.ejb.HibernateEntityManager; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.beans.factory.annotation.Value; -import org.springframework.bootstrap.context.annotation.ConditionalOnClass; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; @@ -43,14 +43,6 @@ import org.springframework.util.StringUtils; @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(); @@ -68,7 +60,7 @@ public class HibernateJpaAutoConfiguration extends JpaAutoConfiguration { private boolean showSql; @Value("${spring.jpa.ddlAuto:${spring.jpa.ddl_auto:none}}") - private DDLAUTO ddlAuto; + private String ddlAuto; // e.g. none, validate, update, create, create-drop @Bean @Override @@ -89,10 +81,9 @@ public class HibernateJpaAutoConfiguration extends JpaAutoConfiguration { // 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()); + if (StringUtils.hasLength(this.ddlAuto) && !"none".equals(this.ddlAuto)) { + properties.put("hibernate.hbm2ddl.auto", this.ddlAuto); } - } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/orm/jpa/JpaAutoConfiguration.java similarity index 87% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/orm/jpa/JpaAutoConfiguration.java index 3684af0bceb..c11f9b39946 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/orm/jpa/JpaAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/orm/jpa/JpaAutoConfiguration.java @@ -14,24 +14,24 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.orm.jpa; +package org.springframework.autoconfigure.orm.jpa; import java.util.List; import javax.persistence.EntityManager; import javax.sql.DataSource; +import org.springframework.autoconfigure.AutoConfigurationUtils; +import org.springframework.autoconfigure.EnableAutoConfiguration; +import org.springframework.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; 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.bootstrap.context.condition.ConditionalOnBean; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; import org.springframework.context.annotation.Bean; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.JpaVendorAdapter; @@ -78,7 +78,8 @@ public abstract class JpaAutoConfiguration implements BeanFactoryAware { .getBeanDefinition("dataSource"); return EmbeddedDatabaseConfiguration.class.getName().equals( beanDefinition.getFactoryBeanName()); - } catch (NoSuchBeanDefinitionException e) { + } + catch (NoSuchBeanDefinitionException ex) { return false; } } @@ -89,7 +90,8 @@ public abstract class JpaAutoConfiguration implements BeanFactoryAware { protected DataSource getDataSource() { try { return this.beanFactory.getBean("dataSource", DataSource.class); - } catch (RuntimeException e) { + } + catch (RuntimeException ex) { return this.beanFactory.getBean(DataSource.class); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java similarity index 89% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java index 8aed8834a88..1b083d61068 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.thymeleaf; +package org.springframework.autoconfigure.thymeleaf; import java.io.IOException; import java.io.InputStream; @@ -25,14 +25,14 @@ import javax.servlet.Servlet; import nz.net.ultraq.web.thymeleaf.LayoutDialect; +import org.springframework.autoconfigure.AutoConfigureAfter; +import org.springframework.autoconfigure.EnableAutoConfiguration; +import org.springframework.autoconfigure.web.WebMvcAutoConfiguration; 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.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingClass; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.DefaultResourceLoader; @@ -84,7 +84,8 @@ public class ThymeleafAutoConfiguration { try { return DefaultTemplateResolverConfiguration.this.resourceLoader .getResource(resourceName).getInputStream(); - } catch (IOException e) { + } + catch (IOException ex) { return null; } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java similarity index 92% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java index 7d4e6cdd6ec..119adecd579 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.web; +package org.springframework.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.autoconfigure.EnableAutoConfiguration; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/MultipartAutoConfiguration.java similarity index 85% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/MultipartAutoConfiguration.java index 4bdab4dc578..20d66acca0d 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/MultipartAutoConfiguration.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.web; +package org.springframework.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.autoconfigure.EnableAutoConfiguration; +import org.springframework.bootstrap.context.condition.ConditionalOnBean; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; import org.springframework.bootstrap.context.embedded.EmbeddedWebApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/ServerPropertiesAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/ServerPropertiesAutoConfiguration.java new file mode 100644 index 00000000000..8d24953d2d8 --- /dev/null +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/ServerPropertiesAutoConfiguration.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.autoconfigure.web; + +import org.springframework.autoconfigure.EnableAutoConfiguration; +import org.springframework.beans.BeansException; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; +import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; +import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; +import org.springframework.bootstrap.context.embedded.properties.ServerProperties; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; +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.Assert; +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 ApplicationContextAware, + EmbeddedServletContainerCustomizer { + + private ApplicationContext applicationContext; + + @Bean(name = "org.springframework.bootstrap.context.embedded.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) { + String[] serverPropertiesBeans = this.applicationContext + .getBeanNamesForType(ServerProperties.class); + Assert.state( + serverPropertiesBeans.length == 1, + "Multiple ServerProperties beans registered " + + StringUtils.arrayToCommaDelimitedString(serverPropertiesBeans)); + } + +} diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/WebMvcAutoConfiguration.java similarity index 92% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java rename to spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/WebMvcAutoConfiguration.java index 232815d1851..bb366344111 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfiguration.java +++ b/spring-autoconfigure/src/main/java/org/springframework/autoconfigure/web/WebMvcAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.web; +package org.springframework.autoconfigure.web; import java.util.Arrays; import java.util.Collection; @@ -22,14 +22,14 @@ import java.util.Collections; import javax.servlet.Servlet; +import org.springframework.autoconfigure.AutoConfigureAfter; +import org.springframework.autoconfigure.EnableAutoConfiguration; 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.bootstrap.context.condition.ConditionalOnBean; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; diff --git a/spring-autoconfigure/src/main/resources/META-INF/spring.factories b/spring-autoconfigure/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000000..8c5efd03489 --- /dev/null +++ b/spring-autoconfigure/src/main/resources/META-INF/spring.factories @@ -0,0 +1,14 @@ +# Auto Configure +org.springframework.autoconfigure.EnableAutoConfiguration=\ +org.springframework.autoconfigure.MessageSourceAutoConfiguration,\ +org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration,\ +org.springframework.autoconfigure.batch.BatchAutoConfiguration,\ +org.springframework.autoconfigure.data.JpaRepositoriesAutoConfiguration,\ +org.springframework.autoconfigure.jdbc.DataSourceAutoConfiguration,\ +org.springframework.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\ +org.springframework.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\ +org.springframework.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\ +org.springframework.autoconfigure.web.EmbeddedServletContainerAutoConfiguration,\ +org.springframework.autoconfigure.web.ServerPropertiesAutoConfiguration,\ +org.springframework.autoconfigure.web.MultipartAutoConfiguration,\ +org.springframework.autoconfigure.web.WebMvcAutoConfiguration diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/AdhocTestSuite.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/AdhocTestSuite.java similarity index 91% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/AdhocTestSuite.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/AdhocTestSuite.java index 76562ed241b..5b91abf4722 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/AdhocTestSuite.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/AdhocTestSuite.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap; +package org.springframework.autoconfigure; import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; +import org.springframework.autoconfigure.main.SimpleMainTests; 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. diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/AutoConfigurationSorterTest.java similarity index 94% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/AutoConfigurationSorterTest.java index d3d2110ec41..515e64ccdee 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/AutoConfigurationSorterTest.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/AutoConfigurationSorterTest.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; + +package org.springframework.autoconfigure; import java.util.Arrays; import java.util.List; @@ -22,6 +23,8 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.springframework.autoconfigure.AutoConfigurationSorter; +import org.springframework.autoconfigure.AutoConfigureAfter; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.core.io.DefaultResourceLoader; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/ComponentScanDetectorConfiguration.java similarity index 89% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/ComponentScanDetectorConfiguration.java index b01272650bb..d9080225e68 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/ComponentScanDetectorConfiguration.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/ComponentScanDetectorConfiguration.java @@ -14,8 +14,9 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.autoconfigure; +import org.springframework.autoconfigure.ComponentScanDetector; import org.springframework.context.annotation.Import; /** diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/MessageSourceAutoConfigurationTests.java similarity index 88% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/MessageSourceAutoConfigurationTests.java index 85a9dab8f0b..954cf8a8c46 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/MessageSourceAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/MessageSourceAutoConfigurationTests.java @@ -14,19 +14,23 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure; +package org.springframework.autoconfigure; import java.util.HashMap; import java.util.Locale; import java.util.Map; import org.junit.Test; +import org.springframework.autoconfigure.MessageSourceAutoConfiguration; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.core.env.MapPropertySource; import static org.junit.Assert.assertEquals; /** + * Tests for {@link MessageSourceAutoConfiguration}. + * * @author Dave Syer */ public class MessageSourceAutoConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringJUnitTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/SpringJUnitTests.java similarity index 90% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringJUnitTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/SpringJUnitTests.java index 4614dd944f9..f634acb6144 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringJUnitTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/SpringJUnitTests.java @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap; + +package org.springframework.autoconfigure; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.SpringJUnitTests.TestConfiguration; 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.context.initializer.ConfigFileApplicationContextInitializer; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; @@ -33,7 +34,6 @@ import static org.junit.Assert.assertNotNull; /** * @author Dave Syer - * */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = TestConfiguration.class, initializers = ConfigFileApplicationContextInitializer.class) diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/batch/BatchAutoConfigurationTests.java similarity index 89% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/batch/BatchAutoConfigurationTests.java index a7e8b460c85..a05424ba4f6 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/BatchAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/batch/BatchAutoConfigurationTests.java @@ -14,12 +14,16 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.batch; +package org.springframework.autoconfigure.batch; import java.util.Collection; import java.util.Collections; import org.junit.Test; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.batch.BatchAutoConfiguration; +import org.springframework.autoconfigure.batch.JobLauncherCommandLineRunner; +import org.springframework.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; @@ -31,14 +35,14 @@ 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; /** + * Tests for {@link BatchAutoConfiguration}. + * * @author Dave Syer */ public class BatchAutoConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java similarity index 87% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java index c256deaba4d..1433f03cde1 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/batch/JobExecutionExitCodeGeneratorTests.java @@ -14,15 +14,19 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.batch; +package org.springframework.autoconfigure.batch; import org.junit.Test; +import org.springframework.autoconfigure.batch.JobExecutionEvent; +import org.springframework.autoconfigure.batch.JobExecutionExitCodeGenerator; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import static org.junit.Assert.assertEquals; /** + * Tests for {@link JobExecutionExitCodeGenerator}. + * * @author Dave Syer */ public class JobExecutionExitCodeGeneratorTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java similarity index 75% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java index ba13c109489..3aa7f88c50a 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/JpaRepositoriesAutoConfigurationTests.java @@ -14,17 +14,18 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.data; +package org.springframework.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.autoconfigure.ComponentScanDetectorConfiguration; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.data.JpaRepositoriesAutoConfiguration; +import org.springframework.autoconfigure.data.test.City; +import org.springframework.autoconfigure.data.test.CityRepository; +import org.springframework.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -33,6 +34,8 @@ import org.springframework.transaction.PlatformTransactionManager; import static org.junit.Assert.assertNotNull; /** + * Tests for {@link JpaRepositoriesAutoConfiguration}. + * * @author Dave Syer */ public class JpaRepositoriesAutoConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/JpaWebAutoConfigurationTests.java similarity index 77% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/JpaWebAutoConfigurationTests.java index 7dbd8ac2439..58656ee336b 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/JpaWebAutoConfigurationTests.java @@ -14,15 +14,16 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.data; +package org.springframework.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.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.data.JpaRepositoriesAutoConfiguration; +import org.springframework.autoconfigure.data.test.City; +import org.springframework.autoconfigure.data.test.CityRepository; +import org.springframework.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.repository.support.DomainClassConverter; @@ -35,7 +36,7 @@ import static org.junit.Assert.assertNotNull; * @author Dave Syer */ @Ignore -// until spring data commons 1.6.0, jpa 1.5.0 available +// FIXME until spring data commons 1.6.0, jpa 1.5.0 available public class JpaWebAutoConfigurationTests { private AnnotationConfigWebApplicationContext context; diff --git a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/City.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/test/City.java similarity index 96% rename from spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/City.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/test/City.java index ab7fade1417..1bab8dd0a3b 100644 --- a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/java/org/springframework/bootstrap/sample/data/domain/City.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/test/City.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain; +package org.springframework.autoconfigure.data.test; import java.io.Serializable; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/test/CityRepository.java similarity index 94% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/test/CityRepository.java index 1e9e6145023..7879b2c96fc 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/CityRepository.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/data/test/CityRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.data.test; +package org.springframework.autoconfigure.data.test; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java similarity index 87% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java index 3c89dcd474b..4e25fefb337 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/BasicDataSourceConfigurationTests.java @@ -14,16 +14,19 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import javax.sql.DataSource; import org.junit.Test; +import org.springframework.autoconfigure.jdbc.BasicDataSourceConfiguration; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import static org.junit.Assert.assertNotNull; /** + * Tests for {@link BasicDataSourceConfiguration}. + * * @author Dave Syer */ public class BasicDataSourceConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java similarity index 94% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java index aa8cde1b99b..0625fd40e96 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import java.util.HashMap; import java.util.Map; @@ -23,7 +23,8 @@ import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; import org.junit.Test; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -38,6 +39,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; /** + * Tests for {@link DataSourceAutoConfiguration}. + * * @author Dave Syer */ public class DataSourceAutoConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java similarity index 86% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java index 3ab6041ab7a..59628667be2 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import javax.sql.DataSource; import org.junit.Test; +import org.springframework.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.jdbc.datasource.DataSourceTransactionManager; @@ -26,6 +28,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; /** + * Tests for {@link DataSourceTransactionManagerAutoConfiguration}. + * * @author Dave Syer */ public class DataSourceTransactionManagerAutoConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java similarity index 87% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java index 3b48d612d37..d407542eebf 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/EmbeddedDatabaseConfigurationTests.java @@ -14,16 +14,19 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import javax.sql.DataSource; import org.junit.Test; +import org.springframework.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import static org.junit.Assert.assertNotNull; /** + * Tests for {@link EmbeddedDatabaseConfiguration}. + * * @author Dave Syer */ public class EmbeddedDatabaseConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java similarity index 89% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java index 8efdfebb994..604f14a029e 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.jdbc; +package org.springframework.autoconfigure.jdbc; import java.lang.reflect.Field; import java.util.HashMap; @@ -24,14 +24,18 @@ import javax.sql.DataSource; import org.junit.After; import org.junit.Test; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.autoconfigure.jdbc.TomcatDataSourceConfiguration; 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; /** + * Tests for {@link TomcatDataSourceConfiguration}. + * * @author Dave Syer */ public class TomcatDataSourceConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/main/SimpleMainTests.java similarity index 92% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/main/SimpleMainTests.java index 40a7606345f..2d0adf6225a 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/main/SimpleMainTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/main/SimpleMainTests.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.main; +package org.springframework.autoconfigure.main; import org.junit.After; import org.junit.Test; +import org.springframework.autoconfigure.main.Spring; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.util.ClassUtils; @@ -25,6 +26,8 @@ import org.springframework.util.ClassUtils; import static org.junit.Assert.assertNotNull; /** + * Tests for {@link Spring}. + * * @author Dave Syer */ public class SimpleMainTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java similarity index 79% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java index 18577f7aa9e..f3a0ac4b726 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java @@ -14,16 +14,17 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.orm.jpa; +package org.springframework.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.autoconfigure.ComponentScanDetectorConfiguration; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.autoconfigure.orm.jpa.test.City; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.orm.jpa.JpaTransactionManager; @@ -32,6 +33,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; /** + * Tests for {@link HibernateJpaAutoConfiguration}. + * * @author Dave Syer */ public class HibernateJpaAutoConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/test/City.java similarity index 96% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/test/City.java index c686cf6d194..0b812115014 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/test/City.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/test/City.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.data.test; +package org.springframework.autoconfigure.orm.jpa.test; import java.io.Serializable; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java similarity index 92% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java index 65e71a5f4c2..5998be72c9e 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.thymeleaf; +package org.springframework.autoconfigure.thymeleaf; import java.util.Collections; import java.util.HashMap; @@ -22,7 +22,8 @@ import java.util.Locale; import java.util.Map; import org.junit.Test; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.core.env.MapPropertySource; import org.springframework.mock.web.MockHttpServletRequest; @@ -39,6 +40,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** + * Tests for {@link ThymeleafAutoConfiguration} * @author Dave Syer */ public class ThymeleafAutoConfigurationTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java similarity index 95% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java index 362a8fd81a5..f1f31df840d 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java @@ -14,14 +14,15 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.web; +package org.springframework.autoconfigure.web; import javax.servlet.Servlet; import org.junit.Test; +import org.springframework.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.bootstrap.context.annotation.ConditionalOnExpression; +import org.springframework.bootstrap.context.condition.ConditionalOnExpression; import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/MultipartAutoConfigurationTests.java similarity index 97% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/MultipartAutoConfigurationTests.java index a9e29fc7c6b..d36e25cee6e 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/MultipartAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/MultipartAutoConfigurationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.web; +package org.springframework.autoconfigure.web; import javax.servlet.MultipartConfigElement; @@ -22,6 +22,8 @@ import org.junit.After; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.springframework.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.autoconfigure.web.MultipartAutoConfiguration; import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; import org.springframework.bootstrap.context.embedded.jetty.JettyEmbeddedServletContainerFactory; import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/ServerPropertiesAutoConfigurationTests.java similarity index 72% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/ServerPropertiesAutoConfigurationTests.java index ec089dc2c76..2ad73a28d1f 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/ServerPropertiesAutoConfigurationTests.java @@ -14,22 +14,26 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.web; +package org.springframework.autoconfigure.web; import java.io.File; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.mockito.Mockito; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.web.ServerPropertiesAutoConfiguration; +import org.springframework.beans.factory.BeanCreationException; 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.properties.ServerProperties; 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; @@ -41,10 +45,13 @@ import static org.junit.Assert.assertNotNull; * * @author Dave Syer */ -public class ServerPropertiesConfigurationTests { +public class ServerPropertiesAutoConfigurationTests { private static ConfigurableEmbeddedServletContainerFactory containerFactory; + @Rule + public ExpectedException thrown = ExpectedException.none(); + private AnnotationConfigEmbeddedWebApplicationContext context; @Before @@ -87,12 +94,23 @@ public class ServerPropertiesConfigurationTests { Mockito.verify(containerFactory).setPort(8080); } + @Test + public void testAccidentalMultipleServerPropertiesBeans() throws Exception { + this.context = new AnnotationConfigEmbeddedWebApplicationContext(); + this.context.register(Config.class, MutiServerPropertiesBeanConfig.class, + ServerPropertiesAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.thrown.expect(BeanCreationException.class); + this.thrown.expectMessage("Multiple ServerProperties"); + this.context.refresh(); + } + @Configuration protected static class Config { @Bean public EmbeddedServletContainerFactory containerFactory() { - return ServerPropertiesConfigurationTests.containerFactory; + return ServerPropertiesAutoConfigurationTests.containerFactory; } @Bean @@ -102,4 +120,19 @@ public class ServerPropertiesConfigurationTests { } + @Configuration + protected static class MutiServerPropertiesBeanConfig { + + @Bean + public ServerProperties serverPropertiesOne() { + return new ServerProperties(); + } + + @Bean + public ServerProperties serverPropertiesTwo() { + return new ServerProperties(); + } + + } + } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/WebMvcAutoConfigurationTests.java similarity index 86% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java rename to spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/WebMvcAutoConfigurationTests.java index 5829e32c1ec..be2d0017d12 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/WebMvcAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/web/WebMvcAutoConfigurationTests.java @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.web; + +package org.springframework.autoconfigure.web; import org.junit.Ignore; +import org.springframework.autoconfigure.web.WebMvcAutoConfiguration; /** * Tests for {@link WebMvcAutoConfiguration}. @@ -24,6 +26,7 @@ import org.junit.Ignore; */ @Ignore public class WebMvcAutoConfigurationTests { + // FIXME } diff --git a/spring-bootstrap/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql b/spring-autoconfigure/src/test/resources/org/springframework/autoconfigure/jdbc/schema.sql similarity index 100% rename from spring-bootstrap/src/test/resources/org/springframework/bootstrap/autoconfigure/jdbc/schema.sql rename to spring-autoconfigure/src/test/resources/org/springframework/autoconfigure/jdbc/schema.sql diff --git a/spring-bootstrap/src/test/resources/templates/layout.html b/spring-autoconfigure/src/test/resources/templates/layout.html similarity index 100% rename from spring-bootstrap/src/test/resources/templates/layout.html rename to spring-autoconfigure/src/test/resources/templates/layout.html diff --git a/spring-bootstrap/src/test/resources/templates/template.txt b/spring-autoconfigure/src/test/resources/templates/template.txt similarity index 100% rename from spring-bootstrap/src/test/resources/templates/template.txt rename to spring-autoconfigure/src/test/resources/templates/template.txt diff --git a/spring-bootstrap/src/test/resources/templates/tiles.xml b/spring-autoconfigure/src/test/resources/templates/tiles.xml similarity index 100% rename from spring-bootstrap/src/test/resources/templates/tiles.xml rename to spring-autoconfigure/src/test/resources/templates/tiles.xml diff --git a/spring-bootstrap/src/test/resources/templates/view.html b/spring-autoconfigure/src/test/resources/templates/view.html similarity index 100% rename from spring-bootstrap/src/test/resources/templates/view.html rename to spring-autoconfigure/src/test/resources/templates/view.html diff --git a/spring-bootstrap/src/test/resources/test/messages.properties b/spring-autoconfigure/src/test/resources/test/messages.properties similarity index 100% rename from spring-bootstrap/src/test/resources/test/messages.properties rename to spring-autoconfigure/src/test/resources/test/messages.properties diff --git a/spring-bootstrap-actuator/src/main/resources/META-INF/spring.factories b/spring-bootstrap-actuator/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 83f5b6d483a..00000000000 --- a/spring-bootstrap-actuator/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,11 +0,0 @@ -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 diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java b/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/TestUtils.java deleted file mode 100644 index ade84630fcd..00000000000 --- a/spring-bootstrap-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-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.CommandFactory b/spring-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.CommandFactory deleted file mode 100644 index 08f8bcb548f..00000000000 --- a/spring-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.CommandFactory +++ /dev/null @@ -1 +0,0 @@ -org.springframework.bootstrap.cli.command.DefaultCommandFactory \ No newline at end of file diff --git a/spring-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration b/spring-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration deleted file mode 100644 index e6cae9858aa..00000000000 --- a/spring-bootstrap-cli/src/main/resources/META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration +++ /dev/null @@ -1,5 +0,0 @@ -org.springframework.bootstrap.cli.compiler.autoconfigure.SpringBootstrapCompilerAutoConfiguration -org.springframework.bootstrap.cli.compiler.autoconfigure.SpringMvcCompilerAutoConfiguration -org.springframework.bootstrap.cli.compiler.autoconfigure.SpringBatchCompilerAutoConfiguration -org.springframework.bootstrap.cli.compiler.autoconfigure.SpringIntegrationCompilerAutoConfiguration - diff --git a/spring-bootstrap-cli/src/test/resources/commands/closure.groovy b/spring-bootstrap-cli/src/test/resources/commands/closure.groovy deleted file mode 100644 index fab55c40eee..00000000000 --- a/spring-bootstrap-cli/src/test/resources/commands/closure.groovy +++ /dev/null @@ -1,6 +0,0 @@ -def run = { msg -> - org.springframework.bootstrap.cli.command.ScriptCommandTests.executed = true - println "Hello ${msg}" -} - -run \ No newline at end of file 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-sample/start.groovy b/spring-bootstrap-samples/spring-bootstrap-actuator-sample/start.groovy deleted file mode 100644 index 6cecd252d27..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-actuator-sample/start.groovy +++ /dev/null @@ -1,5 +0,0 @@ -@Grab("org.springframework.bootstrap:spring-bootstrap-actuator:0.5.0.BUILD-SNAPSHOT") -@Grab("org.springframework.bootstrap:spring-bootstrap-web-starter:0.5.0.BUILD-SNAPSHOT") -@ComponentScan("org.springframework.bootstrap.sample.service") -class Start { -} 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-actuator-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplication.java b/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplication.java deleted file mode 100644 index 7632f3f7acc..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-actuator-ui-sample/src/main/java/org/springframework/bootstrap/sample/ui/ActuatorUiBootstrapApplication.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.springframework.bootstrap.sample.ui; - -import java.util.Date; -import java.util.Map; - -import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.actuate.properties.SecurityProperties; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@EnableAutoConfiguration -@ComponentScan -@Controller -public class ActuatorUiBootstrapApplication { - - @RequestMapping("/") - public String home(Map model) { - model.put("message", "Hello World"); - model.put("title", "Hello Home"); - model.put("date", new Date()); - return "home"; - } - - public static void main(String[] args) throws Exception { - SpringApplication.run(ActuatorUiBootstrapApplication.class, args); - } - - @Bean - public SecurityProperties securityProperties() { - SecurityProperties security = new SecurityProperties(); - security.getBasic().setPath(""); // empty - return security; - } - -} 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-data-sample/src/main/resources/application.properties b/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/resources/application.properties deleted file mode 100644 index 04e13807d5b..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-data-sample/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.jpa.ddl_auto: create_drop \ No newline at end of file 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-integration-sample/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java b/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java deleted file mode 100644 index c715340e18e..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-integration-sample/src/test/java/org/springframework/bootstrap/sample/producer/ProducerApplication.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.springframework.bootstrap.sample.producer; - -import java.io.File; -import java.io.FileOutputStream; - -import org.springframework.bootstrap.CommandLineRunner; -import org.springframework.bootstrap.SpringApplication; -import org.springframework.context.annotation.Configuration; - -@Configuration -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"); - for (String arg : args) { - stream.write(arg.getBytes()); - } - stream.flush(); - stream.close(); - } - - public static void main(String[] args) throws Exception { - SpringApplication.run(ProducerApplication.class, args); - } - -} 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/spring-bootstrap-xml-sample/src/test/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplicationTests.java b/spring-bootstrap-samples/spring-bootstrap-xml-sample/src/test/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplicationTests.java deleted file mode 100644 index 596df4c5cc2..00000000000 --- a/spring-bootstrap-samples/spring-bootstrap-xml-sample/src/test/java/org/springframework/bootstrap/sample/xml/XmlBootstrapApplicationTests.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.springframework.bootstrap.sample.xml; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import static org.junit.Assert.assertTrue; - -public class XmlBootstrapApplicationTests { - - private static PrintStream savedOutput; - private static ByteArrayOutputStream output; - - @BeforeClass - public static void init() { - savedOutput = System.out; - output = new ByteArrayOutputStream(); - System.setOut(new PrintStream(output)); - } - - @AfterClass - public static void clear() { - System.setOut(savedOutput); - } - - private static String getOutput() { - return output.toString(); - } - - @Test - public void testDefaultSettings() throws Exception { - XmlBootstrapApplication.main(new String[0]); - String output = getOutput(); - assertTrue("Wrong output: " + output, output.contains("Hello World")); - } - -} 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/pom.xml b/spring-bootstrap/pom.xml index a1a7848fbf2..29e3b1b099d 100644 --- a/spring-bootstrap/pom.xml +++ b/spring-bootstrap/pom.xml @@ -3,13 +3,17 @@ 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 jar + + ${basedir}/.. + + org.springframework spring-core @@ -20,23 +24,8 @@ - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - true - - - javax.servlet - javax.servlet-api - true - - - org.hibernate - hibernate-validator - true - - - org.yaml - snakeyaml + ch.qos.logback + logback-classic true @@ -44,21 +33,16 @@ jackson-databind true + + javax.servlet + javax.servlet-api + true + org.apache.tomcat.embed tomcat-embed-core true - - org.apache.tomcat - tomcat-jdbc - true - - - commons-dbcp - commons-dbcp - true - org.eclipse.jetty jetty-webapp @@ -70,18 +54,13 @@ true - org.springframework - spring-jdbc + org.hibernate + hibernate-validator true - org.springframework - spring-orm - true - - - org.springframework - spring-tx + org.slf4j + slf4j-api true @@ -90,67 +69,11 @@ true - org.springframework - 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 - true - - - org.apache.maven.plugins - maven-shade-plugin - 1.6 - true - - - org.thymeleaf - thymeleaf-spring3 - true - - - nz.net.ultraq.web.thymeleaf - thymeleaf-layout-dialect - true - - - org.hibernate - hibernate-entitymanager + org.yaml + snakeyaml true - - org.hsqldb - hsqldb - test - - - org.springframework - spring-test - test - commons-httpclient commons-httpclient @@ -161,5 +84,34 @@ 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-bootstrap/src/main/java/org/springframework/bootstrap/Banner.java index bec87089992..19318d4e5c1 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/Banner.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/Banner.java @@ -19,19 +19,18 @@ package org.springframework.bootstrap; import java.io.PrintStream; /** - * Writes the 'Spring Bootstrap' banner. + * Writes the 'Spring' banner. * * @author Phillip Webb */ abstract class Banner { - private static final String[] BANNER = { - " . ____ _ _____ __ _", - " /\\\\ / ___'_ __ _ _(_)_ __ __ _ |__ /___ _ __ ___\\ \\ \\", - "( ( )\\___ | '_ | '_| | '_ \\/ _` | / // _ \\ '__/ _ \\\\ \\ \\", - " \\\\/ ___)| |_)| | | | | || (_| | / /| __/ | | (/) |} } }", - " ' |____| .__|_| |_|_| |_\\__, |'_____\\___|_| \\___// / /", - " =========|_|==============|___/====================/_/_/" }; + private static final String[] BANNER = { " . ____ _ __ _ _", + " /\\\\ / ___'_ __ _ _(_)_ __ __ _ \\ \\ \\ \\", + "( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\", + " \\\\/ ___)| |_)| | | | | || (_| | ) ) ) )", + " ' |____| .__|_| |_|_| |_\\__, | / / / /", + " =========|_|==============|___/=/_/_/_/" }; /** * Write the banner to the specified print stream. diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java index e90e5e00d72..0853caac9b0 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java @@ -118,40 +118,54 @@ class BeanDefinitionLoader { private int load(Object source) { Assert.notNull(source, "Source must not be null"); if (source instanceof Class) { - Class type = (Class) source; - if (isComponent(type)) { - this.annotatedReader.register(type); - return 1; - } - return 0; + return load((Class) source); } - if (source instanceof Resource) { - return this.xmlReader.loadBeanDefinitions((Resource) source); + return load((Resource) source); } - if (source instanceof Package) { - // FIXME register the scanned package for data to pick up - return this.scanner.scan(((Package) source).getName()); + return load((Package) source); } - if (source instanceof CharSequence) { - try { - return load(Class.forName(source.toString())); - } catch (ClassNotFoundException e) { - } + return load((CharSequence) source); + } + throw new IllegalArgumentException("Invalid source type " + source.getClass()); + } - Resource loadedResource = (this.resourceLoader != null ? this.resourceLoader - : DEFAULT_RESOURCE_LOADER).getResource(source.toString()); - if (loadedResource != null && loadedResource.exists()) { - return load(loadedResource); - } - Package packageResource = Package.getPackage(source.toString()); - if (packageResource != null) { - return load(packageResource); - } + private int load(Class source) { + if (isComponent(source)) { + this.annotatedReader.register(source); + return 1; + } + return 0; + } + + private int load(Resource source) { + return this.xmlReader.loadBeanDefinitions(source); + } + + private int load(Package source) { + // FIXME register the scanned package for data to pick up + return this.scanner.scan(source.getName()); + } + + private int load(CharSequence source) { + try { + return load(Class.forName(source.toString())); + } + catch (ClassNotFoundException ex) { + // swallow exception and continue } + Resource loadedResource = (this.resourceLoader != null ? this.resourceLoader + : DEFAULT_RESOURCE_LOADER).getResource(source.toString()); + if (loadedResource != null && loadedResource.exists()) { + return load(loadedResource); + } + Package packageResource = Package.getPackage(source.toString()); + if (packageResource != null) { + return load(packageResource); + } throw new IllegalArgumentException("Invalid source '" + source + "'"); } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/SpringApplication.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/SpringApplication.java index ccb6db30f1c..fb931c14028 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/SpringApplication.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/SpringApplication.java @@ -123,8 +123,8 @@ public class SpringApplication { private static final String DEFAULT_CONTEXT_CLASS = "org.springframework.context." + "annotation.AnnotationConfigApplicationContext"; - public static final String DEFAULT_WEB_CONTEXT_CLASS = "org.springframework.bootstrap." - + "context.embedded.AnnotationConfigEmbeddedWebApplicationContext"; + public static final String DEFAULT_WEB_CONTEXT_CLASS = "org.springframework." + + "bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext"; private static final String[] WEB_ENVIRONMENT_CLASSES = { "javax.servlet.Servlet", "org.springframework.web.context.ConfigurableWebApplicationContext" }; @@ -183,7 +183,7 @@ public class SpringApplication { initialize(); } - protected void initialize() { + private void initialize() { this.webEnvironment = deduceWebEnvironment(); this.initializers = new ArrayList>(); @SuppressWarnings("rawtypes") @@ -270,7 +270,8 @@ public class SpringApplication { contextClass = Class .forName(this.webEnvironment ? DEFAULT_WEB_CONTEXT_CLASS : DEFAULT_CONTEXT_CLASS); - } catch (ClassNotFoundException ex) { + } + catch (ClassNotFoundException ex) { throw new IllegalStateException( "Unable create a default ApplicationContext, " + "please specify an ApplicationContextClass", ex); @@ -344,14 +345,16 @@ public class SpringApplication { for (String arg : defaults) { if (isOptionArg(arg)) { addOptionArg(options, arg); - } else { + } + else { nonopts.add(arg); } } for (String arg : args) { if (isOptionArg(arg)) { addOptionArg(options, arg); - } else if (!nonopts.contains(arg)) { + } + else if (!nonopts.contains(arg)) { nonopts.add(arg); } } @@ -373,10 +376,11 @@ public class SpringApplication { String optionName; String optionValue = ""; if (optionText.contains("=")) { - optionName = optionText.substring(0, optionText.indexOf("=")); - optionValue = optionText.substring(optionText.indexOf("=") + 1, + optionName = optionText.substring(0, optionText.indexOf('=')); + optionValue = optionText.substring(optionText.indexOf('=') + 1, optionText.length()); - } else { + } + else { optionName = optionText; } if (optionName.isEmpty()) { @@ -434,8 +438,9 @@ public class SpringApplication { for (CommandLineRunner runner : runners) { try { runner.run(args); - } catch (Exception e) { - throw new IllegalStateException("Failed to execute CommandLineRunner", e); + } + catch (Exception ex) { + throw new IllegalStateException("Failed to execute CommandLineRunner", ex); } } } @@ -606,12 +611,14 @@ public class SpringApplication { generators.addAll(context.getBeansOfType(ExitCodeGenerator.class) .values()); exitCode = getExitCode(generators); - } finally { + } + finally { close(context); } - } catch (Exception e) { - e.printStackTrace(); + } + catch (Exception ex) { + ex.printStackTrace(); exitCode = (exitCode == 0 ? 1 : exitCode); } return exitCode; @@ -625,9 +632,10 @@ public class SpringApplication { if (value > 0 && value > exitCode || value < 0 && value < exitCode) { exitCode = value; } - } catch (Exception e) { + } + catch (Exception ex) { exitCode = (exitCode == 0 ? 1 : exitCode); - e.printStackTrace(); + ex.printStackTrace(); } } return exitCode; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesAutoConfiguration.java deleted file mode 100644 index 7d9c69b9f80..00000000000 --- a/spring-bootstrap/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-bootstrap/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java index 27e7e1bdb55..6e368106424 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/CustomPropertyConstructor.java @@ -74,8 +74,9 @@ public class CustomPropertyConstructor extends Constructor { try { typeMap.put(alias, this.propertyUtils.getProperty(type, name)); - } catch (IntrospectionException e) { - throw new RuntimeException(e); + } + catch (IntrospectionException ex) { + throw new RuntimeException(ex); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java index 14155745977..e6cadd2f977 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/InetAddressEditor.java @@ -37,8 +37,9 @@ public class InetAddressEditor extends PropertyEditorSupport implements Property public void setAsText(String text) throws IllegalArgumentException { try { setValue(InetAddress.getByName(text)); - } catch (UnknownHostException e) { - throw new IllegalArgumentException("Cannot locate host", e); + } + catch (UnknownHostException ex) { + throw new IllegalArgumentException("Cannot locate host", ex); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java index 3145e8a9214..f477cc6312d 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactory.java @@ -46,8 +46,7 @@ import org.springframework.validation.Validator; public class PropertiesConfigurationFactory implements FactoryBean, MessageSourceAware, InitializingBean { - private static final Log logger = LogFactory - .getLog(PropertiesConfigurationFactory.class); + private final Log logger = LogFactory.getLog(getClass()); private boolean ignoreUnknownFields = true; @@ -59,13 +58,13 @@ public class PropertiesConfigurationFactory implements FactoryBean, private PropertySources propertySources; - private T configuration; + private T target; private Validator validator; private MessageSource messageSource; - private boolean initialized = false; + private boolean hasBeenBound = false; private String targetName; @@ -77,7 +76,7 @@ public class PropertiesConfigurationFactory implements FactoryBean, */ public PropertiesConfigurationFactory(T target) { Assert.notNull(target); - this.configuration = target; + this.target = target; } /** @@ -88,7 +87,7 @@ public class PropertiesConfigurationFactory implements FactoryBean, @SuppressWarnings("unchecked") public PropertiesConfigurationFactory(Class type) { Assert.notNull(type); - this.configuration = (T) BeanUtils.instantiate(type); + this.target = (T) BeanUtils.instantiate(type); } /** @@ -165,82 +164,15 @@ public class PropertiesConfigurationFactory implements FactoryBean, @Override public void afterPropertiesSet() throws Exception { - - Assert.state(this.properties != null || this.propertySources != null, - "Properties or propertySources should not be null"); - - try { - if (this.properties != null) { - logger.trace("Properties:\n" + this.properties); - } else { - logger.trace("Property Sources: " + this.propertySources); - } - this.initialized = true; - - RelaxedDataBinder dataBinder; - if (this.targetName != null) { - dataBinder = new RelaxedDataBinder(this.configuration, this.targetName); - } else { - dataBinder = new RelaxedDataBinder(this.configuration); - } - if (this.validator != null) { - dataBinder.setValidator(this.validator); - } - if (this.conversionService != null) { - dataBinder.setConversionService(this.conversionService); - } - dataBinder.setIgnoreInvalidFields(this.ignoreInvalidFields); - dataBinder.setIgnoreUnknownFields(this.ignoreUnknownFields); - customizeBinder(dataBinder); - PropertyValues pvs; - if (this.properties != null) { - pvs = new MutablePropertyValues(this.properties); - } else { - pvs = new PropertySourcesPropertyValues(this.propertySources); - } - dataBinder.bind(pvs); - - if (this.validator != null) { - dataBinder.validate(); - BindingResult errors = dataBinder.getBindingResult(); - - if (errors.hasErrors()) { - logger.error("Properties configuration failed validation"); - for (ObjectError error : errors.getAllErrors()) { - logger.error(this.messageSource != null ? this.messageSource - .getMessage(error, Locale.getDefault()) - + " (" - + error - + ")" : error); - } - if (this.exceptionIfInvalid) { - BindException summary = new BindException(errors); - throw summary; - } - } - } - } catch (BindException e) { - if (this.exceptionIfInvalid) { - throw e; - } - logger.error( - "Failed to load Properties validation bean. Your Properties may be invalid.", - e); - } - } - - /** - * @param dataBinder the data binder that will be used to bind and validate - */ - protected void customizeBinder(DataBinder dataBinder) { + bindPropertiesToTarget(); } @Override public Class getObjectType() { - if (this.configuration == null) { + if (this.target == null) { return Object.class; } - return this.configuration.getClass(); + return this.target.getClass(); } @Override @@ -250,10 +182,81 @@ public class PropertiesConfigurationFactory implements FactoryBean, @Override public T getObject() throws Exception { - if (!this.initialized) { - afterPropertiesSet(); + if (!this.hasBeenBound) { + bindPropertiesToTarget(); } - return this.configuration; + return this.target; + } + + public void bindPropertiesToTarget() throws BindException { + Assert.state(this.properties != null || this.propertySources != null, + "Properties or propertySources should not be null"); + try { + if (this.logger.isTraceEnabled()) { + if (this.properties != null) { + this.logger.trace("Properties:\n" + this.properties); + } + else { + this.logger.trace("Property Sources: " + this.propertySources); + } + } + this.hasBeenBound = true; + doBindPropertiesToTarget(); + } + catch (BindException ex) { + if (this.exceptionIfInvalid) { + throw ex; + } + this.logger.error("Failed to load Properties validation bean. " + + "Your Properties may be invalid.", ex); + } + } + + private void doBindPropertiesToTarget() throws BindException { + + RelaxedDataBinder dataBinder = (this.targetName != null ? new RelaxedDataBinder( + this.target, this.targetName) : new RelaxedDataBinder(this.target)); + if (this.validator != null) { + dataBinder.setValidator(this.validator); + } + if (this.conversionService != null) { + dataBinder.setConversionService(this.conversionService); + } + dataBinder.setIgnoreInvalidFields(this.ignoreInvalidFields); + dataBinder.setIgnoreUnknownFields(this.ignoreUnknownFields); + customizeBinder(dataBinder); + + PropertyValues propertyValues = (this.properties != null ? new MutablePropertyValues( + this.properties) + : new PropertySourcesPropertyValues(this.propertySources)); + dataBinder.bind(propertyValues); + + if (this.validator != null) { + validate(dataBinder); + } + } + + private void validate(RelaxedDataBinder dataBinder) throws BindException { + dataBinder.validate(); + BindingResult errors = dataBinder.getBindingResult(); + if (errors.hasErrors()) { + this.logger.error("Properties configuration failed validation"); + for (ObjectError error : errors.getAllErrors()) { + this.logger.error(this.messageSource != null ? this.messageSource + .getMessage(error, Locale.getDefault()) + " (" + error + ")" + : error); + } + if (this.exceptionIfInvalid) { + BindException summary = new BindException(errors); + throw summary; + } + } + } + + /** + * @param dataBinder the data binder that will be used to bind and validate + */ + protected void customizeBinder(DataBinder dataBinder) { } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java index e428e8f2aaa..f5e2e347e24 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValues.java @@ -98,7 +98,8 @@ public class PropertySourcesPropertyValues implements PropertyValues { PropertyValue pvOld = old.getPropertyValue(newPv.getName()); if (pvOld == null) { changes.addPropertyValue(newPv); - } else if (!pvOld.equals(newPv)) { + } + else if (!pvOld.equals(newPv)) { // it's changed changes.addPropertyValue(newPv); } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java index 25d6ef039d1..c253767b310 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/RelaxedDataBinder.java @@ -157,7 +157,8 @@ public class RelaxedDataBinder extends DataBinder { Map existing = (Map) target .getPropertyValue(base); nested = existing; - } else { + } + else { target.setPropertyValue(base, nested); } modifyPopertiesForMap(nested, propertyValues, index, base); @@ -196,7 +197,9 @@ public class RelaxedDataBinder extends DataBinder { if (target.getPropertyType(prefix + candidate) != null) { return candidate; } - } catch (InvalidPropertyException ex) { + } + catch (InvalidPropertyException ex) { + // swallow and contrinue } } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java index 6f245dcdf5e..8a356e82dc5 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/bind/YamlConfigurationFactory.java @@ -50,7 +50,7 @@ import org.yaml.snakeyaml.error.YAMLException; public class YamlConfigurationFactory implements FactoryBean, MessageSourceAware, InitializingBean { - private static final Log logger = LogFactory.getLog(YamlConfigurationFactory.class); + private final Log logger = LogFactory.getLog(getClass()); private Class type; @@ -128,43 +128,45 @@ public class YamlConfigurationFactory implements FactoryBean, MessageSourc Charset.defaultCharset()); } - Assert.state( - this.yaml != null, - "Yaml document should not be null: either set it directly or set the resource to load it from"); + Assert.state(this.yaml != null, "Yaml document should not be null: " + + "either set it directly or set the resource to load it from"); try { - logger.trace("Yaml document is\n" + this.yaml); + if (this.logger.isTraceEnabled()) { + this.logger.trace("Yaml document is\n" + this.yaml); + } Constructor constructor = new CustomPropertyConstructor(this.type, this.propertyAliases); this.configuration = (T) (new Yaml(constructor)).load(this.yaml); - if (this.validator != null) { - BindingResult errors = new BeanPropertyBindingResult(this.configuration, - "configuration"); - this.validator.validate(this.configuration, errors); - - if (errors.hasErrors()) { - logger.error("YAML configuration failed validation"); - for (ObjectError error : errors.getAllErrors()) { - logger.error(this.messageSource != null ? this.messageSource - .getMessage(error, Locale.getDefault()) - + " (" - + error - + ")" : error); - } - if (this.exceptionIfInvalid) { - BindException summary = new BindException(errors); - throw summary; - } - } + validate(); } - } catch (YAMLException e) { + } + catch (YAMLException ex) { if (this.exceptionIfInvalid) { - throw e; + throw ex; + } + this.logger.error("Failed to load YAML validation bean. " + + "Your YAML file may be invalid.", ex); + } + } + + private void validate() throws BindException { + BindingResult errors = new BeanPropertyBindingResult(this.configuration, + "configuration"); + this.validator.validate(this.configuration, errors); + + if (errors.hasErrors()) { + this.logger.error("YAML configuration failed validation"); + for (ObjectError error : errors.getAllErrors()) { + this.logger.error(this.messageSource != null ? this.messageSource + .getMessage(error, Locale.getDefault()) + " (" + error + ")" + : error); + } + if (this.exceptionIfInvalid) { + BindException summary = new BindException(errors); + throw summary; } - logger.error( - "Failed to load YAML validation bean. Your YAML file may be invalid.", - e); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java index 2c9e0e61295..3239e346027 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JacksonJsonParser.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.bootstrap.config; import java.util.List; @@ -29,24 +30,24 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class JacksonJsonParser implements JsonParser { @Override + @SuppressWarnings("unchecked") public Map parseMap(String json) { try { - @SuppressWarnings("unchecked") - Map map = new ObjectMapper().readValue(json, Map.class); - return map; - } catch (Exception e) { - throw new IllegalArgumentException("Cannot parse JSON", e); + return new ObjectMapper().readValue(json, Map.class); + } + catch (Exception ex) { + throw new IllegalArgumentException("Cannot parse JSON", ex); } } @Override + @SuppressWarnings("unchecked") public List parseList(String json) { try { - @SuppressWarnings("unchecked") - List list = new ObjectMapper().readValue(json, List.class); - return list; - } catch (Exception e) { - throw new IllegalArgumentException("Cannot parse JSON", e); + return new ObjectMapper().readValue(json, List.class); + } + catch (Exception ex) { + throw new IllegalArgumentException("Cannot parse JSON", ex); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParser.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParser.java index ca0eace394d..fe342652722 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParser.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParser.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.bootstrap.config; import java.util.List; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java index d9c7e8ad8c9..8409bcc1a9a 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/JsonParserFactory.java @@ -26,7 +26,7 @@ import org.springframework.util.ClassUtils; * @see YamlJsonParser * @see SimpleJsonParser */ -public class JsonParserFactory { +public abstract class JsonParserFactory { /** * Static factory for the "best" JSON parser available on the classpath. Tries Jackson diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java index fcf24ab21ef..e609cccfd54 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/SimpleJsonParser.java @@ -39,7 +39,8 @@ public class SimpleJsonParser implements JsonParser { public Map parseMap(String json) { if (json.startsWith("{")) { return parseMapInternal(json); - } else if (json.trim().equals("")) { + } + else if (json.trim().equals("")) { return new HashMap(); } return null; @@ -49,7 +50,8 @@ public class SimpleJsonParser implements JsonParser { public List parseList(String json) { if (json.startsWith("[")) { return parseListInternal(json); - } else if (json.trim().equals("")) { + } + else if (json.trim().equals("")) { return new ArrayList(); } return null; @@ -104,7 +106,8 @@ public class SimpleJsonParser implements JsonParser { trimTrailingCharacter(values[1], '"'), '"'); if (string.startsWith("{") && string.endsWith("}")) { value = parseInternal(string); - } else { + } + else { value = string; } } @@ -129,7 +132,8 @@ public class SimpleJsonParser implements JsonParser { if (current == ',' && inObject == 0) { list.add(build.toString()); build.setLength(0); - } else { + } + else { build.append(current); } index++; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java index e8855e2723f..8c0463923e5 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlJsonParser.java @@ -30,17 +30,15 @@ import org.yaml.snakeyaml.Yaml; public class YamlJsonParser implements JsonParser { @Override + @SuppressWarnings("unchecked") public Map parseMap(String json) { - @SuppressWarnings("unchecked") - Map map = new Yaml().loadAs(json, Map.class); - return map; + return new Yaml().loadAs(json, Map.class); } @Override + @SuppressWarnings("unchecked") public List parseList(String json) { - @SuppressWarnings("unchecked") - List list = new Yaml().loadAs(json, List.class); - return list; + return new Yaml().loadAs(json, List.class); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java index 4d7fee6a09a..f0712783541 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlMapFactoryBean.java @@ -99,7 +99,8 @@ public class YamlMapFactoryBean extends YamlProcessor implements (Map) existing); merge(result, (Map) value); output.put(key, result); - } else { + } + else { output.put(key, value); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java index c33d9cb95e3..059fa3964c6 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/config/YamlProcessor.java @@ -38,35 +38,7 @@ import org.yaml.snakeyaml.Yaml; */ public class YamlProcessor { - public interface MatchCallback { - void process(Properties properties, Map map); - } - - public interface DocumentMatcher { - MatchStatus matches(Properties properties); - } - - private static final Log logger = LogFactory.getLog(YamlProcessor.class); - - public static enum ResolutionMethod { - OVERRIDE, OVERRIDE_AND_IGNORE, FIRST_FOUND - } - - public static enum MatchStatus { - - /** - * A match was found. - */ - FOUND, - /** - * A match was not found. - */ - NOT_FOUND, - /** - * Not enough information to decide. - */ - ABSTAIN - } + private final Log logger = LogFactory.getLog(getClass()); private ResolutionMethod resolutionMethod = ResolutionMethod.OVERRIDE; @@ -139,7 +111,7 @@ public class YamlProcessor { * @param resources the resources to set */ public void setResources(Resource[] resources) { - this.resources = resources; + this.resources = (resources == null ? null : resources.clone()); } /** @@ -154,59 +126,67 @@ public class YamlProcessor { */ protected void process(MatchCallback callback) { Yaml yaml = new Yaml(); - boolean found = false; for (Resource resource : this.resources) { - try { - logger.info("Loading from YAML: " + resource); - int count = 0; - for (Object object : yaml.loadAll(resource.getInputStream())) { - if (this.resolutionMethod != ResolutionMethod.FIRST_FOUND || !found) { - @SuppressWarnings("unchecked") - Map map = (Map) object; - if (map != null) { - found = process(map, callback); - if (found) { - count++; - } - } - } - } - - logger.info("Loaded " + count + " document" + (count > 1 ? "s" : "") - + " from YAML resource: " + resource); - - if (this.resolutionMethod == ResolutionMethod.FIRST_FOUND && found) { - // No need to load any more resources - break; - } - } catch (IOException e) { - if (this.resolutionMethod == ResolutionMethod.FIRST_FOUND - || this.resolutionMethod == ResolutionMethod.OVERRIDE_AND_IGNORE) { - if (logger.isWarnEnabled()) { - logger.warn("Could not load map from " + resource + ": " - + e.getMessage()); - } - } else { - throw new IllegalStateException(e); - } + boolean found = process(callback, yaml, resource); + if (this.resolutionMethod == ResolutionMethod.FIRST_FOUND && found) { + return; } } } + private boolean process(MatchCallback callback, Yaml yaml, Resource resource) { + int count = 0; + try { + this.logger.info("Loading from YAML: " + resource); + for (Object object : yaml.loadAll(resource.getInputStream())) { + if (object != null && process(asMap(object), callback)) { + count++; + if (this.resolutionMethod == ResolutionMethod.FIRST_FOUND) { + break; + } + } + } + this.logger.info("Loaded " + count + " document" + (count > 1 ? "s" : "") + + " from YAML resource: " + resource); + } + catch (IOException ex) { + handleProcessError(resource, ex); + } + return count > 0; + } + + private void handleProcessError(Resource resource, IOException ex) { + if (this.resolutionMethod != ResolutionMethod.FIRST_FOUND + && this.resolutionMethod != ResolutionMethod.OVERRIDE_AND_IGNORE) { + throw new IllegalStateException(ex); + } + if (this.logger.isWarnEnabled()) { + this.logger.warn("Could not load map from " + resource + ": " + + ex.getMessage()); + } + } + + @SuppressWarnings("unchecked") + private Map asMap(Object object) { + return (Map) object; + } + private boolean process(Map map, MatchCallback callback) { Properties properties = new Properties(); assignProperties(properties, map, null); if (this.documentMatchers.isEmpty()) { - logger.debug("Merging document (no matchers set)" + map); + this.logger.debug("Merging document (no matchers set)" + map); callback.process(properties, map); - } else { + } + else { boolean valueFound = false; MatchStatus result = MatchStatus.ABSTAIN; for (DocumentMatcher matcher : this.documentMatchers) { MatchStatus match = matcher.matches(properties); result = match.ordinal() < result.ordinal() ? match : result; if (match == MatchStatus.FOUND) { - logger.debug("Matched document with document matcher: " + properties); + this.logger.debug("Matched document with document matcher: " + + properties); callback.process(properties, map); valueFound = true; // No need to check for more matches @@ -214,10 +194,11 @@ public class YamlProcessor { } } if (result == MatchStatus.ABSTAIN && this.matchDefault) { - logger.debug("Matched document with default matcher: " + map); + this.logger.debug("Matched document with default matcher: " + map); callback.process(properties, map); - } else if (!valueFound) { - logger.debug("Unmatched document"); + } + else if (!valueFound) { + this.logger.debug("Unmatched document"); return false; } } @@ -231,19 +212,22 @@ public class YamlProcessor { if (StringUtils.hasText(path)) { if (key.startsWith("[")) { key = path + key; - } else { + } + else { key = path + "." + key; } } Object value = entry.getValue(); if (value instanceof String) { properties.put(key, value); - } else if (value instanceof Map) { + } + else if (value instanceof Map) { // Need a compound key @SuppressWarnings("unchecked") Map map = (Map) value; assignProperties(properties, map, key); - } else if (value instanceof Collection) { + } + else if (value instanceof Collection) { // Need a compound key @SuppressWarnings("unchecked") Collection collection = (Collection) value; @@ -254,19 +238,33 @@ public class YamlProcessor { assignProperties(properties, Collections.singletonMap("[" + (count++) + "]", object), key); } - } else { + } + else { properties.put(key, value == null ? "" : value); } } } + public interface MatchCallback { + void process(Properties properties, Map map); + } + + public interface DocumentMatcher { + MatchStatus matches(Properties properties); + } + + public static enum ResolutionMethod { + OVERRIDE, OVERRIDE_AND_IGNORE, FIRST_FOUND + } + + public static enum MatchStatus { + FOUND, NOT_FOUND, ABSTAIN + } + /** * Matches a document containing a given key and where the value of that key is an * array containing one of the given values, or where one of the values matches one of * the given values (interpreted as regexes). - * - * @author Dave Syer - * */ public static class ArrayDocumentMatcher implements DocumentMatcher { diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AbstractOnBeanCondition.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/AbstractOnBeanCondition.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AbstractOnBeanCondition.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/AbstractOnBeanCondition.java index 7c827372740..aeac65a736b 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AbstractOnBeanCondition.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/AbstractOnBeanCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.reflect.Method; import java.util.ArrayList; @@ -43,7 +43,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback; */ abstract class AbstractOnBeanCondition implements ConfigurationCondition { - protected Log logger = LogFactory.getLog(getClass()); + private final Log logger = LogFactory.getLog(getClass()); protected abstract Class annotationClass(); @@ -78,7 +78,9 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition { } } }); - } catch (Exception e) { + } + catch (Exception ex) { + // swallow exception and continue } } } @@ -116,7 +118,9 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition { if (beans.length != 0) { beanClassesFound.add(beanClass); } - } catch (ClassNotFoundException ex) { + } + catch (ClassNotFoundException ex) { + // swallow exception and continue } } for (String beanName : beanNames) { @@ -142,7 +146,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition { + candidates); if (found.isEmpty()) { this.logger.debug(prefix + "Found no beans"); - } else { + } + else { this.logger.debug(prefix + "Found beans with " + type + ": " + found); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionLogUtils.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionLogUtils.java similarity index 93% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionLogUtils.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionLogUtils.java index 0610901c131..7ab5c397187 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionLogUtils.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionLogUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.apache.commons.logging.Log; import org.springframework.core.type.AnnotatedTypeMetadata; @@ -26,7 +26,7 @@ import org.springframework.core.type.MethodMetadata; * * @author Dave Syer */ -public class ConditionLogUtils { +public abstract class ConditionLogUtils { public static String getPrefix(Log logger, AnnotatedTypeMetadata metadata) { String prefix = ""; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnBean.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnBean.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnBean.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnBean.java index 1a1f1ee2817..c9a795c12f7 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnBean.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnClass.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnClass.java similarity index 96% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnClass.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnClass.java index c8ab5dd60d3..6721801fbea 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnClass.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnClass.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnExpression.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnExpression.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnExpression.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnExpression.java index a18b0870949..2f38e4f29a0 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnExpression.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnExpression.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingBean.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnMissingBean.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingBean.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnMissingBean.java index 295a46efa76..c15194f57b4 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingBean.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnMissingBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingClass.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnMissingClass.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingClass.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnMissingClass.java index 67821759681..5e0bfa45efe 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnMissingClass.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnMissingClass.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnNotWebApplication.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnNotWebApplication.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnNotWebApplication.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnNotWebApplication.java index 6eadf97dda8..f98289d9fd5 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnNotWebApplication.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnNotWebApplication.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnResource.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnResource.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnResource.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnResource.java index 718a0007d82..4123513d08e 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnResource.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnResource.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnWebApplication.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnWebApplication.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnWebApplication.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnWebApplication.java index 24ffa8f6224..cbe6256ba8b 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConditionalOnWebApplication.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/ConditionalOnWebApplication.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnBeanCondition.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnBeanCondition.java similarity index 94% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnBeanCondition.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnBeanCondition.java index 990424107e3..70f378c6174 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnBeanCondition.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnBeanCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.springframework.context.annotation.Condition; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnClassCondition.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnClassCondition.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnClassCondition.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnClassCondition.java index dc7f15acea3..8b051929edf 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnClassCondition.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnClassCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.util.ArrayList; import java.util.List; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnExpressionCondition.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnExpressionCondition.java similarity index 98% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnExpressionCondition.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnExpressionCondition.java index d883e48189b..b21a3db2dd2 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnExpressionCondition.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnExpressionCondition.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; + +package org.springframework.bootstrap.context.condition; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingBeanCondition.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnMissingBeanCondition.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingBeanCondition.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnMissingBeanCondition.java index 17bacf9054a..e13ca077fb8 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingBeanCondition.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnMissingBeanCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.util.List; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingClassCondition.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnMissingClassCondition.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingClassCondition.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnMissingClassCondition.java index 4ea8fa40d84..a9d53bcdc01 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnMissingClassCondition.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnMissingClassCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.util.ArrayList; import java.util.List; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnNotWebApplicationCondition.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnNotWebApplicationCondition.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnNotWebApplicationCondition.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnNotWebApplicationCondition.java index e11190121d7..1aa96c10341 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnNotWebApplicationCondition.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnNotWebApplicationCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnResourceCondition.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnResourceCondition.java similarity index 98% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnResourceCondition.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnResourceCondition.java index 6e38329a462..60898e4635e 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnResourceCondition.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnResourceCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.util.ArrayList; import java.util.List; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnWebApplicationCondition.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnWebApplicationCondition.java similarity index 97% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnWebApplicationCondition.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnWebApplicationCondition.java index 420e5650779..4aea37fbcaf 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/OnWebApplicationCondition.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/condition/OnWebApplicationCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java index 228d8c1ce7e..434e7a28348 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactory.java @@ -77,7 +77,8 @@ public abstract class AbstractEmbeddedServletContainerFactory implements * @param port the port number for the embedded servlet container */ public AbstractEmbeddedServletContainerFactory(int port) { - setPort(port); + checkPort(port); + this.port = port; } /** @@ -87,8 +88,10 @@ public abstract class AbstractEmbeddedServletContainerFactory implements * @param port the port number for the embedded servlet container */ public AbstractEmbeddedServletContainerFactory(String contextPath, int port) { - setContextPath(contextPath); - setPort(port); + checkContextPath(contextPath); + checkPort(port); + this.contextPath = contextPath; + this.port = port; } /** @@ -98,7 +101,13 @@ public abstract class AbstractEmbeddedServletContainerFactory implements * @param contextPath the contextPath to set * @see #getContextPath */ + @Override public void setContextPath(String contextPath) { + checkContextPath(contextPath); + this.contextPath = contextPath; + } + + private void checkContextPath(String contextPath) { Assert.notNull(contextPath, "ContextPath must not be null"); if (contextPath.length() > 0) { if ("/".equals(contextPath)) { @@ -110,13 +119,13 @@ public abstract class AbstractEmbeddedServletContainerFactory implements "ContextPath must start with '/ and not end with '/'"); } } - this.contextPath = contextPath; } /** * 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,16 +136,22 @@ public abstract class AbstractEmbeddedServletContainerFactory implements * * @param port the port to set */ + @Override public void setPort(int port) { + checkPort(port); + this.port = port; + } + + private void checkPort(int port) { if (port < 0 || port > 65535) { throw new IllegalArgumentException("Port must be between 1 and 65535"); } - this.port = port; } /** * Returns the port that the embedded servlet container should listen on. */ + @Override public int getPort() { return this.port; } @@ -146,6 +161,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 +169,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); @@ -326,32 +344,33 @@ public abstract class AbstractEmbeddedServletContainerFactory implements * warning and returning {@code null} otherwise. */ protected final File getValidDocumentRoot() { - - // User specified - if (getDocumentRoot() != null) { - return getDocumentRoot(); + File file = getDocumentRoot(); + file = file != null ? file : getWarFileDocumentRoot(); + file = file != null ? file : getCommonDocumentRoot(); + if (file == null && this.logger.isWarnEnabled()) { + this.logger.warn("None of the document roots " + + Arrays.asList(COMMON_DOC_ROOTS) + + " point to a directory and will be ignored."); } + return file; + } - // Packaged as a WAR file + private File getWarFileDocumentRoot() { File warFile = getCodeSourceArchive(); if (warFile.exists() && !warFile.isDirectory() && warFile.getName().toLowerCase().endsWith(".war")) { return warFile.getAbsoluteFile(); } + return null; + } - // Common DocRoots + private File getCommonDocumentRoot() { for (String commonDocRoot : COMMON_DOC_ROOTS) { File root = new File(commonDocRoot); if (root != null && root.exists() && root.isDirectory()) { return root.getAbsoluteFile(); } } - - if (this.logger.isWarnEnabled()) { - this.logger.warn("None of the document roots " - + Arrays.asList(COMMON_DOC_ROOTS) - + " point to a directory and will be ignored."); - } return null; } @@ -371,7 +390,8 @@ public abstract class AbstractEmbeddedServletContainerFactory implements path = path.substring(0, path.indexOf("!/")); } return new File(path); - } catch (IOException e) { + } + catch (IOException ex) { return null; } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java index 0e138efcda7..3bf7739b1bd 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java @@ -16,6 +16,7 @@ package org.springframework.bootstrap.context.embedded; +import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.context.annotation.AnnotatedBeanDefinitionReader; @@ -152,7 +153,7 @@ public class AnnotationConfigEmbeddedWebApplicationContext extends * @see #scan(String...) * @see #refresh() */ - public void register(Class... annotatedClasses) { + public final void register(Class... annotatedClasses) { this.annotatedClasses = annotatedClasses; Assert.notEmpty(annotatedClasses, "At least one annotated class must be specified"); @@ -165,7 +166,7 @@ public class AnnotationConfigEmbeddedWebApplicationContext extends * @see #register(Class...) * @see #refresh() */ - public void scan(String... basePackages) { + public final void scan(String... basePackages) { this.basePackages = basePackages; Assert.notEmpty(basePackages, "At least one base package must be specified"); } @@ -187,4 +188,9 @@ public class AnnotationConfigEmbeddedWebApplicationContext extends } } + @Override + public final void refresh() throws BeansException, IllegalStateException { + super.refresh(); + } + } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java index 7014ff74c49..32f876678a1 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.bootstrap.context.embedded; import java.util.ArrayList; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java index 6398459c338..cad231892bf 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContext.java @@ -131,12 +131,14 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext EmbeddedServletContainerFactory containerFactory = getEmbeddedServletContainerFactory(); this.embeddedServletContainer = containerFactory .getEmbeddedServletContainer(getSelfInitializer()); - } else if (getServletContext() != null) { + } + else if (getServletContext() != null) { try { getSelfInitializer().onStartup(getServletContext()); - } catch (ServletException e) { + } + catch (ServletException ex) { throw new ApplicationContextException( - "Cannot initialize servlet context", e); + "Cannot initialize servlet context", ex); } } WebApplicationContextUtils.registerWebApplicationScopes(getBeanFactory(), @@ -204,9 +206,6 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext if (initializer instanceof RegistrationBean) { targets.add(((RegistrationBean) initializer).getRegistrationTarget()); } - if (initializer instanceof ServletRegistrationBean) { - targets.addAll(((ServletRegistrationBean) initializer).getFilters()); - } initializers.add(initializer); } @@ -280,12 +279,14 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext logger.info("Root WebApplicationContext: initialization completed in " + elapsedTime + " ms"); } - } catch (RuntimeException ex) { + } + catch (RuntimeException ex) { logger.error("Context initialization failed", ex); servletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex); throw ex; - } catch (Error err) { + } + catch (Error err) { logger.error("Context initialization failed", err); servletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, err); @@ -312,7 +313,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext try { this.embeddedServletContainer.stop(); this.embeddedServletContainer = null; - } catch (Exception ex) { + } + catch (Exception ex) { throw new IllegalStateException(ex); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java index 52fdd38024d..9cbca04c681 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/FilterRegistrationBean.java @@ -84,8 +84,13 @@ public class FilterRegistrationBean extends RegistrationBean { */ public FilterRegistrationBean(Filter filter, ServletRegistrationBean... servletRegistrationBeans) { - setFilter(filter); - addServletRegistrationBeans(servletRegistrationBeans); + Assert.notNull(filter, "Filter must not be null"); + Assert.notNull(servletRegistrationBeans, + "ServletRegistrationBeans must not be null"); + this.filter = filter; + for (ServletRegistrationBean servletRegistrationBean : servletRegistrationBeans) { + this.servletRegistrationBeans.add(servletRegistrationBean); + } } /** @@ -244,7 +249,8 @@ public class FilterRegistrationBean extends RegistrationBean { if (servletNames.isEmpty() && this.urlPatterns.isEmpty()) { registration.addMappingForUrlPatterns(dispatcherTypes, this.matchAfter, DEFAULT_URL_MAPPINGS); - } else { + } + else { if (servletNames.size() > 0) { registration.addMappingForServletNames(dispatcherTypes, this.matchAfter, servletNames.toArray(new String[servletNames.size()])); diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java index a5022ec1ce6..7f0a3cbf11a 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBean.java @@ -21,7 +21,6 @@ import java.util.Collection; import java.util.LinkedHashSet; import java.util.Set; -import javax.servlet.Filter; import javax.servlet.MultipartConfigElement; import javax.servlet.Servlet; import javax.servlet.ServletContext; @@ -55,8 +54,6 @@ public class ServletRegistrationBean extends RegistrationBean { private int loadOnStartup = 1; - private Set filters = new LinkedHashSet(); - private MultipartConfigElement multipartConfig; /** @@ -72,8 +69,10 @@ public class ServletRegistrationBean extends RegistrationBean { * @param urlMappings the URLs being mapped */ public ServletRegistrationBean(Servlet servlet, String... urlMappings) { - setServlet(servlet); - addUrlMappings(urlMappings); + Assert.notNull(servlet, "Servlet must not be null"); + Assert.notNull(urlMappings, "UrlMappings must not be null"); + this.servlet = servlet; + this.urlMappings.addAll(Arrays.asList(urlMappings)); } /** @@ -121,32 +120,6 @@ public class ServletRegistrationBean extends RegistrationBean { this.loadOnStartup = loadOnStartup; } - /** - * Sets any Filters that should be registered to this servlet. Any previously - * specified Filters will be replaced. - * @param filters the Filters to set - */ - public void setFilters(Collection filters) { - Assert.notNull(filters, "Filters must not be null"); - this.filters = new LinkedHashSet(filters); - } - - /** - * Returns a mutable collection of the Filters being registered with this servlet. - */ - public Collection getFilters() { - return this.filters; - } - - /** - * Add Filters that will be registered with this servlet. - * @param filters the Filters to add - */ - public void addFilters(Filter... filters) { - Assert.notNull(filters, "Filters must not be null"); - this.filters.addAll(Arrays.asList(filters)); - } - /** * Set the the {@link MultipartConfigElement multi-part configuration}. * @param multipartConfig the muti-part configuration to set or {@code null} @@ -179,12 +152,6 @@ public class ServletRegistrationBean extends RegistrationBean { public void onStartup(ServletContext servletContext) throws ServletException { Assert.notNull(this.servlet, "Servlet must not be null"); configure(servletContext.addServlet(getServletName(), this.servlet)); - for (Filter filter : this.filters) { - FilterRegistrationBean filterRegistration = new FilterRegistrationBean( - filter, this); - filterRegistration.setAsyncSupported(isAsyncSupported()); - filterRegistration.onStartup(servletContext); - } } /** diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java index e3550694e24..bec96588509 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/XmlEmbeddedWebApplicationContext.java @@ -16,6 +16,7 @@ package org.springframework.bootstrap.context.embedded; +import org.springframework.beans.BeansException; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.io.ClassPathResource; @@ -46,7 +47,7 @@ public class XmlEmbeddedWebApplicationContext extends EmbeddedWebApplicationCont * {@linkplain #load loaded} and then manually {@link #refresh refreshed}. */ public XmlEmbeddedWebApplicationContext() { - reader.setEnvironment(this.getEnvironment()); + this.reader.setEnvironment(this.getEnvironment()); } /** @@ -105,7 +106,7 @@ public class XmlEmbeddedWebApplicationContext extends EmbeddedWebApplicationCont * Load bean definitions from the given XML resources. * @param resources one or more resources to load from */ - public void load(Resource... resources) { + public final void load(Resource... resources) { this.reader.loadBeanDefinitions(resources); } @@ -113,7 +114,7 @@ public class XmlEmbeddedWebApplicationContext extends EmbeddedWebApplicationCont * Load bean definitions from the given XML resources. * @param resourceLocations one or more resource locations to load from */ - public void load(String... resourceLocations) { + public final void load(String... resourceLocations) { this.reader.loadBeanDefinitions(resourceLocations); } @@ -123,11 +124,16 @@ public class XmlEmbeddedWebApplicationContext extends EmbeddedWebApplicationCont * specified resource name * @param resourceNames relatively-qualified names of resources to load */ - public void load(Class relativeClass, String... resourceNames) { + public final void load(Class relativeClass, String... resourceNames) { Resource[] resources = new Resource[resourceNames.length]; for (int i = 0; i < resourceNames.length; i++) { resources[i] = new ClassPathResource(resourceNames[i], relativeClass); } - this.load(resources); + this.reader.loadBeanDefinitions(resources); + } + + @Override + public final void refresh() throws BeansException, IllegalStateException { + super.refresh(); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java index b170d48805e..9d2c4c57203 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainer.java @@ -46,7 +46,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { private synchronized void start() { try { this.server.start(); - } catch (Exception ex) { + } + catch (Exception ex) { throw new EmbeddedServletContainerException( "Unable to start embedded Jetty servlet container", ex); } @@ -56,10 +57,12 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { public synchronized void stop() { try { this.server.stop(); - } catch (InterruptedException ex) { + } + catch (InterruptedException ex) { Thread.currentThread().interrupt(); // No drama - } catch (Exception ex) { + } + catch (Exception ex) { throw new EmbeddedServletContainerException( "Unable to stop embedded Jetty servlet container", ex); } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java index 118754fd1e4..512b2ba7666 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java @@ -132,7 +132,8 @@ public class JettyEmbeddedServletContainerFactory extends if (root != null) { try { handler.setBaseResource(Resource.newResource(root)); - } catch (Exception ex) { + } + catch (Exception ex) { throw new IllegalStateException(ex); } } @@ -270,11 +271,13 @@ public class JettyEmbeddedServletContainerFactory extends if (errorPage.isGlobal()) { handler.addErrorPage(ErrorPageErrorHandler.GLOBAL_ERROR_PAGE, errorPage.getPath()); - } else { + } + else { if (errorPage.getExceptionName() != null) { handler.addErrorPage(errorPage.getExceptionName(), errorPage.getPath()); - } else { + } + else { handler.addErrorPage(errorPage.getStatusCode(), errorPage.getPath()); } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/properties/ServerProperties.java similarity index 51% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/properties/ServerProperties.java index 5a26e7c2f4e..578862435bd 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/properties/ServerProperties.java @@ -14,22 +14,32 @@ * limitations under the License. */ -package org.springframework.bootstrap.properties; +package org.springframework.bootstrap.context.embedded.properties; import java.io.File; import java.net.InetAddress; import javax.validation.constraints.NotNull; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; +import org.apache.catalina.valves.AccessLogValve; +import org.apache.catalina.valves.RemoteIpValve; +import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; +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.tomcat.TomcatEmbeddedServletContainerFactory; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; +import org.springframework.util.StringUtils; /** - * Properties for the web server (e.g. port and path settings). + * {@link ConfigurationProperties properties} for a web server (e.g. port and path + * settings). Will be used to customize an {@link EmbeddedServletContainerFactory} when an + * {@link EmbeddedServletContainerCustomizerBeanPostProcessor} is active. * * @author Dave Syer */ @ConfigurationProperties(name = "server", ignoreUnknownFields = false) -public class ServerProperties { +public class ServerProperties implements EmbeddedServletContainerCustomizer { private int port = 8080; @@ -68,8 +78,14 @@ public class ServerProperties { this.address = address; } - public void setLoader(String value) { - // no op + @Override + public void customize(ConfigurableEmbeddedServletContainerFactory factory) { + factory.setPort(getPort()); + factory.setAddress(getAddress()); + factory.setContextPath(getContextPath()); + if (factory instanceof TomcatEmbeddedServletContainerFactory) { + getTomcat().customizeTomcat((TomcatEmbeddedServletContainerFactory) factory); + } } public static class Tomcat { @@ -114,6 +130,30 @@ public class ServerProperties { this.remoteIpHeader = remoteIpHeader; } + void customizeTomcat(TomcatEmbeddedServletContainerFactory factory) { + if (getBasedir() != null) { + factory.setBaseDirectory(getBasedir()); + } + + String remoteIpHeader = getRemoteIpHeader(); + String protocolHeader = getProtocolHeader(); + if (StringUtils.hasText(remoteIpHeader) + || StringUtils.hasText(protocolHeader)) { + RemoteIpValve valve = new RemoteIpValve(); + valve.setRemoteIpHeader(remoteIpHeader); + valve.setProtocolHeader(protocolHeader); + factory.addContextValves(valve); + } + + String accessLogPattern = getAccessLogPattern(); + if (accessLogPattern != null) { + AccessLogValve valve = new AccessLogValve(); + valve.setPattern(accessLogPattern); + valve.setSuffix(".log"); + factory.addContextValves(valve); + } + } + } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java index dc0d42a56aa..94452e4f9b8 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java @@ -52,7 +52,8 @@ public class ServletContextInitializerLifecycleListener implements LifecycleList for (ServletContextInitializer initializer : this.initializers) { try { initializer.onStartup(standardContext.getServletContext()); - } catch (ServletException ex) { + } + catch (ServletException ex) { throw new IllegalStateException(ex); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java index 6d59057fce4..3d1d6d54f26 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainer.java @@ -57,7 +57,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer }; awaitThread.setDaemon(false); awaitThread.start(); - } catch (Exception ex) { + } + catch (Exception ex) { throw new EmbeddedServletContainerException( "Unable to start embdedded Tomcat", ex); } @@ -68,10 +69,13 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer try { try { this.tomcat.stop(); - } catch (LifecycleException e) { + } + catch (LifecycleException ex) { + // swallow and continue } this.tomcat.destroy(); - } catch (Exception ex) { + } + catch (Exception ex) { throw new EmbeddedServletContainerException( "Unable to stop embdedded Tomcat", ex); } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java index 42bd98c1f9a..66983895be6 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java @@ -118,7 +118,8 @@ public class TomcatEmbeddedServletContainerFactory extends this.connector.setPort(getPort()); this.tomcat.getService().addConnector(this.connector); this.tomcat.setConnector(this.connector); - } else { + } + else { Connector connector = new Connector( "org.apache.coyote.http11.Http11NioProtocol"); customizeConnector(connector); @@ -246,7 +247,8 @@ public class TomcatEmbeddedServletContainerFactory extends tempFolder.mkdir(); tempFolder.deleteOnExit(); return tempFolder; - } catch (IOException ex) { + } + catch (IOException ex) { throw new EmbeddedServletContainerException( "Unable to create Tomcat tempdir", ex); } @@ -336,6 +338,8 @@ public class TomcatEmbeddedServletContainerFactory extends this.contextLifecycleListeners.addAll(Arrays.asList(contextLifecycleListeners)); } + // FIXME JavaDoc + // FIXME Is this still needed? public TomcatEmbeddedServletContainerFactory getChildContextFactory(final String name) { final Server server = this.tomcat.getServer(); diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java index 7c478bcc7cc..5133c086fe3 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ConfigFileApplicationContextInitializer.java @@ -23,10 +23,10 @@ import java.util.List; import java.util.Properties; import java.util.Set; +import org.springframework.bootstrap.config.YamlPropertiesFactoryBean; import org.springframework.bootstrap.config.YamlProcessor.ArrayDocumentMatcher; import org.springframework.bootstrap.config.YamlProcessor.DocumentMatcher; import org.springframework.bootstrap.config.YamlProcessor.MatchStatus; -import org.springframework.bootstrap.config.YamlPropertiesFactoryBean; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.PropertySource; @@ -82,7 +82,7 @@ public class ConfigFileApplicationContextInitializer implements @Override public void initialize(ConfigurableApplicationContext applicationContext) { - List candidates = getCandidateLocations(applicationContext); + List candidates = getCandidateLocations(); // Initial load allows profiles to be activated for (String candidate : candidates) { @@ -97,8 +97,7 @@ public class ConfigFileApplicationContextInitializer implements } } - private List getCandidateLocations( - ConfigurableApplicationContext applicationContext) { + private List getCandidateLocations() { List candidates = new ArrayList(); for (String searchLocation : this.searchLocations) { for (Loader loader : LOADERS) { @@ -150,7 +149,7 @@ public class ConfigFileApplicationContextInitializer implements * Set the search locations that will be considered. */ public void setSearchLocations(String[] searchLocations) { - this.searchLocations = searchLocations; + this.searchLocations = (searchLocations == null ? null : searchLocations.clone()); } /** @@ -194,13 +193,15 @@ public class ConfigFileApplicationContextInitializer implements new PropertiesPropertySource(resource.getDescription(), properties)); - } else { + } + else { propertySources.addFirst(new PropertiesPropertySource(resource .getDescription(), properties)); } - } catch (IOException e) { + } + catch (IOException ex) { throw new IllegalStateException("Could not load properties file from " - + resource, e); + + resource, ex); } } @@ -252,7 +253,8 @@ public class ConfigFileApplicationContextInitializer implements } // matches default profile return MatchStatus.FOUND; - } else { + } + else { return MatchStatus.NOT_FOUND; } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java index 450e56e1c62..c2c1f1b23a4 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializer.java @@ -77,7 +77,8 @@ public class ContextIdApplicationContextInitializer implements index = environment.getProperty("spring.application.index", Integer.class, index); if (index >= 0) { name = name + ":" + index; - } else { + } + else { // FIXME do we want this String profiles = StringUtils.arrayToCommaDelimitedString(environment .getActiveProfiles()); diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java index 572dec3a372..8f765bb0c75 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializer.java @@ -95,7 +95,8 @@ public class EnvironmentDelegateApplicationContextInitializer implements "class [" + className + "] must implement ApplicationContextInitializer"); classes.add((Class>) clazz); - } catch (ClassNotFoundException ex) { + } + catch (ClassNotFoundException ex) { throw new ApplicationContextException( "Failed to load context initializer class [" + className + "]", ex); diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java index 06311634e31..f40e90c849f 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/LoggingApplicationContextInitializer.java @@ -170,13 +170,11 @@ public class LoggingApplicationContextInitializer implements String configLocation = getConfigLocation(applicationContext); try { doInit(applicationContext, configLocation); - } catch (RuntimeException ex) { - throw ex; - } catch (Exception ex) { + } + catch (Exception ex) { throw new IllegalStateException("Cannot initialize logging from " + configLocation, ex); } - } protected abstract void doInit(ApplicationContext applicationContext, diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java index 33f6d7ac3e2..b1470162913 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializer.java @@ -121,7 +121,8 @@ public class VcapApplicationContextInitializer implements CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME, new PropertiesPropertySource("vcap", properties)); - } else { + } + else { propertySources.addFirst(new PropertiesPropertySource("vcap", properties)); } @@ -168,19 +169,22 @@ public class VcapApplicationContextInitializer implements if (StringUtils.hasText(path)) { if (key.startsWith("[")) { key = path + key; - } else { + } + else { key = path + "." + key; } } Object value = entry.getValue(); if (value instanceof String) { properties.put(key, value); - } else if (value instanceof Map) { + } + else if (value instanceof Map) { // Need a compound key @SuppressWarnings("unchecked") Map map = (Map) value; flatten(properties, map, key); - } else if (value instanceof Collection) { + } + else if (value instanceof Collection) { // Need a compound key @SuppressWarnings("unchecked") Collection collection = (Collection) value; @@ -191,7 +195,8 @@ public class VcapApplicationContextInitializer implements flatten(properties, Collections.singletonMap("[" + (count++) + "]", object), key); } - } else { + } + else { properties.put(key, value == null ? "" : value); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationProperties.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationProperties.java similarity index 95% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationProperties.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationProperties.java index cb407ee8392..936a79b91e5 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationProperties.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.properties; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -26,7 +26,7 @@ import java.lang.annotation.Target; * Annotation for externalized configuration. Add this to a class definition if you want * to bind and validate some external Properties (e.g. from a .properties file). * - * @see PropertySourcesBindingPostProcessor + * @see ConfigurationPropertiesBindingPostProcessor * * @author Dave Syer */ diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationPropertiesBindingConfiguration.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationPropertiesBindingConfiguration.java similarity index 91% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationPropertiesBindingConfiguration.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationPropertiesBindingConfiguration.java index 39ac0d3ec18..1d5fb675c92 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/ConfigurationPropertiesBindingConfiguration.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationPropertiesBindingConfiguration.java @@ -14,10 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.properties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.bootstrap.context.condition.ConditionalOnClass; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -72,20 +74,22 @@ public class ConfigurationPropertiesBindingConfiguration { * @return a bean post processor to bind application properties */ @Bean - public PropertySourcesBindingPostProcessor propertySourcesBinder() { + public ConfigurationPropertiesBindingPostProcessor propertySourcesBinder() { PropertySources propertySources; if (this.configurer != null) { propertySources = extractPropertySources(this.configurer); - } else if (this.environment instanceof ConfigurableEnvironment) { + } + else if (this.environment instanceof ConfigurableEnvironment) { propertySources = flattenPropertySources(((ConfigurableEnvironment) this.environment) .getPropertySources()); - } else { + } + else { // empty, so not very useful, but fulfils the contract propertySources = new MutablePropertySources(); } - PropertySourcesBindingPostProcessor processor = new PropertySourcesBindingPostProcessor(); + ConfigurationPropertiesBindingPostProcessor processor = new ConfigurationPropertiesBindingPostProcessor(); processor.setValidator(this.validator); processor.setConversionService(this.conversionService); processor.setPropertySources(propertySources); @@ -121,7 +125,8 @@ public class ConfigurationPropertiesBindingConfiguration { for (PropertySource childSource : environment.getPropertySources()) { flattenPropertySources(childSource, result); } - } else { + } + else { result.addLast(propertySource); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/PropertySourcesBindingPostProcessor.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationPropertiesBindingPostProcessor.java similarity index 68% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/PropertySourcesBindingPostProcessor.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationPropertiesBindingPostProcessor.java index c5046d3a0c5..6494d83424a 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/PropertySourcesBindingPostProcessor.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.properties; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanCreationException; @@ -23,12 +23,12 @@ import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.bootstrap.bind.PropertiesConfigurationFactory; -import org.springframework.bootstrap.context.annotation.EnableConfigurationPropertiesImportSelector.ConfigurationPropertiesHolder; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.core.env.PropertySources; +import org.springframework.util.StringUtils; import org.springframework.validation.Validator; /** @@ -37,7 +37,7 @@ import org.springframework.validation.Validator; * * @author Dave Syer */ -public class PropertySourcesBindingPostProcessor implements BeanPostProcessor, +public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProcessor, BeanFactoryAware { private PropertySources propertySources; @@ -89,42 +89,41 @@ public class PropertySourcesBindingPostProcessor implements BeanPostProcessor, throws BeansException { ConfigurationProperties annotation = AnnotationUtils.findAnnotation( bean.getClass(), ConfigurationProperties.class); - Object target = bean; if (annotation != null || bean instanceof ConfigurationPropertiesHolder) { - if (bean instanceof ConfigurationPropertiesHolder) { - target = ((ConfigurationPropertiesHolder) bean).getTarget(); - } - PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory( - target); - factory.setPropertySources(this.propertySources); - factory.setValidator(this.validator); - // If no explicit conversion service is provided we add one so that (at least) - // comma-separated arrays of convertibles can be bound automatically - factory.setConversionService(this.conversionService == null ? getDefaultConversionService() - : this.conversionService); - String targetName = null; - if (annotation != null) { - factory.setIgnoreInvalidFields(annotation.ignoreInvalidFields()); - factory.setIgnoreUnknownFields(annotation.ignoreUnknownFields()); - targetName = "".equals(annotation.value()) ? ("" - .equals(annotation.name()) ? null : annotation.name()) - : annotation.value(); - } - factory.setTargetName(targetName); - try { - target = factory.getObject(); // throwaway - } catch (BeansException e) { - throw e; - } catch (Exception e) { - throw new BeanCreationException(beanName, "Could not bind", e); - } + postProcessAfterInitialization(bean, beanName, annotation); } return bean; } - /** - * @return - */ + private void postProcessAfterInitialization(Object bean, String beanName, + ConfigurationProperties annotation) { + Object target = (bean instanceof ConfigurationPropertiesHolder ? ((ConfigurationPropertiesHolder) bean) + .getTarget() : bean); + PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory( + target); + factory.setPropertySources(this.propertySources); + factory.setValidator(this.validator); + // If no explicit conversion service is provided we add one so that (at least) + // comma-separated arrays of convertibles can be bound automatically + factory.setConversionService(this.conversionService == null ? getDefaultConversionService() + : this.conversionService); + if (annotation != null) { + factory.setIgnoreInvalidFields(annotation.ignoreInvalidFields()); + factory.setIgnoreUnknownFields(annotation.ignoreUnknownFields()); + String targetName = (StringUtils.hasLength(annotation.value()) ? annotation + .value() : annotation.name()); + if (StringUtils.hasLength(targetName)) { + factory.setTargetName(targetName); + } + } + try { + factory.bindPropertiesToTarget(); + } + catch (Exception ex) { + throw new BeanCreationException(beanName, "Could not bind properties", ex); + } + } + private ConversionService getDefaultConversionService() { if (!this.initialized && this.beanFactory instanceof ListableBeanFactory) { for (Converter converter : ((ListableBeanFactory) this.beanFactory) diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationPropertiesHolder.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationPropertiesHolder.java new file mode 100644 index 00000000000..2e6f9bdc007 --- /dev/null +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/ConfigurationPropertiesHolder.java @@ -0,0 +1,37 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.properties; + +/** + * Properties holder registered by {@link EnableConfigurationPropertiesImportSelector} to + * be picked up by {@link ConfigurationPropertiesBindingPostProcessor}. + * + * @author Dave Syer + */ +class ConfigurationPropertiesHolder { + + private Object target; + + public ConfigurationPropertiesHolder(Object target) { + this.target = target; + } + + public Object getTarget() { + return this.target; + } + +} \ No newline at end of file diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationProperties.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/EnableConfigurationProperties.java similarity index 96% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationProperties.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/EnableConfigurationProperties.java index e79b0000dae..90880b6f55b 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationProperties.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/EnableConfigurationProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.properties; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesImportSelector.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/EnableConfigurationPropertiesImportSelector.java similarity index 74% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesImportSelector.java rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/EnableConfigurationPropertiesImportSelector.java index 3742ea76e75..95c170621fe 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesImportSelector.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/properties/EnableConfigurationPropertiesImportSelector.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.properties; import java.util.ArrayList; import java.util.List; +import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; @@ -39,7 +40,7 @@ import org.springframework.util.MultiValueMap; * * @author Dave Syer */ -public class EnableConfigurationPropertiesImportSelector implements ImportSelector { +class EnableConfigurationPropertiesImportSelector implements ImportSelector { @Override public String[] selectImports(AnnotationMetadata metadata) { @@ -67,17 +68,7 @@ public class EnableConfigurationPropertiesImportSelector implements ImportSelect for (Class type : types) { String name = type.getName(); if (!registry.containsBeanDefinition(name)) { - registry.registerBeanDefinition(name, BeanDefinitionBuilder - .genericBeanDefinition(type).getBeanDefinition()); - ConfigurationProperties properties = AnnotationUtils.findAnnotation( - type, ConfigurationProperties.class); - if (properties == null) { - BeanDefinitionBuilder builder = BeanDefinitionBuilder - .genericBeanDefinition(ConfigurationPropertiesHolder.class); - builder.addConstructorArgReference(name); - registry.registerBeanDefinition(name + ".HOLDER", - builder.getBeanDefinition()); - } + registerBeanDefinition(registry, type, name); } } } @@ -94,18 +85,25 @@ public class EnableConfigurationPropertiesImportSelector implements ImportSelect return result; } - } + private void registerBeanDefinition(BeanDefinitionRegistry registry, + Class type, String name) { + BeanDefinitionBuilder builder = BeanDefinitionBuilder + .genericBeanDefinition(type); + AbstractBeanDefinition beanDefinition = builder.getBeanDefinition(); + registry.registerBeanDefinition(name, beanDefinition); - public static class ConfigurationPropertiesHolder { - - private Object target; - - public ConfigurationPropertiesHolder(Object target) { - this.target = target; + ConfigurationProperties properties = AnnotationUtils.findAnnotation(type, + ConfigurationProperties.class); + if (properties == null) { + registerPropertiesHolder(registry, name); + } } - public Object getTarget() { - return this.target; + private void registerPropertiesHolder(BeanDefinitionRegistry registry, String name) { + BeanDefinitionBuilder builder = BeanDefinitionBuilder + .genericBeanDefinition(ConfigurationPropertiesHolder.class); + builder.addConstructorArgReference(name); + registry.registerBeanDefinition(name + ".HOLDER", builder.getBeanDefinition()); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java index 243811f11f5..e94394fba25 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/JavaLoggerConfigurer.java @@ -40,13 +40,13 @@ public abstract class JavaLoggerConfigurer { try { LogManager.getLogManager().readConfiguration( ResourceUtils.getURL(resolvedLocation).openStream()); - } catch (FileNotFoundException e) { - throw e; - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { + } + catch (Exception ex) { + if (ex instanceof FileNotFoundException) { + throw (FileNotFoundException) ex; + } throw new IllegalArgumentException("Could not initialize logging from " - + location, e); + + location, ex); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java index ce034d68b07..143e0cf8363 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/logging/LogbackConfigurer.java @@ -47,9 +47,10 @@ public abstract class LogbackConfigurer { context.stop(); try { new ContextInitializer(context).configureByResource(url); - } catch (JoranException e) { + } + catch (JoranException ex) { throw new IllegalArgumentException("Could not initialize logging from " - + location, e); + + location, ex); } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java index ba7c51d31ef..a21f490b1ae 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/web/SpringServletInitializer.java @@ -1,3 +1,19 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.web; import javax.servlet.ServletContext; @@ -14,27 +30,23 @@ import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.WebApplicationContext; /** - *

* A handy opinionated {@link WebApplicationInitializer} for applications that only have * one Spring servlet, and no more than a single filter (which itself is only enabled when * Spring Security is detected). If your application is more complicated consider using * one of the other WebApplicationInitializers. - *

* - *

+ *

* Note that a WebApplicationInitializer is only needed if you are building a war file and * deploying it. If you prefer to run an embedded container (we do) then you won't need * this at all. - *

* * @author Dave Syer - * */ public abstract class SpringServletInitializer implements WebApplicationInitializer { - /** Logger available to subclasses. */ - protected final Log logger = LogFactory.getLog(getClass()); + private final Log logger = LogFactory.getLog(getClass()); + @Override public void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext rootAppContext = this .createRootApplicationContext(servletContext); @@ -45,10 +57,11 @@ public abstract class SpringServletInitializer implements WebApplicationInitiali // no-op because the application context is already initialized } }); - } else { - this.logger - .debug("No ContextLoaderListener registered, as " - + "createRootApplicationContext() did not return an application context"); + } + else { + this.logger.debug("No ContextLoaderListener registered, as " + + "createRootApplicationContext() did not " + + "return an application context"); } } @@ -57,7 +70,7 @@ public abstract class SpringServletInitializer implements WebApplicationInitiali ApplicationContext parent = null; Object object = servletContext .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); - if (object != null && object instanceof ApplicationContext) { + if (object instanceof ApplicationContext) { this.logger.info("Root context already created (using as parent)."); parent = (ApplicationContext) object; servletContext.setAttribute( diff --git a/spring-bootstrap/src/main/resources/META-INF/spring.factories b/spring-bootstrap/src/main/resources/META-INF/spring.factories index 7836cb266bd..03db1ac821f 100644 --- a/spring-bootstrap/src/main/resources/META-INF/spring.factories +++ b/spring-bootstrap/src/main/resources/META-INF/spring.factories @@ -1,18 +1,3 @@ -# 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 - # Application Context Initializers org.springframework.context.ApplicationContextInitializer=\ org.springframework.bootstrap.context.initializer.ConfigFileApplicationContextInitializer,\ diff --git a/spring-bootstrap/src/main/resources/org/springframework/bootstrap/logging/log4j.properties b/spring-bootstrap/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-bootstrap/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/logging.properties b/spring-bootstrap/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-bootstrap/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/SpringApplicationTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringApplicationTests.java index 7b2ab60c00a..4c37f56beec 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringApplicationTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/SpringApplicationTests.java @@ -26,6 +26,10 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.beans.factory.support.DefaultBeanNameGenerator; +import org.springframework.bootstrap.BeanDefinitionLoader; +import org.springframework.bootstrap.CommandLineRunner; +import org.springframework.bootstrap.ExitCodeGenerator; +import org.springframework.bootstrap.SpringApplication; import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; import org.springframework.bootstrap.context.embedded.jetty.JettyEmbeddedServletContainerFactory; import org.springframework.context.ApplicationContext; @@ -357,7 +361,8 @@ public class SpringApplicationTests { this.sources = sources; if (this.useMockLoader) { this.loader = mock(BeanDefinitionLoader.class); - } else { + } + else { this.loader = spy(super.createBeanDefinitionLoader(registry, sources)); } return this.loader; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/TestUtils.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/TestUtils.java index c217ca4921f..e58267b9e21 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/TestUtils.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/TestUtils.java @@ -23,9 +23,11 @@ import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.env.MapPropertySource; /** + * General test utilities. + * * @author Dave Syer */ -public class TestUtils { +public abstract class TestUtils { public static void addEnviroment(ConfigurableApplicationContext context, String... pairs) { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java index d90df0d06bb..a19f4583d19 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertiesConfigurationFactoryTests.java @@ -21,6 +21,7 @@ import javax.validation.constraints.NotNull; import org.junit.Test; import org.springframework.beans.NotWritablePropertyException; +import org.springframework.bootstrap.bind.PropertiesConfigurationFactory; import org.springframework.context.support.StaticMessageSource; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.support.PropertiesLoaderUtils; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java index 63032c61e00..ceec5e2d660 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/PropertySourcesPropertyValuesTests.java @@ -20,6 +20,7 @@ import java.util.Collections; import org.junit.Before; import org.junit.Test; +import org.springframework.bootstrap.bind.PropertySourcesPropertyValues; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource; @@ -28,6 +29,7 @@ import org.springframework.validation.DataBinder; import static org.junit.Assert.assertEquals; /** + * Tests for {@link PropertySourcesPropertyValues}. * @author Dave Syer */ public class PropertySourcesPropertyValuesTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java index 9d579d78f74..9beeedc9f88 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/RelaxedDataBinderTests.java @@ -36,6 +36,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.springframework.beans.MutablePropertyValues; +import org.springframework.bootstrap.bind.RelaxedDataBinder; import org.springframework.context.support.StaticMessageSource; import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.support.DefaultConversionService; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java index 0d213a0f333..b95dc387259 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/bind/YamlConfigurationFactoryTests.java @@ -24,6 +24,7 @@ import javax.validation.Validation; import javax.validation.constraints.NotNull; import org.junit.Test; +import org.springframework.bootstrap.bind.YamlConfigurationFactory; import org.springframework.context.support.StaticMessageSource; import org.springframework.validation.BindException; import org.springframework.validation.Validator; @@ -33,6 +34,8 @@ import org.yaml.snakeyaml.error.YAMLException; import static org.junit.Assert.assertEquals; /** + * Tests for {@link YamlConfigurationFactory} + * * @author Dave Syer */ public class YamlConfigurationFactoryTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java index 873f60e7dc5..5f06d06d243 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/JacksonParserTests.java @@ -13,11 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.bootstrap.config; +import org.springframework.bootstrap.config.JacksonJsonParser; +import org.springframework.bootstrap.config.JsonParser; + + /** - * @author Dave Syer + * Tests for {@link JsonParser}. * + * @author Dave Syer */ public class JacksonParserTests extends SimpleJsonParserTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java index 1caef14b4b5..fc8cc9e2f2f 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/SimpleJsonParserTests.java @@ -13,18 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.bootstrap.config; import java.util.List; import java.util.Map; import org.junit.Test; +import org.springframework.bootstrap.config.JsonParser; +import org.springframework.bootstrap.config.SimpleJsonParser; import static org.junit.Assert.assertEquals; /** - * @author Dave Syer + * Tests for {@link SimpleJsonParser}. * + * @author Dave Syer */ public class SimpleJsonParserTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlParserTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlJsonParserTests.java similarity index 78% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlParserTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlJsonParserTests.java index 1029a1ab4bf..b00fe8b1278 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlParserTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlJsonParserTests.java @@ -13,13 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.bootstrap.config; +import org.springframework.bootstrap.config.JsonParser; +import org.springframework.bootstrap.config.YamlJsonParser; + + /** - * @author Dave Syer + * Tests for {@link YamlJsonParser}. * + * @author Dave Syer */ -public class YamlParserTests extends SimpleJsonParserTests { +public class YamlJsonParserTests extends SimpleJsonParserTests { @Override protected JsonParser getParser() { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java index a0f54c1852a..101e434f1ab 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlMapFactoryBeanTests.java @@ -21,6 +21,7 @@ import java.io.InputStream; import java.util.Map; import org.junit.Test; +import org.springframework.bootstrap.config.YamlMapFactoryBean; import org.springframework.bootstrap.config.YamlProcessor.ResolutionMethod; import org.springframework.core.io.AbstractResource; import org.springframework.core.io.ByteArrayResource; @@ -30,6 +31,8 @@ import org.springframework.core.io.Resource; import static org.junit.Assert.assertEquals; /** + * Tests for {@link YamlMapFactoryBean}. + * * @author Dave Syer */ public class YamlMapFactoryBeanTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java index ae76eac4287..6b6815037a2 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/config/YamlPropertiesFactoryBeanTests.java @@ -22,6 +22,7 @@ import java.util.Properties; import org.junit.Ignore; import org.junit.Test; +import org.springframework.bootstrap.config.YamlPropertiesFactoryBean; import org.springframework.bootstrap.config.YamlProcessor.DocumentMatcher; import org.springframework.bootstrap.config.YamlProcessor.MatchStatus; import org.springframework.bootstrap.config.YamlProcessor.ResolutionMethod; @@ -33,6 +34,8 @@ import org.yaml.snakeyaml.Yaml; import static org.junit.Assert.assertEquals; /** + * Tests for {@link YamlPropertiesFactoryBean}. + * * @author Dave Syer */ public class YamlPropertiesFactoryBeanTests { diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBean.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/AssertMissingBean.java similarity index 93% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBean.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/AssertMissingBean.java index 742d051fe87..59eaa7c7812 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBean.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/AssertMissingBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -23,6 +23,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.beans.factory.BeanFactory; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Conditional; diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBeanCondition.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/AssertMissingBeanCondition.java similarity index 92% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBeanCondition.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/AssertMissingBeanCondition.java index 62b8972f27e..cd3af4903b5 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/context/annotation/AssertMissingBeanCondition.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/AssertMissingBeanCondition.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import java.util.List; import org.springframework.beans.factory.BeanCreationException; +import org.springframework.bootstrap.context.condition.OnMissingBeanCondition; import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnBeanConditionTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnBeanConditionTests.java similarity index 98% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnBeanConditionTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnBeanConditionTests.java index 14cc03dd45c..9ce448c7c28 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnBeanConditionTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnBeanConditionTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.junit.Ignore; import org.junit.Test; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnClassConditionTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnClassConditionTests.java similarity index 92% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnClassConditionTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnClassConditionTests.java index d9e29da9031..f0d542e098c 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnClassConditionTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnClassConditionTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -28,6 +28,8 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** + * Tests for {@link OnClassCondition}. + * * @author Dave Syer */ public class OnClassConditionTests { @@ -93,13 +95,13 @@ public class OnClassConditionTests { } @Configuration - @ImportResource("org/springframework/bootstrap/context/annotation/foo.xml") + @ImportResource("org/springframework/bootstrap/context/foo.xml") protected static class XmlConfiguration { } @Configuration @Import(BasicConfiguration.class) - @ImportResource("org/springframework/bootstrap/context/annotation/foo.xml") + @ImportResource("org/springframework/bootstrap/context/foo.xml") protected static class CombinedXmlConfiguration { } } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnExpressionConditionTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnExpressionConditionTests.java similarity index 87% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnExpressionConditionTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnExpressionConditionTests.java index f5466988659..40e187c69b5 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnExpressionConditionTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnExpressionConditionTests.java @@ -14,9 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.junit.Test; +import org.springframework.bootstrap.context.condition.ConditionalOnExpression; +import org.springframework.bootstrap.context.condition.OnExpressionCondition; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -26,6 +28,8 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** + * Tests for {@link OnExpressionCondition}. + * * @author Dave Syer */ public class OnExpressionConditionTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingBeanConditionTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnMissingBeanConditionTests.java similarity index 94% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingBeanConditionTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnMissingBeanConditionTests.java index 5bd94c287ad..4a7b8a2fb0f 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingBeanConditionTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnMissingBeanConditionTests.java @@ -14,9 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.junit.Test; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; +import org.springframework.bootstrap.context.condition.OnMissingBeanCondition; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingClassConditionTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnMissingClassConditionTests.java similarity index 93% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingClassConditionTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnMissingClassConditionTests.java index 52d2d79b60c..2ab8b1c44c3 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnMissingClassConditionTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnMissingClassConditionTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -26,6 +26,8 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** + * Tests for {@link OnMissingClassCondition}. + * * @author Dave Syer */ public class OnMissingClassConditionTests { @@ -49,7 +51,7 @@ public class OnMissingClassConditionTests { } @Configuration - @ConditionalOnMissingClass("org.springframework.bootstrap.context.annotation.OnMissingClassConditionTests") + @ConditionalOnMissingClass("org.springframework.bootstrap.context.condition.OnMissingClassConditionTests") protected static class BasicConfiguration { @Bean public String bar() { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/NotWebApplicationConditionTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnNotWebApplicationConditionTests.java similarity index 81% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/NotWebApplicationConditionTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnNotWebApplicationConditionTests.java index ab71da42e79..19fb587c107 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/NotWebApplicationConditionTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnNotWebApplicationConditionTests.java @@ -14,9 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.junit.Test; +import org.springframework.bootstrap.context.condition.ConditionalOnNotWebApplication; +import org.springframework.bootstrap.context.condition.ConditionalOnWebApplication; +import org.springframework.bootstrap.context.condition.OnNotWebApplicationCondition; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -26,9 +29,11 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** + * Tests for {@link OnNotWebApplicationCondition}. + * * @author Dave Syer */ -public class NotWebApplicationConditionTests { +public class OnNotWebApplicationConditionTests { private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnResourceConditionTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnResourceConditionTests.java similarity index 87% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnResourceConditionTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnResourceConditionTests.java index 9ec8c738d01..8e304820be1 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/OnResourceConditionTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnResourceConditionTests.java @@ -14,9 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.junit.Test; +import org.springframework.bootstrap.context.condition.ConditionalOnResource; +import org.springframework.bootstrap.context.condition.OnResourceCondition; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -26,6 +28,8 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** + * Tests for {@link OnResourceCondition}. + * * @author Dave Syer */ public class OnResourceConditionTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/WebApplicationConditionTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnWebApplicationConditionTests.java similarity index 83% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/WebApplicationConditionTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnWebApplicationConditionTests.java index 0e6b1790ad6..95171af5375 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/WebApplicationConditionTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/condition/OnWebApplicationConditionTests.java @@ -14,9 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; +package org.springframework.bootstrap.context.condition; import org.junit.Test; +import org.springframework.bootstrap.context.condition.ConditionalOnNotWebApplication; +import org.springframework.bootstrap.context.condition.ConditionalOnWebApplication; +import org.springframework.bootstrap.context.condition.OnWebApplicationCondition; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.mock.web.MockServletContext; @@ -27,9 +30,11 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** + * Tests for {@link OnWebApplicationCondition}. + * * @author Dave Syer */ -public class WebApplicationConditionTests { +public class OnWebApplicationConditionTests { private AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java index a9c0b289205..5278e5b0a94 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java @@ -38,6 +38,12 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.mockito.InOrder; +import org.springframework.bootstrap.context.embedded.AbstractEmbeddedServletContainerFactory; +import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory; +import org.springframework.bootstrap.context.embedded.EmbeddedServletContainer; +import org.springframework.bootstrap.context.embedded.FilterRegistrationBean; +import org.springframework.bootstrap.context.embedded.ServletContextInitializer; +import org.springframework.bootstrap.context.embedded.ServletRegistrationBean; import org.springframework.http.HttpMethod; import org.springframework.http.client.ClientHttpRequest; import org.springframework.http.client.ClientHttpResponse; @@ -73,7 +79,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { if (this.container != null) { try { this.container.stop(); - } catch (Exception e) { + } + catch (Exception ex) { } } } @@ -150,7 +157,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { try { Thread.sleep(500); date[0] = new Date(); - } catch (InterruptedException ex) { + } + catch (InterruptedException ex) { throw new ServletException(ex); } } @@ -243,7 +251,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { ClientHttpResponse response = request.execute(); try { return StreamUtils.copyToString(response.getBody(), Charset.forName("UTF-8")); - } finally { + } + finally { response.close(); } } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java index 2cc5f23627c..573c0c0dfea 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/AnnotationConfigEmbeddedWebApplicationContextTests.java @@ -20,6 +20,8 @@ import javax.servlet.Servlet; import javax.servlet.ServletContext; import org.junit.Test; +import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; +import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; import org.springframework.bootstrap.context.embedded.config.ExampleEmbeddedWebApplicationConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java index e866f813af2..5c83bdd31be 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java @@ -55,7 +55,8 @@ public class EmbeddedServletContainerMvcIntegrationTests { public void closeContext() { try { this.context.close(); - } catch (Exception ex) { + } + catch (Exception ex) { } } @@ -90,7 +91,8 @@ public class EmbeddedServletContainerMvcIntegrationTests { String actual = StreamUtils.copyToString(response.getBody(), Charset.forName("UTF-8")); assertThat(actual, equalTo("Hello World")); - } finally { + } + finally { response.close(); } } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java index 4e01a916cf2..5a693962e29 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/EmbeddedWebApplicationContextTests.java @@ -33,6 +33,10 @@ import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.ConstructorArgumentValues; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.bootstrap.context.embedded.EmbeddedWebApplicationContext; +import org.springframework.bootstrap.context.embedded.FilterRegistrationBean; +import org.springframework.bootstrap.context.embedded.ServletContextInitializer; +import org.springframework.bootstrap.context.embedded.ServletRegistrationBean; import org.springframework.context.ApplicationContextException; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @@ -306,7 +310,6 @@ public class EmbeddedWebApplicationContextTests { Servlet servlet = mock(Servlet.class); Filter filter = mock(Filter.class); ServletRegistrationBean initializer = new ServletRegistrationBean(servlet, "/foo"); - initializer.addFilters(filter); this.context.registerBeanDefinition("initializerBean", beanDefinition(initializer)); this.context.registerBeanDefinition("servletBean", beanDefinition(servlet)); diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java index 0cd99057117..f9b891b9231 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/MockEmbeddedServletContainerFactory.java @@ -31,6 +31,10 @@ import javax.servlet.ServletRegistration; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.springframework.bootstrap.context.embedded.AbstractEmbeddedServletContainerFactory; +import org.springframework.bootstrap.context.embedded.EmbeddedServletContainer; +import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.bootstrap.context.embedded.ServletContextInitializer; import static org.mockito.BDDMockito.given; import static org.mockito.Matchers.anyObject; @@ -128,7 +132,8 @@ public class MockEmbeddedServletContainerFactory extends for (ServletContextInitializer initializer : this.initializers) { initializer.onStartup(this.servletContext); } - } catch (ServletException ex) { + } + catch (ServletException ex) { throw new RuntimeException(ex); } } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java index 748b236b866..00a74a952d2 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/ServletRegistrationBeanTests.java @@ -18,12 +18,10 @@ package org.springframework.bootstrap.context.embedded; import java.util.Arrays; import java.util.Collections; -import java.util.EnumSet; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.Map; -import javax.servlet.DispatcherType; import javax.servlet.Filter; import javax.servlet.FilterRegistration; import javax.servlet.Servlet; @@ -38,9 +36,10 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.bootstrap.context.embedded.ServletRegistrationBean; -import static org.mockito.BDDMockito.*; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.verify; /** * Tests for {@link ServletRegistrationBean}. @@ -123,38 +122,38 @@ public class ServletRegistrationBeanTests { @Test public void setServletMustNotBeNull() throws Exception { ServletRegistrationBean bean = new ServletRegistrationBean(); - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Servlet must not be null"); + this.thrown.expect(IllegalArgumentException.class); + this.thrown.expectMessage("Servlet must not be null"); bean.onStartup(this.servletContext); } @Test public void createServletMustNotBeNull() throws Exception { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Servlet must not be null"); + this.thrown.expect(IllegalArgumentException.class); + this.thrown.expectMessage("Servlet must not be null"); new ServletRegistrationBean(null); } @Test public void setMappingMustNotBeNull() throws Exception { ServletRegistrationBean bean = new ServletRegistrationBean(this.servlet); - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("UrlMappings must not be null"); + this.thrown.expect(IllegalArgumentException.class); + this.thrown.expectMessage("UrlMappings must not be null"); bean.setUrlMappings(null); } @Test public void createMappingMustNotBeNull() throws Exception { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("UrlMappings must not be null"); + this.thrown.expect(IllegalArgumentException.class); + this.thrown.expectMessage("UrlMappings must not be null"); new ServletRegistrationBean(this.servlet, (String[]) null); } @Test public void addMappingMustNotBeNull() throws Exception { ServletRegistrationBean bean = new ServletRegistrationBean(this.servlet); - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("UrlMappings must not be null"); + this.thrown.expect(IllegalArgumentException.class); + this.thrown.expectMessage("UrlMappings must not be null"); bean.addUrlMappings((String[]) null); } @@ -177,31 +176,4 @@ public class ServletRegistrationBeanTests { verify(this.registration).setInitParameters(Collections.singletonMap("a", "c")); } - @Test - public void filters() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean(this.servlet); - Filter filter = new MockFilter(); - bean.addFilters(filter); - bean.onStartup(this.servletContext); - verify(servletContext).addFilter("mockFilter", filter); - verify(filterRegistration).setAsyncSupported(true); - verify(filterRegistration).addMappingForServletNames( - EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, - DispatcherType.INCLUDE, DispatcherType.ASYNC), false, - "mockServlet"); - } - - @Test - public void filtersNoAsync() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean(this.servlet); - Filter filter = new MockFilter(); - bean.addFilters(filter); - bean.setAsyncSupported(false); - bean.onStartup(this.servletContext); - verify(servletContext).addFilter("mockFilter", filter); - verify(filterRegistration).setAsyncSupported(false); - verify(filterRegistration).addMappingForServletNames( - EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, - DispatcherType.INCLUDE), false, "mockServlet"); - } } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/properties/ServerPropertiesTests.java similarity index 91% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/properties/ServerPropertiesTests.java index 10034cbf91c..304947cbcc7 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/embedded/properties/ServerPropertiesTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.properties; +package org.springframework.bootstrap.context.embedded.properties; import java.net.InetAddress; import java.util.Collections; @@ -24,12 +24,13 @@ import java.util.Map; import org.junit.Test; import org.springframework.beans.MutablePropertyValues; import org.springframework.bootstrap.bind.RelaxedDataBinder; +import org.springframework.bootstrap.context.embedded.properties.ServerProperties; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; /** - * Externalized configuration for server properties + * Tests for {@link ServerProperties}. * * @author Dave Syer */ @@ -68,4 +69,6 @@ public class ServerPropertiesTests { .getProtocolHeader()); } + // FIXME test customize + } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java index bf48cc58daf..a62762a0bda 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/ContextIdApplicationContextInitializerTests.java @@ -13,18 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.bootstrap.context.initializer; import org.junit.Test; import org.springframework.bootstrap.TestUtils; +import org.springframework.bootstrap.context.initializer.ContextIdApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import static org.junit.Assert.assertEquals; /** - * @author Dave Syer + * Tests for {@link ContextIdApplicationContextInitializer}. * + * @author Dave Syer */ public class ContextIdApplicationContextInitializerTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java index 401a41b330c..838cdce9b38 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/EnvironmentDelegateApplicationContextInitializerTest.java @@ -22,6 +22,7 @@ import java.util.Map; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.springframework.bootstrap.context.initializer.EnvironmentDelegateApplicationContextInitializer; import org.springframework.context.ApplicationContextException; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java index 795243648eb..046d2e2d3de 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/initializer/VcapApplicationContextInitializerTests.java @@ -13,18 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.bootstrap.context.initializer; import org.junit.Test; import org.springframework.bootstrap.TestUtils; +import org.springframework.bootstrap.context.initializer.VcapApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import static org.junit.Assert.assertEquals; /** - * @author Dave Syer + * Tests for {@link VcapApplicationContextInitializer}. * + * @author Dave Syer */ public class VcapApplicationContextInitializerTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/properties/EnableConfigurationPropertiesTests.java similarity index 95% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/context/properties/EnableConfigurationPropertiesTests.java index c8508d579eb..738f3f9ab09 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/annotation/EnableConfigurationPropertiesTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/properties/EnableConfigurationPropertiesTests.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.context.annotation; + +package org.springframework.bootstrap.context.properties; import java.util.Arrays; @@ -23,6 +24,8 @@ import org.junit.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.bootstrap.TestUtils; +import org.springframework.bootstrap.context.condition.AssertMissingBean; +import org.springframework.bootstrap.context.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -33,6 +36,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; /** + * Tests for {@link EnableConfigurationProperties}. + * * @author Dave Syer */ public class EnableConfigurationPropertiesTests { @@ -168,7 +173,7 @@ public class EnableConfigurationPropertiesTests { } @Configuration - @ImportResource("org/springframework/bootstrap/context/annotation/testProperties.xml") + @ImportResource("org/springframework/bootstrap/context/properties/testProperties.xml") protected static class DefaultXmlConfiguration { } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java index 15fd3d74413..d62388d12ce 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/context/test/EnableConfigurationPropertiesTests.java @@ -21,8 +21,8 @@ import java.util.Properties; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java index 8b5d80ee7f3..19899e230b5 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/JavaLoggerConfigurerTests.java @@ -25,10 +25,13 @@ import org.apache.commons.logging.LogFactory; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.springframework.bootstrap.logging.JavaLoggerConfigurer; import static org.junit.Assert.assertTrue; /** + * Tests for {@link JavaLoggerConfigurer}. + * * @author Dave Syer */ public class JavaLoggerConfigurerTests { diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java index 0a856f9755a..503cefaa398 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LogbackConfigurerTests.java @@ -29,6 +29,8 @@ import org.junit.Test; import static org.junit.Assert.assertTrue; /** + * Tests for {@link LogbackConfigurer}. + * * @author Dave Syer */ public class LogbackConfigurerTests { @@ -62,7 +64,7 @@ public class LogbackConfigurerTests { logger.info("Hello world"); String output = getOutput().trim(); assertTrue("Wrong output:\n" + output, output.contains("Hello world")); - assertTrue("Wrong output:\n" + output, output.startsWith("/tmp/bootstrap.log")); + assertTrue("Wrong output:\n" + output, output.startsWith("/tmp/spring.log")); } @Test(expected = FileNotFoundException.class) diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LoggingApplicationContextInitializerTests.java similarity index 89% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LoggingApplicationContextInitializerTests.java index 90d475dfb66..34bb2128b75 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LoggingInitializerTests.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/LoggingApplicationContextInitializerTests.java @@ -32,18 +32,21 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** + * Tests for {@link LoggingApplicationContextInitializer}. + * * @author Dave Syer */ -public class LoggingInitializerTests { +public class LoggingApplicationContextInitializerTests { 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)); } @@ -64,7 +67,7 @@ public class LoggingInitializerTests { public void testDefaultConfigLocation() { GenericApplicationContext context = new GenericApplicationContext(); this.initializer.initialize(context); - Log logger = LogFactory.getLog(LoggingInitializerTests.class); + Log logger = LogFactory.getLog(LoggingApplicationContextInitializerTests.class); logger.info("Hello world"); String output = getOutput().trim(); assertTrue("Wrong output:\n" + output, output.contains("Hello world")); @@ -86,12 +89,12 @@ public class LoggingInitializerTests { } }); this.initializer.initialize(context); - Log logger = LogFactory.getLog(LoggingInitializerTests.class); + Log logger = LogFactory.getLog(LoggingApplicationContextInitializerTests.class); logger.info("Hello world"); String output = getOutput().trim(); assertTrue("Wrong output:\n" + output, output.contains("Hello world")); assertFalse("Wrong output:\n" + output, output.contains("???")); - assertTrue("Wrong output:\n" + output, output.startsWith("/tmp/bootstrap.log")); + assertTrue("Wrong output:\n" + output, output.startsWith("/tmp/spring.log")); } @Test @@ -111,7 +114,7 @@ public class LoggingInitializerTests { } }); this.initializer.initialize(context); - Log logger = LogFactory.getLog(LoggingInitializerTests.class); + Log logger = LogFactory.getLog(LoggingApplicationContextInitializerTests.class); logger.info("Hello world"); String output = getOutput().trim(); assertTrue("Wrong output:\n" + output, output.startsWith("foo.log")); @@ -134,10 +137,10 @@ public class LoggingInitializerTests { } }); this.initializer.initialize(context); - Log logger = LogFactory.getLog(LoggingInitializerTests.class); + Log logger = LogFactory.getLog(LoggingApplicationContextInitializerTests.class); logger.info("Hello world"); String output = getOutput().trim(); - assertTrue("Wrong output:\n" + output, output.startsWith("foo/bootstrap.log")); + assertTrue("Wrong output:\n" + output, output.startsWith("foo/spring.log")); } } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java index b198303812e..91278029f64 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/logging/TestFormatter.java @@ -20,6 +20,8 @@ import java.util.logging.Formatter; import java.util.logging.LogRecord; /** + * Simple test {@link Formatter}. + * * @author Dave Syer */ public class TestFormatter extends Formatter { diff --git a/spring-bootstrap/src/test/resources/logback-nondefault.xml b/spring-bootstrap/src/test/resources/logback-nondefault.xml index 367dad76bb8..4752a677e91 100644 --- a/spring-bootstrap/src/test/resources/logback-nondefault.xml +++ b/spring-bootstrap/src/test/resources/logback-nondefault.xml @@ -1,6 +1,6 @@ - + ${LOG_FILE} [%t] ${PID:-????} %c{1}: %m%n diff --git a/spring-bootstrap/src/test/resources/logback-test.xml b/spring-bootstrap/src/test/resources/logback-test.xml index 465daf8a1c7..9cc6069b88f 100644 --- a/spring-bootstrap/src/test/resources/logback-test.xml +++ b/spring-bootstrap/src/test/resources/logback-test.xml @@ -1,6 +1,6 @@ - + diff --git a/spring-bootstrap/src/test/resources/logging-nondefault.properties b/spring-bootstrap/src/test/resources/logging-nondefault.properties index ec997fde4d4..7aba690145c 100644 --- a/spring-bootstrap/src/test/resources/logging-nondefault.properties +++ b/spring-bootstrap/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-bootstrap/src/test/resources/org/springframework/bootstrap/context/annotation/foo.xml b/spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/foo.xml similarity index 100% rename from spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/annotation/foo.xml rename to spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/foo.xml diff --git a/spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml b/spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/properties/testProperties.xml similarity index 77% rename from spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml rename to spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/properties/testProperties.xml index c04d85080c4..24a4b905ec9 100644 --- a/spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/annotation/testProperties.xml +++ b/spring-bootstrap/src/test/resources/org/springframework/bootstrap/context/properties/testProperties.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> + id="org.springframework.bootstrap.context.properties.EnableConfigurationPropertiesTests$TestProperties" + class="org.springframework.bootstrap.context.properties.EnableConfigurationPropertiesTests$TestProperties"> diff --git a/spring-bootstrap/src/test/resources/static/css/style.css b/spring-bootstrap/src/test/resources/static/css/style.css deleted file mode 100644 index 301dc39263e..00000000000 --- a/spring-bootstrap/src/test/resources/static/css/style.css +++ /dev/null @@ -1 +0,0 @@ -body: {background: red} \ No newline at end of file diff --git a/spring-bootstrap-cli/pom.xml b/spring-cli/pom.xml similarity index 68% rename from spring-bootstrap-cli/pom.xml rename to spring-cli/pom.xml index 6f7b0fc119c..e1563143427 100644 --- a/spring-bootstrap-cli/pom.xml +++ b/spring-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-cli jar - org.springframework.bootstrap.cli.SpringBootstrapCli + ${basedir}/.. + org.springframework.cli.SpringCli + + + + 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-cli/samples/actuator.groovy similarity index 63% rename from spring-bootstrap-cli/samples/actuator.groovy rename to spring-cli/samples/actuator.groovy index fad95cded8d..cfeb37e84ce 100644 --- a/spring-bootstrap-cli/samples/actuator.groovy +++ b/spring-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-actuator:0.5.0.BUILD-SNAPSHOT") @Controller class SampleController { diff --git a/spring-bootstrap-cli/samples/app.groovy b/spring-cli/samples/app.groovy similarity index 100% rename from spring-bootstrap-cli/samples/app.groovy rename to spring-cli/samples/app.groovy diff --git a/spring-bootstrap-cli/samples/integration.groovy b/spring-cli/samples/integration.groovy similarity index 100% rename from spring-bootstrap-cli/samples/integration.groovy rename to spring-cli/samples/integration.groovy diff --git a/spring-bootstrap-cli/samples/job.groovy b/spring-cli/samples/job.groovy similarity index 100% rename from spring-bootstrap-cli/samples/job.groovy rename to spring-cli/samples/job.groovy diff --git a/spring-bootstrap-cli/samples/runner.groovy b/spring-cli/samples/runner.groovy similarity index 100% rename from spring-bootstrap-cli/samples/runner.groovy rename to spring-cli/samples/runner.groovy diff --git a/spring-bootstrap-cli/samples/runner.xml b/spring-cli/samples/runner.xml similarity index 100% rename from spring-bootstrap-cli/samples/runner.xml rename to spring-cli/samples/runner.xml diff --git a/spring-bootstrap-cli/samples/template.groovy b/spring-cli/samples/template.groovy similarity index 77% rename from spring-bootstrap-cli/samples/template.groovy rename to spring-cli/samples/template.groovy index eab92331121..28bd7e0b58e 100644 --- a/spring-bootstrap-cli/samples/template.groovy +++ b/spring-cli/samples/template.groovy @@ -1,6 +1,6 @@ package org.test -import static org.springframework.bootstrap.cli.template.GroovyTemplate.template; +import static org.springframework.cli.template.GroovyTemplate.template; @Component class Example implements CommandLineRunner { diff --git a/spring-bootstrap-cli/samples/ui.groovy b/spring-cli/samples/ui.groovy similarity index 100% rename from spring-bootstrap-cli/samples/ui.groovy rename to spring-cli/samples/ui.groovy diff --git a/spring-bootstrap-cli/samples/web.groovy b/spring-cli/samples/web.groovy similarity index 100% rename from spring-bootstrap-cli/samples/web.groovy rename to spring-cli/samples/web.groovy diff --git a/spring-bootstrap-cli/src/main/assembly/descriptor.xml b/spring-cli/src/main/assembly/descriptor.xml similarity index 91% rename from spring-bootstrap-cli/src/main/assembly/descriptor.xml rename to spring-cli/src/main/assembly/descriptor.xml index 7d2b776f58f..7ed0d63ecde 100644 --- a/spring-bootstrap-cli/src/main/assembly/descriptor.xml +++ b/spring-cli/src/main/assembly/descriptor.xml @@ -23,7 +23,7 @@ - org.springframework.bootstrap:spring-bootstrap-cli:jar:* + org.springframework.zero:spring-cli:jar:* lib diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/Command.java b/spring-cli/src/main/java/org/springframework/cli/Command.java similarity index 97% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/Command.java rename to spring-cli/src/main/java/org/springframework/cli/Command.java index d0adb210339..61bd9da595f 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/Command.java +++ b/spring-cli/src/main/java/org/springframework/cli/Command.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli; +package org.springframework.cli; /** * A single command that can be run from the CLI. diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/CommandFactory.java b/spring-cli/src/main/java/org/springframework/cli/CommandFactory.java similarity index 95% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/CommandFactory.java rename to spring-cli/src/main/java/org/springframework/cli/CommandFactory.java index d7019d42304..96f57bc262d 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/CommandFactory.java +++ b/spring-cli/src/main/java/org/springframework/cli/CommandFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli; +package org.springframework.cli; import java.util.Collection; import java.util.ServiceLoader; diff --git a/spring-cli/src/main/java/org/springframework/cli/Log.java b/spring-cli/src/main/java/org/springframework/cli/Log.java new file mode 100644 index 00000000000..c1d48d51947 --- /dev/null +++ b/spring-cli/src/main/java/org/springframework/cli/Log.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.cli; + +/** + * Simple logger used by the CLI. + * + * @author Phillip Webb + */ +public abstract class Log { + + public static void info(String message) { + System.out.println(message); + } + + public static void error(String message) { + System.err.println(message); + } + + public static void error(Exception ex) { + ex.printStackTrace(System.err); + } + +} diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/NoSuchCommandException.java b/spring-cli/src/main/java/org/springframework/cli/NoSuchCommandException.java similarity index 86% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/NoSuchCommandException.java rename to spring-cli/src/main/java/org/springframework/cli/NoSuchCommandException.java index 206397db2fe..dde2e75a526 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/NoSuchCommandException.java +++ b/spring-cli/src/main/java/org/springframework/cli/NoSuchCommandException.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli; +package org.springframework.cli; /** * Exception thrown when an unknown command is specified. * * @author Phillip Webb */ -class NoSuchCommandException extends BootstrapCliException { +class NoSuchCommandException extends SpringCliException { private static final long serialVersionUID = 1L; public NoSuchCommandException(String name) { super(String.format("%1$s: '%2$s' is not a valid command. See '%1$s --help'.", - SpringBootstrapCli.CLI_APP, name)); + SpringCli.CLI_APP, name)); } } diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java b/spring-cli/src/main/java/org/springframework/cli/SpringCli.java similarity index 67% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java rename to spring-cli/src/main/java/org/springframework/cli/SpringCli.java index 3adcd499403..bd14a0b6d86 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java +++ b/spring-cli/src/main/java/org/springframework/cli/SpringCli.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli; +package org.springframework.cli; import java.util.ArrayList; import java.util.Arrays; @@ -24,9 +24,9 @@ import java.util.ServiceLoader; import java.util.Set; /** - * Spring Bootstrap Command Line Interface. This is the main entry-point for the spring - * bootstrap command line application. This class will parse input arguments and delegate - * to a suitable {@link Command} implementation based on the first argument. + * Spring Command Line Interface. This is the main entry-point for the Spring command line + * application. This class will parse input arguments and delegate to a suitable + * {@link Command} implementation based on the first argument. * *

* The '-d' and '--debug' switches are handled by this class, however, most argument @@ -34,23 +34,22 @@ import java.util.Set; * * @author Phillip Webb * @see #main(String...) - * @see BootstrapCliException + * @see SpringCliException * @see Command */ -public class SpringBootstrapCli { +public class SpringCli { public static final String CLI_APP = "spring"; - private static final Set NO_EXCEPTION_OPTIONS = EnumSet - .noneOf(BootstrapCliException.Option.class); + private static final Set NO_EXCEPTION_OPTIONS = EnumSet + .noneOf(SpringCliException.Option.class); private List commands; /** - * Create a new {@link SpringBootstrapCli} implementation with the default set of - * commands. + * Create a new {@link SpringCli} implementation with the default set of commands. */ - public SpringBootstrapCli() { + public SpringCli() { setCommands(ServiceLoader.load(CommandFactory.class, getClass().getClassLoader())); } @@ -87,25 +86,31 @@ public class SpringBootstrapCli { try { run(argsWithoutDebugFlags); return 0; - } catch (NoArgumentsException ex) { + } + catch (NoArgumentsException ex) { showUsage(); return 1; - } catch (Exception ex) { - Set options = NO_EXCEPTION_OPTIONS; - if (ex instanceof BootstrapCliException) { - options = ((BootstrapCliException) ex).getOptions(); - } - if (!(ex instanceof NoHelpCommandArgumentsException)) { - errorMessage(ex.getMessage()); - } - if (options.contains(BootstrapCliException.Option.SHOW_USAGE)) { - showUsage(); - } - if (debug || options.contains(BootstrapCliException.Option.STACK_TRACE)) { - printStackTrace(ex); - } - return 1; } + catch (Exception ex) { + return handleError(debug, ex); + } + } + + private int handleError(boolean debug, Exception ex) { + Set options = NO_EXCEPTION_OPTIONS; + if (ex instanceof SpringCliException) { + options = ((SpringCliException) ex).getOptions(); + } + if (!(ex instanceof NoHelpCommandArgumentsException)) { + errorMessage(ex.getMessage()); + } + if (options.contains(SpringCliException.Option.SHOW_USAGE)) { + showUsage(); + } + if (debug || options.contains(SpringCliException.Option.STACK_TRACE)) { + printStackTrace(ex); + } + return 1; } /** @@ -132,28 +137,28 @@ public class SpringBootstrapCli { } protected void showUsage() { - System.out.print("usage: " + CLI_APP + " "); - System.out.println(""); - System.out.println(" []"); - System.out.println(""); - System.out.println("Available commands are:"); + Log.info("usage: " + CLI_APP + " "); + Log.info(""); + Log.info(" []"); + Log.info(""); + Log.info("Available commands are:"); for (Command command : this.commands) { - System.out.println(String.format("\n %1$s %2$-15s\n %3$s", - command.getName(), command.getUsageHelp(), command.getDescription())); + Log.info(String.format("\n %1$s %2$-15s\n %3$s", command.getName(), + command.getUsageHelp(), command.getDescription())); } - System.out.println(""); - System.out.println("See '" + CLI_APP + Log.info(""); + Log.info("See '" + CLI_APP + " help ' for more information on a specific command."); } protected void errorMessage(String message) { - System.err.println(message == null ? "Unexpected error" : message); + Log.error(message == null ? "Unexpected error" : message); } protected void printStackTrace(Exception ex) { - System.err.println(""); - ex.printStackTrace(System.err); - System.err.println(""); + Log.error(""); + Log.error(ex); + Log.error(""); } private String[] removeDebugFlags(String[] args) { @@ -184,18 +189,18 @@ public class SpringBootstrapCli { throw new NoHelpCommandArgumentsException(); } String commandName = args[0]; - for (Command command : SpringBootstrapCli.this.commands) { + for (Command command : SpringCli.this.commands) { if (command.getName().equals(commandName)) { - System.out.println(CLI_APP + " " + command.getName() + " - " + Log.info(CLI_APP + " " + command.getName() + " - " + command.getDescription()); - System.out.println(); + Log.info(""); if (command.getUsageHelp() != null) { - System.out.println("usage: " + CLI_APP + " " + command.getName() - + " " + command.getUsageHelp()); - System.out.println(); + Log.info("usage: " + CLI_APP + " " + command.getName() + " " + + command.getUsageHelp()); + Log.info(""); } if (command.getHelp() != null) { - System.out.println(command.getHelp()); + Log.info(command.getHelp()); } return; } @@ -225,7 +230,7 @@ public class SpringBootstrapCli { } - static class NoHelpCommandArgumentsException extends BootstrapCliException { + static class NoHelpCommandArgumentsException extends SpringCliException { private static final long serialVersionUID = 1L; @@ -235,7 +240,7 @@ public class SpringBootstrapCli { } - static class NoArgumentsException extends BootstrapCliException { + static class NoArgumentsException extends SpringCliException { private static final long serialVersionUID = 1L; @@ -246,7 +251,7 @@ public class SpringBootstrapCli { * @param args CLI arguments */ public static void main(String... args) { - int exitCode = new SpringBootstrapCli().runAndHandleErrors(args); + int exitCode = new SpringCli().runAndHandleErrors(args); if (exitCode != 0) { System.exit(exitCode); } diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java b/spring-cli/src/main/java/org/springframework/cli/SpringCliException.java similarity index 72% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java rename to spring-cli/src/main/java/org/springframework/cli/SpringCliException.java index f8e59e31944..b6b9913d7b5 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/BootstrapCliException.java +++ b/spring-cli/src/main/java/org/springframework/cli/SpringCliException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli; +package org.springframework.cli; import java.util.Arrays; import java.util.Collections; @@ -23,41 +23,41 @@ import java.util.Set; /** * Runtime exception wrapper that defines additional {@link Option}s that are understood - * by the {@link SpringBootstrapCli}. + * by the {@link SpringCli}. * * @author Phillip Webb */ -public class BootstrapCliException extends RuntimeException { +public class SpringCliException extends RuntimeException { private static final long serialVersionUID = 0L; private final EnumSet

    *
  • {@link CompilerAutoConfiguration} strategies will be read from - * META-INF/services/org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration + * META-INF/services/org.springframework.cli.compiler.CompilerAutoConfiguration * (per the standard java {@link ServiceLoader} contract) and applied during compilation
  • * *
  • Multiple classes can be returned if the Groovy source defines more than one Class
  • @@ -88,7 +88,8 @@ public class GroovyCompiler { for (File file : files) { if (file.getName().endsWith(".groovy") || file.getName().endsWith(".java")) { compilables.add(file); - } else { + } + else { others.add(file); } } diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompilerConfiguration.java b/spring-cli/src/main/java/org/springframework/cli/compiler/GroovyCompilerConfiguration.java similarity index 94% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompilerConfiguration.java rename to spring-cli/src/main/java/org/springframework/cli/compiler/GroovyCompilerConfiguration.java index 3916db55e36..8a1376db0fb 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/GroovyCompilerConfiguration.java +++ b/spring-cli/src/main/java/org/springframework/cli/compiler/GroovyCompilerConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli.compiler; +package org.springframework.cli.compiler; /** * Configuration for the {@link GroovyCompiler}. diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java similarity index 90% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java rename to spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java index 4e0fc10650f..b1a631008ed 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java +++ b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringBatchCompilerAutoConfiguration.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli.compiler.autoconfigure; +package org.springframework.cli.compiler.autoconfigure; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.control.customizers.ImportCustomizer; -import org.springframework.bootstrap.cli.compiler.AstUtils; -import org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration; -import org.springframework.bootstrap.cli.compiler.DependencyCustomizer; +import org.springframework.cli.compiler.AstUtils; +import org.springframework.cli.compiler.CompilerAutoConfiguration; +import org.springframework.cli.compiler.DependencyCustomizer; /** * {@link CompilerAutoConfiguration} for Spring Batch. diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringCompilerAutoConfiguration.java similarity index 80% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java rename to spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringCompilerAutoConfiguration.java index 3ddb15c9048..bbba80a3689 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringBootstrapCompilerAutoConfiguration.java +++ b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringCompilerAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli.compiler.autoconfigure; +package org.springframework.cli.compiler.autoconfigure; import groovy.lang.GroovyClassLoader; @@ -24,23 +24,23 @@ import org.codehaus.groovy.classgen.GeneratorContext; import org.codehaus.groovy.control.CompilationFailedException; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.control.customizers.ImportCustomizer; -import org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration; -import org.springframework.bootstrap.cli.compiler.DependencyCustomizer; -import org.springframework.bootstrap.cli.compiler.GroovyCompilerConfiguration; +import org.springframework.cli.compiler.CompilerAutoConfiguration; +import org.springframework.cli.compiler.DependencyCustomizer; +import org.springframework.cli.compiler.GroovyCompilerConfiguration; /** - * {@link CompilerAutoConfiguration} for Spring Bootstrap. + * {@link CompilerAutoConfiguration} for Spring. * * @author Dave Syer * @author Phillip Webb */ -public class SpringBootstrapCompilerAutoConfiguration extends CompilerAutoConfiguration { +public class SpringCompilerAutoConfiguration extends CompilerAutoConfiguration { @Override public void applyDependencies(DependencyCustomizer dependencies) { dependencies.ifAnyMissingClasses( "org.springframework.bootstrap.SpringApplication").add( - "org.springframework.bootstrap", "spring-bootstrap", + "org.springframework.zero", "spring-autoconfigure", "0.5.0.BUILD-SNAPSHOT"); dependencies.ifAnyResourcesPresent("logback.xml").add("ch.qos.logback", "logback-classic", "1.0.7"); @@ -77,7 +77,7 @@ public class SpringBootstrapCompilerAutoConfiguration extends CompilerAutoConfig "org.springframework.core.annotation.Order", "org.springframework.core.io.ResourceLoader", "org.springframework.bootstrap.CommandLineRunner", - "org.springframework.bootstrap.context.annotation.EnableAutoConfiguration"); + "org.springframework.autoconfigure.EnableAutoConfiguration"); imports.addStarImports("org.springframework.stereotype"); } @@ -85,24 +85,22 @@ public class SpringBootstrapCompilerAutoConfiguration extends CompilerAutoConfig public void applyToMainClass(GroovyClassLoader loader, GroovyCompilerConfiguration configuration, GeneratorContext generatorContext, SourceUnit source, ClassNode classNode) throws CompilationFailedException { - if (true) { // FIXME: add switch for auto config - addEnableAutoConfigurationAnnotation(source, classNode); - } + // FIXME: add switch for auto config + addEnableAutoConfigurationAnnotation(source, classNode); } private void addEnableAutoConfigurationAnnotation(SourceUnit source, ClassNode classNode) { if (!hasEnableAutoConfigureAnnotation(classNode)) { try { - Class annotationClass = source - .getClassLoader() - .loadClass( - "org.springframework.bootstrap.context.annotation.EnableAutoConfiguration"); + Class annotationClass = source.getClassLoader().loadClass( + "org.springframework.autoconfigure.EnableAutoConfiguration"); AnnotationNode annotationNode = new AnnotationNode(new ClassNode( annotationClass)); classNode.addAnnotation(annotationNode); - } catch (ClassNotFoundException e) { - throw new IllegalStateException(e); + } + catch (ClassNotFoundException ex) { + throw new IllegalStateException(ex); } } } diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java similarity index 91% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java rename to spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java index 6092c21c34c..d621989e66a 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java +++ b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringIntegrationCompilerAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli.compiler.autoconfigure; +package org.springframework.cli.compiler.autoconfigure; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -24,9 +24,9 @@ import java.lang.annotation.Target; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.control.customizers.ImportCustomizer; -import org.springframework.bootstrap.cli.compiler.AstUtils; -import org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration; -import org.springframework.bootstrap.cli.compiler.DependencyCustomizer; +import org.springframework.cli.compiler.AstUtils; +import org.springframework.cli.compiler.CompilerAutoConfiguration; +import org.springframework.cli.compiler.DependencyCustomizer; /** * {@link CompilerAutoConfiguration} for Spring Integration. diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java similarity index 84% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java rename to spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java index 0aa0960c017..63dfb9e5839 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java +++ b/spring-cli/src/main/java/org/springframework/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli.compiler.autoconfigure; +package org.springframework.cli.compiler.autoconfigure; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.control.customizers.ImportCustomizer; -import org.springframework.bootstrap.cli.compiler.AstUtils; -import org.springframework.bootstrap.cli.compiler.CompilerAutoConfiguration; -import org.springframework.bootstrap.cli.compiler.DependencyCustomizer; +import org.springframework.cli.compiler.AstUtils; +import org.springframework.cli.compiler.CompilerAutoConfiguration; +import org.springframework.cli.compiler.DependencyCustomizer; /** * {@link CompilerAutoConfiguration} for Spring MVC. @@ -58,8 +58,8 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio imports.addStarImports("org.springframework.web.bind.annotation", "org.springframework.web.servlet.config.annotation", "org.springframework.http"); - imports.addStaticImport( - "org.springframework.bootstrap.cli.template.GroovyTemplate", "template"); + imports.addStaticImport("org.springframework.cli.template.GroovyTemplate", + "template"); } } diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunner.java b/spring-cli/src/main/java/org/springframework/cli/runner/SpringApplicationRunner.java similarity index 84% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunner.java rename to spring-cli/src/main/java/org/springframework/cli/runner/SpringApplicationRunner.java index 45a48324226..ade7d11b96f 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunner.java +++ b/spring-cli/src/main/java/org/springframework/cli/runner/SpringApplicationRunner.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli.runner; +package org.springframework.cli.runner; import java.io.File; import java.lang.reflect.Method; import java.util.concurrent.TimeUnit; import java.util.logging.Level; -import org.springframework.bootstrap.cli.compiler.GroovyCompiler; +import org.springframework.cli.compiler.GroovyCompiler; /** * Compiles Groovy code running the resulting classes using a {@code SpringApplication}. @@ -31,11 +31,11 @@ import org.springframework.bootstrap.cli.compiler.GroovyCompiler; * @author Phillip Webb * @author Dave Syer */ -public class BootstrapRunner { +public class SpringApplicationRunner { // FIXME logging - private BootstrapRunnerConfiguration configuration; + private SpringApplicationRunnerConfiguration configuration; private final File[] files; @@ -48,16 +48,17 @@ public class BootstrapRunner { private FileWatchThread fileWatchThread; /** - * Create a new {@link BootstrapRunner} instance. + * Create a new {@link SpringApplicationRunner} instance. * @param configuration the configuration * @param files the files to compile/watch * @param args input arguments */ - public BootstrapRunner(final BootstrapRunnerConfiguration configuration, - File[] files, String... args) { + public SpringApplicationRunner( + final SpringApplicationRunnerConfiguration configuration, File[] files, + String... args) { this.configuration = configuration; - this.files = files; - this.args = args; + this.files = files.clone(); + this.args = args.clone(); this.compiler = new GroovyCompiler(configuration); if (configuration.getLogLevel().intValue() <= Level.FINE.intValue()) { System.setProperty("groovy.grape.report.downloads", "true"); @@ -92,10 +93,12 @@ public class BootstrapRunner { this.fileWatchThread.start(); } - } catch (Exception ex) { + } + catch (Exception ex) { if (this.fileWatchThread == null) { throw ex; - } else { + } + else { ex.printStackTrace(); } } @@ -131,8 +134,9 @@ public class BootstrapRunner { Method method = application.getMethod("run", Object[].class, String[].class); this.applicationContext = method.invoke(null, this.sources, - BootstrapRunner.this.args); - } catch (Exception ex) { + SpringApplicationRunner.this.args); + } + catch (Exception ex) { ex.printStackTrace(); } } @@ -145,11 +149,14 @@ public class BootstrapRunner { try { Method method = this.applicationContext.getClass().getMethod("close"); method.invoke(this.applicationContext); - } catch (NoSuchMethodException ex) { + } + catch (NoSuchMethodException ex) { // Not an application context that we can close - } catch (Exception ex) { + } + catch (Exception ex) { ex.printStackTrace(); - } finally { + } + finally { this.applicationContext = null; } } @@ -165,7 +172,7 @@ public class BootstrapRunner { public FileWatchThread() { this.previous = 0; - for (File file : BootstrapRunner.this.files) { + for (File file : SpringApplicationRunner.this.files) { long current = file.lastModified(); if (current > this.previous) { this.previous = current; @@ -179,16 +186,18 @@ public class BootstrapRunner { while (true) { try { Thread.sleep(TimeUnit.SECONDS.toMillis(1)); - for (File file : BootstrapRunner.this.files) { + for (File file : SpringApplicationRunner.this.files) { long current = file.lastModified(); if (this.previous < current) { this.previous = current; compileAndRun(); } } - } catch (InterruptedException ex) { + } + catch (InterruptedException ex) { Thread.currentThread().interrupt(); - } catch (Exception ex) { + } + catch (Exception ex) { // Swallow, will be reported by compileAndRun } } diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunnerConfiguration.java b/spring-cli/src/main/java/org/springframework/cli/runner/SpringApplicationRunnerConfiguration.java similarity index 79% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunnerConfiguration.java rename to spring-cli/src/main/java/org/springframework/cli/runner/SpringApplicationRunnerConfiguration.java index 501c976af02..1dbdafa1e66 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/runner/BootstrapRunnerConfiguration.java +++ b/spring-cli/src/main/java/org/springframework/cli/runner/SpringApplicationRunnerConfiguration.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli.runner; +package org.springframework.cli.runner; import java.util.logging.Level; -import org.springframework.bootstrap.cli.compiler.GroovyCompilerConfiguration; +import org.springframework.cli.compiler.GroovyCompilerConfiguration; /** - * Configuration for the {@link BootstrapRunner}. + * Configuration for the {@link SpringApplicationRunner}. * * @author Phillip Webb */ -public interface BootstrapRunnerConfiguration extends GroovyCompilerConfiguration { +public interface SpringApplicationRunnerConfiguration extends GroovyCompilerConfiguration { /** * Returns {@code true} if the source file should be monitored for changes and diff --git a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/template/GroovyTemplate.java b/spring-cli/src/main/java/org/springframework/cli/template/GroovyTemplate.java similarity index 94% rename from spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/template/GroovyTemplate.java rename to spring-cli/src/main/java/org/springframework/cli/template/GroovyTemplate.java index 448413d0bd4..2eeb6d18567 100644 --- a/spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/template/GroovyTemplate.java +++ b/spring-cli/src/main/java/org/springframework/cli/template/GroovyTemplate.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli.template; +package org.springframework.cli.template; import groovy.text.GStringTemplateEngine; import groovy.text.Template; @@ -30,7 +30,7 @@ import org.codehaus.groovy.control.CompilationFailedException; /** * @author Dave Syer */ -public class GroovyTemplate { +public abstract class GroovyTemplate { // FIXME is this used? @@ -48,10 +48,12 @@ public class GroovyTemplate { Template template; if (file.exists()) { template = engine.createTemplate(file); - } else { + } + else { if (resource != null) { template = engine.createTemplate(resource); - } else { + } + else { template = engine.createTemplate(name); } } diff --git a/spring-bootstrap-cli/src/main/resources/.gitignore b/spring-cli/src/main/resources/.gitignore similarity index 100% rename from spring-bootstrap-cli/src/main/resources/.gitignore rename to spring-cli/src/main/resources/.gitignore diff --git a/spring-cli/src/main/resources/META-INF/services/org.springframework.cli.CommandFactory b/spring-cli/src/main/resources/META-INF/services/org.springframework.cli.CommandFactory new file mode 100644 index 00000000000..4c3ba9e9ff6 --- /dev/null +++ b/spring-cli/src/main/resources/META-INF/services/org.springframework.cli.CommandFactory @@ -0,0 +1 @@ +org.springframework.cli.command.DefaultCommandFactory diff --git a/spring-cli/src/main/resources/META-INF/services/org.springframework.cli.compiler.CompilerAutoConfiguration b/spring-cli/src/main/resources/META-INF/services/org.springframework.cli.compiler.CompilerAutoConfiguration new file mode 100644 index 00000000000..d38b20b129d --- /dev/null +++ b/spring-cli/src/main/resources/META-INF/services/org.springframework.cli.compiler.CompilerAutoConfiguration @@ -0,0 +1,5 @@ +org.springframework.cli.compiler.autoconfigure.SpringCompilerAutoConfiguration +org.springframework.cli.compiler.autoconfigure.SpringMvcCompilerAutoConfiguration +org.springframework.cli.compiler.autoconfigure.SpringBatchCompilerAutoConfiguration +org.springframework.cli.compiler.autoconfigure.SpringIntegrationCompilerAutoConfiguration + diff --git a/spring-bootstrap-cli/src/main/scripts/spring b/spring-cli/src/main/scripts/spring similarity index 100% rename from spring-bootstrap-cli/src/main/scripts/spring rename to spring-cli/src/main/scripts/spring diff --git a/spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SampleIntegrationTests.java b/spring-cli/src/test/java/org/springframework/cli/SampleIntegrationTests.java similarity index 96% rename from spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SampleIntegrationTests.java rename to spring-cli/src/test/java/org/springframework/cli/SampleIntegrationTests.java index 3d1d1a716e9..100b91873fc 100644 --- a/spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SampleIntegrationTests.java +++ b/spring-cli/src/test/java/org/springframework/cli/SampleIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.cli; +package org.springframework.cli; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -30,12 +30,14 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; -import org.springframework.bootstrap.cli.command.RunCommand; +import org.springframework.cli.command.RunCommand; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** + * Integration tests to exercise the samples. + * * @author Dave Syer */ public class SampleIntegrationTests { @@ -83,7 +85,7 @@ public class SampleIntegrationTests { @BeforeClass public static void clean() { - // SpringBootstrapCli.main("clean"); + // SpringCli.main("clean"); // System.setProperty("ivy.message.logger.level", "3"); } diff --git a/spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java b/spring-cli/src/test/java/org/springframework/cli/SpringCliTests.java similarity index 87% rename from spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java rename to spring-cli/src/test/java/org/springframework/cli/SpringCliTests.java index fe82f69ffcc..ede14dd9876 100644 --- a/spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java +++ b/spring-cli/src/test/java/org/springframework/cli/SpringCliTests.java @@ -1,4 +1,4 @@ -package org.springframework.bootstrap.cli; +package org.springframework.cli; import java.util.Arrays; import java.util.EnumSet; @@ -10,8 +10,11 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.springframework.bootstrap.cli.SpringBootstrapCli.NoArgumentsException; -import org.springframework.bootstrap.cli.SpringBootstrapCli.NoHelpCommandArgumentsException; +import org.springframework.cli.Command; +import org.springframework.cli.NoSuchCommandException; +import org.springframework.cli.SpringCli; +import org.springframework.cli.SpringCli.NoArgumentsException; +import org.springframework.cli.SpringCli.NoHelpCommandArgumentsException; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; @@ -20,17 +23,17 @@ import static org.mockito.BDDMockito.willThrow; import static org.mockito.Mockito.verify; /** - * Tests for {@link SpringBootstrapCli}. + * Tests for {@link SpringCli}. * * @author Phillip Webb * @author Dave Syer */ -public class SpringBootstrapCliTests { +public class SpringCliTests { @Rule public ExpectedException thrown = ExpectedException.none(); - private SpringBootstrapCli cli; + private SpringCli cli; @Mock private Command regularCommand; @@ -40,23 +43,23 @@ public class SpringBootstrapCliTests { @Before public void setup() { MockitoAnnotations.initMocks(this); - this.cli = new SpringBootstrapCli() { + this.cli = new SpringCli() { @Override protected void showUsage() { - SpringBootstrapCliTests.this.calls.add(Call.SHOW_USAGE); + SpringCliTests.this.calls.add(Call.SHOW_USAGE); super.showUsage(); }; @Override protected void errorMessage(String message) { - SpringBootstrapCliTests.this.calls.add(Call.ERROR_MESSAGE); + SpringCliTests.this.calls.add(Call.ERROR_MESSAGE); super.errorMessage(message); } @Override protected void printStackTrace(Exception ex) { - SpringBootstrapCliTests.this.calls.add(Call.PRINT_STACK_TRACE); + SpringCliTests.this.calls.add(Call.PRINT_STACK_TRACE); super.printStackTrace(ex); } }; diff --git a/spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/command/ScriptCommandTests.java b/spring-cli/src/test/java/org/springframework/cli/command/ScriptCommandTests.java similarity index 95% rename from spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/command/ScriptCommandTests.java rename to spring-cli/src/test/java/org/springframework/cli/command/ScriptCommandTests.java index 21c1c997909..638c071cce2 100644 --- a/spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/command/ScriptCommandTests.java +++ b/spring-cli/src/test/java/org/springframework/cli/command/ScriptCommandTests.java @@ -13,20 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.cli.command; + +package org.springframework.cli.command; import groovy.lang.GroovyObjectSupport; import groovy.lang.Script; import org.junit.Test; +import org.springframework.cli.command.OptionHandler; +import org.springframework.cli.command.ScriptCommand; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; /** - * @author Dave Syer + * Tests for {@link ScriptCommand}. * + * @author Dave Syer */ public class ScriptCommandTests { diff --git a/spring-cli/src/test/resources/commands/closure.groovy b/spring-cli/src/test/resources/commands/closure.groovy new file mode 100644 index 00000000000..a88fcea6966 --- /dev/null +++ b/spring-cli/src/test/resources/commands/closure.groovy @@ -0,0 +1,6 @@ +def run = { msg -> + org.springframework.cli.command.ScriptCommandTests.executed = true + println "Hello ${msg}" +} + +run diff --git a/spring-bootstrap-cli/src/test/resources/commands/command.groovy b/spring-cli/src/test/resources/commands/command.groovy similarity index 75% rename from spring-bootstrap-cli/src/test/resources/commands/command.groovy rename to spring-cli/src/test/resources/commands/command.groovy index 0a5cac19c7d..0563cbc34e3 100644 --- a/spring-bootstrap-cli/src/test/resources/commands/command.groovy +++ b/spring-cli/src/test/resources/commands/command.groovy @@ -3,15 +3,15 @@ package org.test.command class TestCommand implements Command { String name = "foo" - + String description = "My script command" - + String help = "No options" String usageHelp = "Not very useful" void run(String... args) { - org.springframework.bootstrap.cli.command.ScriptCommandTests.executed = true + org.springframework.cli.command.ScriptCommandTests.executed = true println "Hello ${args[0]}" } diff --git a/spring-bootstrap-cli/src/test/resources/commands/handler.groovy b/spring-cli/src/test/resources/commands/handler.groovy similarity index 85% rename from spring-bootstrap-cli/src/test/resources/commands/handler.groovy rename to spring-cli/src/test/resources/commands/handler.groovy index 4f9131ff5d7..c26942aa6e1 100644 --- a/spring-bootstrap-cli/src/test/resources/commands/handler.groovy +++ b/spring-cli/src/test/resources/commands/handler.groovy @@ -12,7 +12,7 @@ class TestCommand extends OptionHandler { void run(OptionSet options) { // Demonstrate use of Grape.grab to load dependencies before running println "Clean : " + Git.open(".." as File).status().call().isClean() - org.springframework.bootstrap.cli.command.ScriptCommandTests.executed = true + org.springframework.cli.command.ScriptCommandTests.executed = true println "Hello ${options.nonOptionArguments()}: ${options.has('foo')}" } diff --git a/spring-bootstrap-cli/src/test/resources/commands/mixin.groovy b/spring-cli/src/test/resources/commands/mixin.groovy similarity index 60% rename from spring-bootstrap-cli/src/test/resources/commands/mixin.groovy rename to spring-cli/src/test/resources/commands/mixin.groovy index e5c80a41d54..1f0577030af 100644 --- a/spring-bootstrap-cli/src/test/resources/commands/mixin.groovy +++ b/spring-cli/src/test/resources/commands/mixin.groovy @@ -2,5 +2,5 @@ void options() { option "foo", "Foo set" } -org.springframework.bootstrap.cli.command.ScriptCommandTests.executed = true +org.springframework.cli.command.ScriptCommandTests.executed = true println "Hello ${options.nonOptionArguments()}: ${options.has('foo')}" diff --git a/spring-bootstrap-cli/src/test/resources/commands/runnable.groovy b/spring-cli/src/test/resources/commands/runnable.groovy similarity index 57% rename from spring-bootstrap-cli/src/test/resources/commands/runnable.groovy rename to spring-cli/src/test/resources/commands/runnable.groovy index 02131f68525..f181bab888c 100644 --- a/spring-bootstrap-cli/src/test/resources/commands/runnable.groovy +++ b/spring-cli/src/test/resources/commands/runnable.groovy @@ -4,8 +4,8 @@ class TestCommand implements Runnable { this.msg = msg } void run() { - org.springframework.bootstrap.cli.command.ScriptCommandTests.executed = true + org.springframework.cli.command.ScriptCommandTests.executed = true println "Hello ${msg}" } } -new TestCommand(args[0]) \ No newline at end of file +new TestCommand(args[0]) diff --git a/spring-bootstrap-cli/src/test/resources/commands/script.groovy b/spring-cli/src/test/resources/commands/script.groovy similarity index 100% rename from spring-bootstrap-cli/src/test/resources/commands/script.groovy rename to spring-cli/src/test/resources/commands/script.groovy diff --git a/spring-bootstrap-cli/src/test/resources/commands/test.groovy b/spring-cli/src/test/resources/commands/test.groovy similarity index 73% rename from spring-bootstrap-cli/src/test/resources/commands/test.groovy rename to spring-cli/src/test/resources/commands/test.groovy index e74e6c7a48a..102275ccf0c 100644 --- a/spring-bootstrap-cli/src/test/resources/commands/test.groovy +++ b/spring-cli/src/test/resources/commands/test.groovy @@ -3,5 +3,5 @@ options { option "bar", "Bar has an argument of type int" withOptionalArg() ofType Integer } -org.springframework.bootstrap.cli.command.ScriptCommandTests.executed = true +org.springframework.cli.command.ScriptCommandTests.executed = true println "Hello ${options.nonOptionArguments()}: ${options.has('foo')} ${options.valueOf('bar')}" diff --git a/spring-bootstrap-cli/src/test/resources/css/bootstrap.min.css b/spring-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-cli/src/test/resources/css/bootstrap.min.css diff --git a/spring-bootstrap-cli/src/test/resources/log4j.properties b/spring-cli/src/test/resources/log4j.properties similarity index 87% rename from spring-bootstrap-cli/src/test/resources/log4j.properties rename to spring-cli/src/test/resources/log4j.properties index 8e17be9f968..0591897a1ba 100644 --- a/spring-bootstrap-cli/src/test/resources/log4j.properties +++ b/spring-cli/src/test/resources/log4j.properties @@ -4,6 +4,7 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n +log4j.category.org.springframework.autoconfigure=DEBUG log4j.category.org.springframework.bootstrap=DEBUG #log4j.category.org.springframework.integration.dsl=DEBUG #log4j.category.org.springframework.amqp=DEBUG diff --git a/spring-bootstrap-cli/src/test/resources/templates/home.html b/spring-cli/src/test/resources/templates/home.html similarity index 100% rename from spring-bootstrap-cli/src/test/resources/templates/home.html rename to spring-cli/src/test/resources/templates/home.html diff --git a/spring-bootstrap-cli/src/test/resources/templates/test.txt b/spring-cli/src/test/resources/templates/test.txt similarity index 100% rename from spring-bootstrap-cli/src/test/resources/templates/test.txt rename to spring-cli/src/test/resources/templates/test.txt diff --git a/spring-bootstrap-launcher/pom.xml b/spring-launcher/pom.xml similarity index 65% rename from spring-bootstrap-launcher/pom.xml rename to spring-launcher/pom.xml index 95891143bab..7d3e5c0f34f 100644 --- a/spring-bootstrap-launcher/pom.xml +++ b/spring-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-launcher jar + + ${basedir}/.. + diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/JarLauncher.java b/spring-launcher/src/main/java/org/springframework/launcher/JarLauncher.java similarity index 91% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/JarLauncher.java rename to spring-launcher/src/main/java/org/springframework/launcher/JarLauncher.java index e9499210289..db3732a2545 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/JarLauncher.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/JarLauncher.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher; +package org.springframework.launcher; import java.util.List; import java.util.jar.JarEntry; -import org.springframework.bootstrap.launcher.jar.RandomAccessJarFile; +import org.springframework.launcher.jar.RandomAccessJarFile; /** * {@link Launcher} for JAR based archives. This launcher assumes that dependency jars are diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/Launcher.java b/spring-launcher/src/main/java/org/springframework/launcher/Launcher.java similarity index 97% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/Launcher.java rename to spring-launcher/src/main/java/org/springframework/launcher/Launcher.java index 9919c926e6e..84072d7aaba 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/Launcher.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/Launcher.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher; +package org.springframework.launcher; import java.io.File; import java.lang.reflect.Constructor; @@ -28,7 +28,7 @@ import java.util.List; import java.util.jar.JarEntry; import java.util.logging.Logger; -import org.springframework.bootstrap.launcher.jar.RandomAccessJarFile; +import org.springframework.launcher.jar.RandomAccessJarFile; /** * Base class for launchers that can start an application with a fully configured @@ -55,8 +55,9 @@ public abstract class Launcher { public void launch(String[] args) { try { launch(args, getClass().getProtectionDomain()); - } catch (Exception e) { - e.printStackTrace(); + } + catch (Exception ex) { + ex.printStackTrace(); System.exit(1); } } diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/MainMethodRunner.java b/spring-launcher/src/main/java/org/springframework/launcher/MainMethodRunner.java similarity index 83% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/MainMethodRunner.java rename to spring-launcher/src/main/java/org/springframework/launcher/MainMethodRunner.java index a572855dea2..6fe050bcc2f 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/MainMethodRunner.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/MainMethodRunner.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher; +package org.springframework.launcher; import java.lang.reflect.Method; @@ -37,22 +37,23 @@ public class MainMethodRunner implements Runnable { */ public MainMethodRunner(String mainClass, String[] args) { this.mainClassName = mainClass; - this.args = args; + this.args = (args == null ? null : args.clone()); } @Override public void run() { try { Class mainClass = Thread.currentThread().getContextClassLoader() - .loadClass(mainClassName); + .loadClass(this.mainClassName); Method mainMethod = mainClass.getDeclaredMethod("main", String[].class); if (mainMethod == null) { - throw new IllegalStateException(mainClassName + throw new IllegalStateException(this.mainClassName + " does not have a main method"); } - mainMethod.invoke(null, new Object[] { args }); - } catch (Exception e) { - e.printStackTrace(); + mainMethod.invoke(null, new Object[] { this.args }); + } + catch (Exception ex) { + ex.printStackTrace(); System.exit(1); } } diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/WarLauncher.java b/spring-launcher/src/main/java/org/springframework/launcher/WarLauncher.java similarity index 91% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/WarLauncher.java rename to spring-launcher/src/main/java/org/springframework/launcher/WarLauncher.java index b09efc52d87..e152424af35 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/WarLauncher.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/WarLauncher.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher; +package org.springframework.launcher; import java.io.IOException; import java.util.List; import java.util.jar.JarEntry; -import org.springframework.bootstrap.launcher.jar.JarEntryFilter; -import org.springframework.bootstrap.launcher.jar.RandomAccessJarFile; +import org.springframework.launcher.jar.JarEntryFilter; +import org.springframework.launcher.jar.RandomAccessJarFile; /** * {@link Launcher} for WAR based archives. This launcher for standard WAR archives. @@ -36,7 +36,8 @@ public class WarLauncher extends Launcher { protected boolean isNestedJarFile(JarEntry jarEntry) { if (jarEntry.isDirectory()) { return jarEntry.getName().equals("WEB-INF/classes/"); - } else { + } + else { return jarEntry.getName().startsWith("WEB-INF/lib/") || jarEntry.getName().startsWith("WEB-INF/lib-provided/"); } diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessData.java b/spring-launcher/src/main/java/org/springframework/launcher/data/RandomAccessData.java similarity index 96% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessData.java rename to spring-launcher/src/main/java/org/springframework/launcher/data/RandomAccessData.java index abe1b93de07..a549b247d41 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessData.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/data/RandomAccessData.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher.data; +package org.springframework.launcher.data; import java.io.InputStream; diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFile.java b/spring-launcher/src/main/java/org/springframework/launcher/data/RandomAccessDataFile.java similarity index 96% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFile.java rename to spring-launcher/src/main/java/org/springframework/launcher/data/RandomAccessDataFile.java index 2756b3bf920..687e5c9230f 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFile.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/data/RandomAccessDataFile.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher.data; +package org.springframework.launcher.data; import java.io.File; import java.io.IOException; @@ -163,10 +163,12 @@ public class RandomAccessDataFile implements RandomAccessData { int rtn = file.read(); moveOn(rtn == -1 ? 0 : 1); return rtn; - } else { + } + else { return (int) moveOn(file.read(b, off, (int) cap(len))); } - } finally { + } + finally { RandomAccessDataFile.this.filePool.release(file); } } @@ -222,8 +224,9 @@ public class RandomAccessDataFile implements RandomAccessData { RandomAccessFile file = this.files.poll(); return (file == null ? new RandomAccessFile( RandomAccessDataFile.this.file, "r") : file); - } catch (InterruptedException e) { - throw new IOException(e); + } + catch (InterruptedException ex) { + throw new IOException(ex); } } @@ -241,11 +244,13 @@ public class RandomAccessDataFile implements RandomAccessData { file.close(); file = files.poll(); } - } finally { + } + finally { this.available.release(size); } - } catch (InterruptedException e) { - throw new IOException(e); + } + catch (InterruptedException ex) { + throw new IOException(ex); } } } diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/package-info.java b/spring-launcher/src/main/java/org/springframework/launcher/data/package-info.java similarity index 85% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/package-info.java rename to spring-launcher/src/main/java/org/springframework/launcher/data/package-info.java index 4d04676a47b..06f1bdc3508 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/data/package-info.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/data/package-info.java @@ -17,7 +17,7 @@ /** * Classes and interfaces to allows random access to a block of data. * - * @see org.springframework.bootstrap.launcher.data.RandomAccessData + * @see org.springframework.launcher.data.RandomAccessData */ -package org.springframework.bootstrap.launcher.data; +package org.springframework.launcher.data; diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/JarEntryFilter.java b/spring-launcher/src/main/java/org/springframework/launcher/jar/JarEntryFilter.java similarity index 95% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/JarEntryFilter.java rename to spring-launcher/src/main/java/org/springframework/launcher/jar/JarEntryFilter.java index 762f3c1cdb7..d368d4586be 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/JarEntryFilter.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/jar/JarEntryFilter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher.jar; +package org.springframework.launcher.jar; import java.util.jar.JarEntry; diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipEntry.java b/spring-launcher/src/main/java/org/springframework/launcher/jar/RandomAccessDataZipEntry.java similarity index 91% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipEntry.java rename to spring-launcher/src/main/java/org/springframework/launcher/jar/RandomAccessDataZipEntry.java index 54e1b4e4127..98f641e3603 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipEntry.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/jar/RandomAccessDataZipEntry.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher.jar; +package org.springframework.launcher.jar; import java.util.zip.ZipEntry; -import org.springframework.bootstrap.launcher.data.RandomAccessData; +import org.springframework.launcher.data.RandomAccessData; /** * A {@link ZipEntry} returned from a {@link RandomAccessDataZipInputStream}. diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStream.java b/spring-launcher/src/main/java/org/springframework/launcher/jar/RandomAccessDataZipInputStream.java similarity index 96% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStream.java rename to spring-launcher/src/main/java/org/springframework/launcher/jar/RandomAccessDataZipInputStream.java index 184dbb62b73..8f0c6d1340e 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStream.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/jar/RandomAccessDataZipInputStream.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher.jar; +package org.springframework.launcher.jar; import java.io.FilterInputStream; import java.io.IOException; @@ -23,7 +23,7 @@ import java.io.PushbackInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import org.springframework.bootstrap.launcher.data.RandomAccessData; +import org.springframework.launcher.data.RandomAccessData; /** * A {@link ZipInputStream} backed by {@link RandomAccessData}. Parsed entries provide diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFile.java b/spring-launcher/src/main/java/org/springframework/launcher/jar/RandomAccessJarFile.java similarity index 88% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFile.java rename to spring-launcher/src/main/java/org/springframework/launcher/jar/RandomAccessJarFile.java index 526d3daf696..ac8b46b34c9 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFile.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/jar/RandomAccessJarFile.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher.jar; +package org.springframework.launcher.jar; import java.io.BufferedInputStream; import java.io.EOFException; @@ -39,8 +39,8 @@ import java.util.zip.Inflater; import java.util.zip.InflaterInputStream; import java.util.zip.ZipEntry; -import org.springframework.bootstrap.launcher.data.RandomAccessData; -import org.springframework.bootstrap.launcher.data.RandomAccessDataFile; +import org.springframework.launcher.data.RandomAccessData; +import org.springframework.launcher.data.RandomAccessDataFile; /** * A Jar file that can loaded from a {@link RandomAccessDataFile}. This class extends and @@ -82,7 +82,7 @@ public class RandomAccessJarFile extends JarFile { * @throws IOException */ public RandomAccessJarFile(File file, JarEntryFilter... filters) throws IOException { - this(new RandomAccessDataFile(file)); + this(new RandomAccessDataFile(file), filters); } /** @@ -93,7 +93,7 @@ public class RandomAccessJarFile extends JarFile { */ public RandomAccessJarFile(RandomAccessDataFile file, JarEntryFilter... filters) throws IOException { - this(file, file.getFile().getPath(), file); + this(file, file.getFile().getPath(), file, filters); } /** @@ -127,7 +127,8 @@ public class RandomAccessJarFile extends JarFile { ((Entry) containedEntry).configure(this.manifest); } } - } finally { + } + finally { inputStream.close(); } } @@ -203,31 +204,40 @@ public class RandomAccessJarFile extends JarFile { if (ze == null) { throw new IllegalArgumentException("ZipEntry must not be null"); } + if (ze.isDirectory()) { - final String directoryName = ze.getName(); - JarEntryFilter[] filtersToUse = new JarEntryFilter[filters.length + 1]; - System.arraycopy(filters, 0, filtersToUse, 1, filters.length); - filtersToUse[0] = new JarEntryFilter() { - @Override - public String apply(String entryName, JarEntry entry) { - if (entryName.startsWith(directoryName) - && !entryName.equals(directoryName)) { - return entryName.substring(ze.getName().length()); - } - return null; - } - }; - return new RandomAccessJarFile(this.rootJarFile, getName() + "!/" - + directoryName.substring(0, directoryName.length() - 1), this.data, - filtersToUse); - } else { - if (ze.getMethod() != ZipEntry.STORED) { - throw new IllegalStateException("Unable to open nested compressed entry " - + ze.getName()); - } - return new RandomAccessJarFile(this.rootJarFile, getName() + "!/" - + ze.getName(), getData(ze), filters); + return getNestedJarFileFromDirectoryEntry(ze, filters); } + + return getNestedJarFileFromFileEntry(ze, filters); + } + + private RandomAccessJarFile getNestedJarFileFromDirectoryEntry(final ZipEntry entry, + JarEntryFilter... filters) throws IOException { + final String name = entry.getName(); + JarEntryFilter[] filtersToUse = new JarEntryFilter[filters.length + 1]; + System.arraycopy(filters, 0, filtersToUse, 1, filters.length); + filtersToUse[0] = new JarEntryFilter() { + @Override + public String apply(String entryName, JarEntry ze) { + if (entryName.startsWith(name) && !entryName.equals(name)) { + return entryName.substring(entry.getName().length()); + } + return null; + } + }; + return new RandomAccessJarFile(this.rootJarFile, getName() + "!/" + + name.substring(0, name.length() - 1), this.data, filtersToUse); + } + + private RandomAccessJarFile getNestedJarFileFromFileEntry(ZipEntry entry, + JarEntryFilter... filters) throws IOException { + if (entry.getMethod() != ZipEntry.STORED) { + throw new IllegalStateException("Unable to open nested compressed entry " + + entry.getName()); + } + return new RandomAccessJarFile(this.rootJarFile, getName() + "!/" + + entry.getName(), getData(entry), filters); } /** @@ -411,7 +421,8 @@ public class RandomAccessJarFile extends JarFile { connect(); return (int) (this.jarEntry == null ? this.jarFile.size() : this.jarEntry .getSize()); - } catch (IOException e) { + } + catch (IOException ex) { return -1; } } @@ -453,7 +464,8 @@ public class RandomAccessJarFile extends JarFile { protected void fill() throws IOException { try { super.fill(); - } catch (EOFException ex) { + } + catch (EOFException ex) { if (this.extraBytesWritten) { throw ex; } diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/package-info.java b/spring-launcher/src/main/java/org/springframework/launcher/jar/package-info.java similarity index 92% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/package-info.java rename to spring-launcher/src/main/java/org/springframework/launcher/jar/package-info.java index d24447a335e..4a44ebcdb78 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/jar/package-info.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/jar/package-info.java @@ -17,5 +17,5 @@ /** * Support for loading and manipulating JAR/WAR files. */ -package org.springframework.bootstrap.launcher.jar; +package org.springframework.launcher.jar; diff --git a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/package-info.java b/spring-launcher/src/main/java/org/springframework/launcher/package-info.java similarity index 85% rename from spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/package-info.java rename to spring-launcher/src/main/java/org/springframework/launcher/package-info.java index 67b42b214db..a878456639a 100644 --- a/spring-bootstrap-launcher/src/main/java/org/springframework/bootstrap/launcher/package-info.java +++ b/spring-launcher/src/main/java/org/springframework/launcher/package-info.java @@ -20,8 +20,8 @@ * not need to create shade style jars) and are executed without unpacking. The only * constraint is that nested JARs must be stored in the archive uncompressed. * - * @see org.springframework.bootstrap.launcher.JarLauncher - * @see org.springframework.bootstrap.launcher.WarLauncher + * @see org.springframework.launcher.JarLauncher + * @see org.springframework.launcher.WarLauncher */ -package org.springframework.bootstrap.launcher; +package org.springframework.launcher; diff --git a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/ByteArrayStartsWith.java b/spring-launcher/src/test/java/org/springframework/launcher/ByteArrayStartsWith.java similarity index 96% rename from spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/ByteArrayStartsWith.java rename to spring-launcher/src/test/java/org/springframework/launcher/ByteArrayStartsWith.java index 3b8a4f4102b..b586f9fb407 100644 --- a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/ByteArrayStartsWith.java +++ b/spring-launcher/src/test/java/org/springframework/launcher/ByteArrayStartsWith.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher; +package org.springframework.launcher; import org.hamcrest.Description; import org.hamcrest.TypeSafeMatcher; diff --git a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFileTest.java b/spring-launcher/src/test/java/org/springframework/launcher/data/RandomAccessDataFileTest.java similarity index 97% rename from spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFileTest.java rename to spring-launcher/src/test/java/org/springframework/launcher/data/RandomAccessDataFileTest.java index 28a9ae38fc6..959508c65ca 100644 --- a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/data/RandomAccessDataFileTest.java +++ b/spring-launcher/src/test/java/org/springframework/launcher/data/RandomAccessDataFileTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher.data; +package org.springframework.launcher.data; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; @@ -39,7 +39,9 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; -import org.springframework.bootstrap.launcher.ByteArrayStartsWith; +import org.springframework.launcher.ByteArrayStartsWith; +import org.springframework.launcher.data.RandomAccessData; +import org.springframework.launcher.data.RandomAccessDataFile; /** * Tests for {@link RandomAccessDataFile}. diff --git a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStreamTest.java b/spring-launcher/src/test/java/org/springframework/launcher/jar/RandomAccessDataZipInputStreamTest.java similarity index 90% rename from spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStreamTest.java rename to spring-launcher/src/test/java/org/springframework/launcher/jar/RandomAccessDataZipInputStreamTest.java index 6be2c8bb680..b6e7a9fc584 100644 --- a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessDataZipInputStreamTest.java +++ b/spring-launcher/src/test/java/org/springframework/launcher/jar/RandomAccessDataZipInputStreamTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher.jar; +package org.springframework.launcher.jar; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -31,7 +31,9 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.springframework.bootstrap.launcher.data.RandomAccessDataFile; +import org.springframework.launcher.data.RandomAccessDataFile; +import org.springframework.launcher.jar.RandomAccessDataZipEntry; +import org.springframework.launcher.jar.RandomAccessDataZipInputStream; /** * Tests for {@link RandomAccessDataZipInputStream}. @@ -52,7 +54,8 @@ public class RandomAccessDataZipInputStreamTest { try { writeDataEntry(zipOutputStream, "a", new byte[10]); writeDataEntry(zipOutputStream, "b", new byte[20]); - } finally { + } + finally { zipOutputStream.close(); } } @@ -83,7 +86,8 @@ public class RandomAccessDataZipInputStreamTest { assertThat(entry2.getName(), equalTo("b")); assertThat(entry2.getData().getSize(), equalTo(20L)); assertThat(z.getNextEntry(), nullValue()); - } finally { + } + finally { z.close(); } } diff --git a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java b/spring-launcher/src/test/java/org/springframework/launcher/jar/RandomAccessJarFileTest.java similarity index 98% rename from spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java rename to spring-launcher/src/test/java/org/springframework/launcher/jar/RandomAccessJarFileTest.java index 906290dc6e1..b50ddd5a431 100644 --- a/spring-bootstrap-launcher/src/test/java/org/springframework/bootstrap/launcher/jar/RandomAccessJarFileTest.java +++ b/spring-launcher/src/test/java/org/springframework/launcher/jar/RandomAccessJarFileTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.launcher.jar; +package org.springframework.launcher.jar; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; @@ -48,11 +48,13 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; -import org.springframework.bootstrap.launcher.data.RandomAccessDataFile; +import org.springframework.launcher.data.RandomAccessDataFile; +import org.springframework.launcher.jar.JarEntryFilter; +import org.springframework.launcher.jar.RandomAccessJarFile; /** * Tests for {@link RandomAccessJarFile}. - * + * * @author Phillip Webb */ public class RandomAccessJarFileTest { @@ -91,7 +93,8 @@ public class RandomAccessJarFileTest { jarOutputStream.putNextEntry(nestedEntry); jarOutputStream.write(nestedJarData); jarOutputStream.closeEntry(); - } finally { + } + finally { jarOutputStream.close(); } this.jarFile = new RandomAccessJarFile(this.rootJarFile); diff --git a/spring-bootstrap-maven-plugin/pom.xml b/spring-package-maven-plugin/pom.xml similarity index 83% rename from spring-bootstrap-maven-plugin/pom.xml rename to spring-package-maven-plugin/pom.xml index 0b8b26b36f4..4b4c5ef4634 100644 --- a/spring-bootstrap-maven-plugin/pom.xml +++ b/spring-package-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-package-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-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-package-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-package-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-package-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-package-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-package-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-package-maven-plugin/src/it/executable-jar/verify.groovy similarity index 70% rename from spring-bootstrap-maven-plugin/src/it/executable-jar/verify.groovy rename to spring-package-maven-plugin/src/it/executable-jar/verify.groovy index 3cb1dc0b25c..a52a963b719 100644 --- a/spring-bootstrap-maven-plugin/src/it/executable-jar/verify.groovy +++ b/spring-package-maven-plugin/src/it/executable-jar/verify.groovy @@ -1,5 +1,5 @@ import java.io.*; -import org.springframework.bootstrap.maven.*; +import org.springframework.maven.packaging.*; Verify.verifyJar( new File( basedir, "target/executable-jar-0.0.1.BUILD-SNAPSHOT.jar" ) diff --git a/spring-bootstrap-maven-plugin/src/it/executable-war/pom.xml b/spring-package-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-package-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-package-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-package-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-package-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-package-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-package-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-package-maven-plugin/src/it/executable-war/verify.groovy similarity index 70% rename from spring-bootstrap-maven-plugin/src/it/executable-war/verify.groovy rename to spring-package-maven-plugin/src/it/executable-war/verify.groovy index 22967f9ab37..79ba3a8fb7e 100644 --- a/spring-bootstrap-maven-plugin/src/it/executable-war/verify.groovy +++ b/spring-package-maven-plugin/src/it/executable-war/verify.groovy @@ -1,5 +1,5 @@ import java.io.*; -import org.springframework.bootstrap.maven.*; +import org.springframework.maven.packaging.*; Verify.verifyWar( new File( basedir, "target/executable-war-0.0.1.BUILD-SNAPSHOT.war" ) diff --git a/spring-bootstrap-maven-plugin/src/it/settings.xml b/spring-package-maven-plugin/src/it/settings.xml similarity index 100% rename from spring-bootstrap-maven-plugin/src/it/settings.xml rename to spring-package-maven-plugin/src/it/settings.xml diff --git a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/AbstractExecutableArchiveMojo.java similarity index 98% rename from spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java rename to spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/AbstractExecutableArchiveMojo.java index 496850790ec..98f26f365ce 100644 --- a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/AbstractExecutableArchiveMojo.java +++ b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/AbstractExecutableArchiveMojo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.maven; +package org.springframework.maven.packaging; import java.io.File; import java.io.IOException; @@ -187,7 +187,8 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo { File archiveFile = createArchive(); if (this.classifier == null || this.classifier.isEmpty()) { this.project.getArtifact().setFile(archiveFile); - } else { + } + else { this.projectHelper.attachArtifact(this.project, getType(), this.classifier, archiveFile); } @@ -209,10 +210,12 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo { try { archiver.createArchive(this.session, this.project, this.archive); return archiveFile; - } finally { + } + finally { zipFile.close(); } - } catch (Exception ex) { + } + catch (Exception ex) { throw new MojoExecutionException("Error assembling archive", ex); } } @@ -289,7 +292,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-launcher:" + version); ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest( artifact, repositories, "plugin"); ArtifactDescriptorResult descriptorResult = this.repositorySystem @@ -306,7 +309,8 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo { throw new MojoExecutionException("Unable to resolve launcher classes"); } return addLauncherClasses(archiver, artifactResult.getArtifact().getFile()); - } catch (Exception ex) { + } + catch (Exception ex) { if (ex instanceof MojoExecutionException) { throw (MojoExecutionException) ex; } diff --git a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableJarMojo.java b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/ExecutableJarMojo.java similarity index 94% rename from spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableJarMojo.java rename to spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/ExecutableJarMojo.java index 6a72111fd9b..dc3766af1c6 100644 --- a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableJarMojo.java +++ b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/ExecutableJarMojo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.maven; +package org.springframework.maven.packaging; import java.util.Arrays; import java.util.HashSet; @@ -56,6 +56,6 @@ public class ExecutableJarMojo extends AbstractExecutableArchiveMojo { @Override protected String getLauncherClass() { - return "org.springframework.bootstrap.launcher.JarLauncher"; + return "org.springframework.launcher.JarLauncher"; } } diff --git a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableWarMojo.java b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/ExecutableWarMojo.java similarity index 96% rename from spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableWarMojo.java rename to spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/ExecutableWarMojo.java index 64bd7144092..ae60ddb9e57 100644 --- a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/ExecutableWarMojo.java +++ b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/ExecutableWarMojo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.maven; +package org.springframework.maven.packaging; import java.io.File; import java.util.Collections; @@ -85,6 +85,6 @@ public class ExecutableWarMojo extends AbstractExecutableArchiveMojo { @Override protected String getLauncherClass() { - return "org.springframework.bootstrap.launcher.WarLauncher"; + return "org.springframework.launcher.WarLauncher"; } } diff --git a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/MainClassFinder.java b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/MainClassFinder.java similarity index 97% rename from spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/MainClassFinder.java rename to spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/MainClassFinder.java index 6f9149efb6b..71d518aac83 100644 --- a/spring-bootstrap-maven-plugin/src/main/java/org/springframework/bootstrap/maven/MainClassFinder.java +++ b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/MainClassFinder.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.maven; +package org.springframework.maven.packaging; import java.io.BufferedInputStream; import java.io.File; @@ -39,7 +39,7 @@ import org.objectweb.asm.Type; * * @author Phillip Webb */ -class MainClassFinder { +abstract class MainClassFinder { private static final String DOT_CLASS = ".class"; @@ -101,10 +101,12 @@ class MainClassFinder { MainMethodFinder mainMethodFinder = new MainMethodFinder(); classReader.accept(mainMethodFinder, ClassReader.SKIP_CODE); return mainMethodFinder.isFound(); - } finally { + } + finally { inputStream.close(); } - } catch (IOException ex) { + } + catch (IOException ex) { return false; } } diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformer.java b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/PropertiesMergingResourceTransformer.java similarity index 89% rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformer.java rename to spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/PropertiesMergingResourceTransformer.java index 28fc21660be..92c2dedfcbc 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformer.java +++ b/spring-package-maven-plugin/src/main/java/org/springframework/maven/packaging/PropertiesMergingResourceTransformer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.maven; +package org.springframework.maven.packaging; import java.io.IOException; import java.io.InputStream; @@ -37,7 +37,8 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer // FIXME move out of core - String resource; // Set this in pom configuration with ... + private String resource; // Set this in pom configuration with + // ... private Properties data = new Properties(); @@ -84,4 +85,12 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer this.data.clear(); } + public String getResource() { + return this.resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + } diff --git a/spring-bootstrap-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/spring-package-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-package-maven-plugin/src/main/resources/META-INF/plexus/components.xml index 8ed12cc6f96..1658c975dc5 100644 --- a/spring-bootstrap-maven-plugin/src/main/resources/META-INF/plexus/components.xml +++ b/spring-package-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-package-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-package-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-package-maven-plugin/src/test/java/org/springframework/maven/packaging/MainClassFinderTests.java similarity index 92% rename from spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/MainClassFinderTests.java rename to spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/MainClassFinderTests.java index d83e29af72d..63a7ad8ebb1 100644 --- a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/MainClassFinderTests.java +++ b/spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/MainClassFinderTests.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.maven; + +package org.springframework.maven.packaging; import java.io.File; import java.io.FileOutputStream; @@ -25,8 +26,9 @@ import org.codehaus.plexus.util.IOUtil; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.springframework.bootstrap.maven.sample.ClassWithMainMethod; -import org.springframework.bootstrap.maven.sample.ClassWithoutMainMethod; +import org.springframework.maven.packaging.MainClassFinder; +import org.springframework.maven.packaging.sample.ClassWithMainMethod; +import org.springframework.maven.packaging.sample.ClassWithoutMainMethod; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; @@ -86,7 +88,8 @@ public class MainClassFinderTests { OutputStream outputStream = new FileOutputStream(file); try { IOUtil.copy(inputStream, outputStream); - } finally { + } + finally { outputStream.close(); } return file; diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java b/spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/PropertiesMergingResourceTransformerTests.java similarity index 78% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java rename to spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/PropertiesMergingResourceTransformerTests.java index abbdf82bb11..b39089248e7 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/maven/PropertiesMergingResourceTransformerTests.java +++ b/spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/PropertiesMergingResourceTransformerTests.java @@ -14,13 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.maven; +package org.springframework.maven.packaging; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.jar.JarOutputStream; import org.junit.Test; -import org.springframework.core.io.ByteArrayResource; +import org.springframework.maven.packaging.PropertiesMergingResourceTransformer; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -28,6 +29,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; /** + * Tests for {@link PropertiesMergingResourceTransformer}. + * * @author Dave Syer */ public class PropertiesMergingResourceTransformerTests { @@ -38,24 +41,24 @@ 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")); } @Test public void testOutput() throws Exception { - this.transformer.resource = "foo"; + this.transformer.setResource("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-package-maven-plugin/src/test/java/org/springframework/maven/packaging/Verify.java similarity index 88% rename from spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/Verify.java rename to spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/Verify.java index ca3c33a4e7b..1caa3714ba3 100644 --- a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/Verify.java +++ b/spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/Verify.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.maven; +package org.springframework.maven.packaging; import java.io.File; import java.util.Enumeration; @@ -34,15 +34,6 @@ import static org.junit.Assert.assertTrue; */ public class Verify { - public static void main(String[] args) { - try { - verifyJar(new File( - "/Users/pwebb/projects/spring/spring-bootstrap/code/spring-bootstrap-maven-plugin/target/it/executable-jar/target/executable-jar-0.0.1.BUILD-SNAPSHOT.jar")); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - public static void verifyJar(File file) throws Exception { new JarArchiveVerification(file).verify(); } @@ -111,14 +102,14 @@ public class Verify { assertHasEntryNameStartingWith(entries, "lib/spring-core"); assertHasEntryNameStartingWith(entries, "lib/javax.servlet-api-3.0.1.jar"); assertTrue("Unpacked launcher classes", entries.containsKey("org/" - + "springframework/bootstrap/launcher/JarLauncher.class")); + + "springframework/launcher/JarLauncher.class")); assertTrue("Own classes", entries.containsKey("org/" + "test/SampleApplication.class")); } @Override protected void verifyManifest(Manifest manifest) throws Exception { - assertEquals("org.springframework.bootstrap.launcher.JarLauncher", manifest + assertEquals("org.springframework.launcher.JarLauncher", manifest .getMainAttributes().getValue("Main-Class")); assertEquals("org.test.SampleApplication", manifest.getMainAttributes() .getValue("Start-Class")); @@ -140,7 +131,7 @@ public class Verify { assertHasEntryNameStartingWith(entries, "WEB-INF/lib-provided/javax.servlet-api-3.0.1.jar"); assertTrue("Unpacked launcher classes", entries.containsKey("org/" - + "springframework/bootstrap/launcher/JarLauncher.class")); + + "springframework/launcher/JarLauncher.class")); assertTrue("Own classes", entries.containsKey("WEB-INF/classes/org/" + "test/SampleApplication.class")); assertTrue("Web content", entries.containsKey("index.html")); @@ -148,7 +139,7 @@ public class Verify { @Override protected void verifyManifest(Manifest manifest) throws Exception { - assertEquals("org.springframework.bootstrap.launcher.WarLauncher", manifest + assertEquals("org.springframework.launcher.WarLauncher", manifest .getMainAttributes().getValue("Main-Class")); assertEquals("org.test.SampleApplication", manifest.getMainAttributes() .getValue("Start-Class")); diff --git a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithMainMethod.java b/spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/sample/ClassWithMainMethod.java similarity index 93% rename from spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithMainMethod.java rename to spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/sample/ClassWithMainMethod.java index 99b36216212..47957be0743 100644 --- a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithMainMethod.java +++ b/spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/sample/ClassWithMainMethod.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.maven.sample; +package org.springframework.maven.packaging.sample; /** * Sample class with a main method. diff --git a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithoutMainMethod.java b/spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/sample/ClassWithoutMainMethod.java similarity index 93% rename from spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithoutMainMethod.java rename to spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/sample/ClassWithoutMainMethod.java index 8d9166de321..58d3a2d66f0 100644 --- a/spring-bootstrap-maven-plugin/src/test/java/org/springframework/bootstrap/maven/sample/ClassWithoutMainMethod.java +++ b/spring-package-maven-plugin/src/test/java/org/springframework/maven/packaging/sample/ClassWithoutMainMethod.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.maven.sample; + +package org.springframework.maven.packaging.sample; /** * Sample class without a main method. diff --git a/spring-starters/pom.xml b/spring-starters/pom.xml new file mode 100644 index 00000000000..65984ce82f5 --- /dev/null +++ b/spring-starters/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero + 0.5.0.BUILD-SNAPSHOT + + spring-starters + pom + + ${basedir}/.. + + + spring-starter + spring-starter-actuator + spring-starter-batch + spring-starter-integration + spring-starter-data-jpa + spring-starter-security + spring-starter-web + + diff --git a/spring-bootstrap-starters/spring-bootstrap-actuator-starter/pom.xml b/spring-starters/spring-starter-actuator/pom.xml similarity index 67% rename from spring-bootstrap-starters/spring-bootstrap-actuator-starter/pom.xml rename to spring-starters/spring-starter-actuator/pom.xml index 47e350e8144..b27d2776e9c 100644 --- a/spring-bootstrap-starters/spring-bootstrap-actuator-starter/pom.xml +++ b/spring-starters/spring-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-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-actuator-starter + spring-starter-actuator jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap-starter + spring-starter ${project.version} ${project.groupId} - spring-bootstrap-actuator + spring-actuator ${project.version} diff --git a/spring-bootstrap-starters/spring-bootstrap-batch-starter/pom.xml b/spring-starters/spring-starter-batch/pom.xml similarity index 77% rename from spring-bootstrap-starters/spring-bootstrap-batch-starter/pom.xml rename to spring-starters/spring-starter-batch/pom.xml index 1c38bf119ea..dff74e224cb 100644 --- a/spring-bootstrap-starters/spring-bootstrap-batch-starter/pom.xml +++ b/spring-starters/spring-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-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-batch-starter + spring-starter-batch jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap-starter + spring-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-starters/spring-starter-data-jpa/pom.xml similarity index 74% rename from spring-bootstrap-starters/spring-bootstrap-jpa-starter/pom.xml rename to spring-starters/spring-starter-data-jpa/pom.xml index 26b1cbdba41..825132f9c7d 100644 --- a/spring-bootstrap-starters/spring-bootstrap-jpa-starter/pom.xml +++ b/spring-starters/spring-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-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-jpa-starter + spring-starter-data-jpa jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap-starter + spring-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-starters/spring-starter-integration/pom.xml similarity index 54% rename from spring-bootstrap-samples/spring-bootstrap-integration-sample/pom.xml rename to spring-starters/spring-starter-integration/pom.xml index 3ba4e36455a..46e5f9e22ab 100644 --- a/spring-bootstrap-samples/spring-bootstrap-integration-sample/pom.xml +++ b/spring-starters/spring-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-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-integration-sample + spring-starter-integration jar - org.springframework.bootstrap.sample.service.IntegrationBootstrapApplication + ${basedir}/../.. - org.springframework.bootstrap - spring-bootstrap-actuator + ${project.groupId} + spring-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-starters/spring-starter-security/pom.xml similarity index 72% rename from spring-bootstrap-starters/spring-bootstrap-security-starter/pom.xml rename to spring-starters/spring-starter-security/pom.xml index 34fb7bc0cbe..d4e1846cc9a 100644 --- a/spring-bootstrap-starters/spring-bootstrap-security-starter/pom.xml +++ b/spring-starters/spring-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-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-security-starter + spring-starter-security jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap-starter + spring-starter ${project.version} diff --git a/spring-bootstrap-samples/spring-bootstrap-tomcat-sample/pom.xml b/spring-starters/spring-starter-web/pom.xml similarity index 71% rename from spring-bootstrap-samples/spring-bootstrap-tomcat-sample/pom.xml rename to spring-starters/spring-starter-web/pom.xml index cbe9ced5bef..69291ca4006 100644 --- a/spring-bootstrap-samples/spring-bootstrap-tomcat-sample/pom.xml +++ b/spring-starters/spring-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-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-tomcat-sample - executable-jar + spring-starter-web + jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-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-starters/spring-starter/pom.xml similarity index 71% rename from spring-bootstrap-starters/spring-bootstrap-starter/pom.xml rename to spring-starters/spring-starter/pom.xml index 13d31e6a946..9ef7545c200 100644 --- a/spring-bootstrap-starters/spring-bootstrap-starter/pom.xml +++ b/spring-starters/spring-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-starters 0.5.0.BUILD-SNAPSHOT - spring-bootstrap-starter + spring-starter jar + + ${basedir}/../.. + ${project.groupId} spring-bootstrap ${project.version} + + ${project.groupId} + spring-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 - diff --git a/spring-zero-intergration-tests/pom.xml b/spring-zero-intergration-tests/pom.xml new file mode 100644 index 00000000000..1d16b84aa5b --- /dev/null +++ b/spring-zero-intergration-tests/pom.xml @@ -0,0 +1,107 @@ + + + 4.0.0 + + org.springframework.zero + spring-zero + 0.5.0.BUILD-SNAPSHOT + + spring-zero-integration-tests + pom + + ${basedir}/.. + + + + + ${project.groupId} + spring-actuator + ${project.version} + + + ${project.groupId} + spring-autoconfigure + ${project.version} + + + ${project.groupId} + spring-cli + ${project.version} + + + ${project.groupId} + spring-bootstrap + ${project.version} + + + ${project.groupId} + spring-launcher + ${project.version} + + + ${project.groupId} + spring-package-maven-plugin + ${project.version} + + + ${project.groupId} + spring-starter + ${project.version} + + + ${project.groupId} + spring-starter-actuator + ${project.version} + + + ${project.groupId} + spring-starter-batch + ${project.version} + + + ${project.groupId} + spring-starter-data-jpa + ${project.version} + + + ${project.groupId} + spring-starter-integration + ${project.version} + + + ${project.groupId} + spring-starter-security + ${project.version} + + + ${project.groupId} + spring-starter-web + ${project.version} + + + + + + + maven-invoker-plugin + + src/it/settings.xml + ${project.parent.basedir}/spring-zero-samples/ + ${project.build.directory}/local-repo + ${skipTests} + + + + integration-test + install + + install + run + + + + + + + diff --git a/spring-zero-intergration-tests/src/it/settings.xml b/spring-zero-intergration-tests/src/it/settings.xml new file mode 100644 index 00000000000..e1e0ace341b --- /dev/null +++ b/spring-zero-intergration-tests/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-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..777a14be8c9 --- /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-starter-actuator + ${project.version} + + + ${project.groupId} + spring-starter-web + ${project.version} + + + org.springframework.security + spring-security-javaconfig + + + org.springframework.security + spring-security-web + + + org.thymeleaf + thymeleaf-spring3 + + + + + + ${project.groupId} + spring-package-maven-plugin + ${project.version} + true + + + + diff --git a/spring-zero-samples/spring-zero-sample-actuator-ui/src/main/java/org/springframework/zero/sample/actuator/ui/SampleActuatorUiApplication.java b/spring-zero-samples/spring-zero-sample-actuator-ui/src/main/java/org/springframework/zero/sample/actuator/ui/SampleActuatorUiApplication.java new file mode 100644 index 00000000000..6bbf74c6b5a --- /dev/null +++ b/spring-zero-samples/spring-zero-sample-actuator-ui/src/main/java/org/springframework/zero/sample/actuator/ui/SampleActuatorUiApplication.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.sample.actuator.ui; + +import java.util.Date; +import java.util.Map; + +import org.springframework.actuate.properties.SecurityProperties; +import org.springframework.autoconfigure.EnableAutoConfiguration; +import org.springframework.bootstrap.SpringApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@EnableAutoConfiguration +@ComponentScan +@Controller +public class SampleActuatorUiApplication { + + @RequestMapping("/") + public String home(Map model) { + model.put("message", "Hello World"); + model.put("title", "Hello Home"); + model.put("date", new Date()); + return "home"; + } + + public static void main(String[] args) throws Exception { + SpringApplication.run(SampleActuatorUiApplication.class, args); + } + + @Bean + public SecurityProperties securityProperties() { + SecurityProperties security = new SecurityProperties(); + security.getBasic().setPath(""); // empty + return security; + } + +} 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/ManagementServiceBootstrapApplicationTests.java b/spring-zero-samples/spring-zero-sample-actuator-ui/src/test/java/org/springframework/zero/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java similarity index 76% 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/zero/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java index 30ce4e7b571..f99624eb673 100644 --- 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/zero/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.ui; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.actuator.ui; import java.io.IOException; import java.util.Map; @@ -25,14 +41,13 @@ import static org.junit.Assert.assertEquals; * Integration tests for separate management and main service ports. * * @author Dave Syer - * */ -public class ManagementServiceBootstrapApplicationTests { +public class SampleActuatorUiApplicationPortTests { private static ConfigurableApplicationContext context; - private static int port = 9000; - private static int managementPort = 9001; + private static int port = 9010; + private static int managementPort = 9011; @BeforeClass public static void start() throws Exception { @@ -44,7 +59,7 @@ public class ManagementServiceBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(ActuatorUiBootstrapApplication.class, args); + .run(SampleActuatorUiApplication.class, args); } }); context = future.get(10, TimeUnit.SECONDS); 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/zero/sample/actuator/ui/SampleActuatorUiApplicationTests.java similarity index 82% 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/zero/sample/actuator/ui/SampleActuatorUiApplicationTests.java index d97561a60ff..5f83df24879 100644 --- 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/zero/sample/actuator/ui/SampleActuatorUiApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.ui; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.actuator.ui; import java.io.IOException; import java.util.Arrays; @@ -30,9 +46,8 @@ import static org.junit.Assert.assertTrue; * Basic integration tests for demo application. * * @author Dave Syer - * */ -public class ActuatorUiBootstrapApplicationTests { +public class SampleActuatorUiApplicationTests { private static ConfigurableApplicationContext context; @@ -44,7 +59,7 @@ public class ActuatorUiBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(ActuatorUiBootstrapApplication.class); + .run(SampleActuatorUiApplication.class); } }); context = future.get(30, TimeUnit.SECONDS); 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 54% 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..e423ea60dad 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.zero.context.annotation.level = ALL +org.springframework.zero.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..231f565c5db 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-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-package-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/zero/sample/actuator/HelloWorldService.java similarity index 94% 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/zero/sample/actuator/HelloWorldService.java index fb4a4ac812b..0c914ab20db 100644 --- 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/zero/sample/actuator/HelloWorldService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.service; +package org.springframework.zero.sample.actuator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; 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/zero/sample/actuator/SampleActuatorApplication.java similarity index 76% 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/zero/sample/actuator/SampleActuatorApplication.java index 25dc53c3ded..19584b207c3 100644 --- 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/zero/sample/actuator/SampleActuatorApplication.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.service; +package org.springframework.zero.sample.actuator; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -26,10 +26,10 @@ import org.springframework.context.annotation.Configuration; @EnableAutoConfiguration @EnableConfigurationProperties @ComponentScan -public class ServiceBootstrapApplication { +public class SampleActuatorApplication { public static void main(String[] args) throws Exception { - SpringApplication.run(ServiceBootstrapApplication.class, args); + SpringApplication.run(SampleActuatorApplication.class, args); } } 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/zero/sample/actuator/SampleController.java similarity index 96% 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/zero/sample/actuator/SampleController.java index 66ffda0fa21..86ce0481c88 100644 --- 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/zero/sample/actuator/SampleController.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.service; +package org.springframework.zero.sample.actuator; import java.util.Collections; import java.util.Map; 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/zero/sample/actuator/ServiceProperties.java similarity index 88% 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/zero/sample/actuator/ServiceProperties.java index 3bc7bedb6b9..0c2ed16d200 100644 --- 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/zero/sample/actuator/ServiceProperties.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.service; +package org.springframework.zero.sample.actuator; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @ConfigurationProperties(name = "service", ignoreUnknownFields = false) 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 80% 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..b1899920c5b 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.zero.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/zero/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java similarity index 80% 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/zero/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java index aa87246aa60..0b0df3421e1 100644 --- 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/zero/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.test; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.actuator; import java.io.IOException; import java.util.ArrayList; @@ -12,7 +28,6 @@ import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Test; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.sample.service.ServiceBootstrapApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.HttpRequest; import org.springframework.http.HttpStatus; @@ -33,7 +48,7 @@ import static org.junit.Assert.assertEquals; * * @author Dave Syer */ -public class EndpointsPropertiesServiceBootstrapApplicationTests { +public class EndpointsPropertiesSampleActuatorApplicationTests { private ConfigurableApplicationContext context; @@ -60,7 +75,7 @@ public class EndpointsPropertiesServiceBootstrapApplicationTests { @Test public void testCustomErrorPath() throws Exception { - start(ServiceBootstrapApplication.class, "--error.path=/oops"); + start(SampleActuatorApplication.class, "--error.path=/oops"); testError(); } 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/zero/sample/actuator/ManagementAddressSampleActuatorApplicationTests.java similarity index 84% 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/zero/sample/actuator/ManagementAddressSampleActuatorApplicationTests.java index bf5f256b5e7..cedcef257a3 100644 --- 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/zero/sample/actuator/ManagementAddressSampleActuatorApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.test; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.actuator; import java.io.IOException; import java.util.ArrayList; @@ -14,7 +30,6 @@ import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.sample.service.ServiceBootstrapApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.HttpRequest; import org.springframework.http.HttpStatus; @@ -35,12 +50,12 @@ import static org.junit.Assert.assertEquals; * * @author Dave Syer */ -public class ManagementAddressServiceBootstrapApplicationTests { +public class ManagementAddressSampleActuatorApplicationTests { private static ConfigurableApplicationContext context; - private static int port = 9000; - private static int managementPort = 9001; + private static int port = 9010; + private static int managementPort = 9011; @BeforeClass public static void start() throws Exception { @@ -52,7 +67,7 @@ public class ManagementAddressServiceBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(ServiceBootstrapApplication.class, args); + .run(SampleActuatorApplication.class, args); } }); context = future.get(30, TimeUnit.SECONDS); 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/zero/sample/actuator/ManagementSampleActuatorApplicationTests.java similarity index 73% 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/zero/sample/actuator/ManagementSampleActuatorApplicationTests.java index 1ff3268e84f..9965eb5f105 100644 --- 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/zero/sample/actuator/ManagementSampleActuatorApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.test; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.actuator; import java.io.IOException; import java.util.Map; @@ -11,7 +27,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.sample.service.ServiceBootstrapApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -25,14 +40,13 @@ import static org.junit.Assert.assertEquals; * Integration tests for separate management and main service ports. * * @author Dave Syer - * */ -public class ManagementServiceBootstrapApplicationTests { +public class ManagementSampleActuatorApplicationTests { private static ConfigurableApplicationContext context; - private static int port = 9000; - private static int managementPort = 9001; + private static int port = 9010; + private static int managementPort = 9011; @BeforeClass public static void start() throws Exception { @@ -44,7 +58,7 @@ public class ManagementServiceBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(ServiceBootstrapApplication.class, args); + .run(SampleActuatorApplication.class, args); } }); context = future.get(30, TimeUnit.SECONDS); 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/zero/sample/actuator/NoManagementSampleActuatorApplicationTests.java similarity index 83% 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/zero/sample/actuator/NoManagementSampleActuatorApplicationTests.java index 81c19422050..8bf53c6d2b1 100644 --- 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/zero/sample/actuator/NoManagementSampleActuatorApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.test; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.actuator; import java.io.IOException; import java.util.ArrayList; @@ -13,7 +29,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.sample.service.ServiceBootstrapApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.HttpRequest; import org.springframework.http.HttpStatus; @@ -34,9 +49,8 @@ import static org.junit.Assert.assertEquals; * Integration tests for switching off management endpoints. * * @author Dave Syer - * */ -public class NoManagementServiceBootstrapApplicationTests { +public class NoManagementSampleActuatorApplicationTests { private static ConfigurableApplicationContext context; @@ -51,7 +65,7 @@ public class NoManagementServiceBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(ServiceBootstrapApplication.class, args); + .run(SampleActuatorApplication.class, args); } }); context = future.get(10, TimeUnit.SECONDS); 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/zero/sample/actuator/SampleActuatorApplicationTests.java similarity index 89% 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/zero/sample/actuator/SampleActuatorApplicationTests.java index 41d04809c6e..b055a7e3c84 100644 --- 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/zero/sample/actuator/SampleActuatorApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.test; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.actuator; import java.io.IOException; import java.util.ArrayList; @@ -13,7 +29,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.sample.service.ServiceBootstrapApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.HttpRequest; import org.springframework.http.HttpStatus; @@ -35,9 +50,8 @@ import static org.junit.Assert.assertTrue; * Basic integration tests for service demo application. * * @author Dave Syer - * */ -public class ServiceBootstrapApplicationTests { +public class SampleActuatorApplicationTests { private static ConfigurableApplicationContext context; @@ -49,7 +63,7 @@ public class ServiceBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(ServiceBootstrapApplication.class); + .run(SampleActuatorApplication.class); } }); context = future.get(30, TimeUnit.SECONDS); 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/zero/sample/actuator/ShutdownSampleActuatorApplicationTests.java similarity index 82% 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/zero/sample/actuator/ShutdownSampleActuatorApplicationTests.java index 4b6158e17bc..d16e6b92500 100644 --- 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/zero/sample/actuator/ShutdownSampleActuatorApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.test; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.actuator; import java.io.IOException; import java.util.ArrayList; @@ -13,7 +29,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.sample.service.ServiceBootstrapApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.HttpRequest; import org.springframework.http.HttpStatus; @@ -34,9 +49,8 @@ import static org.junit.Assert.assertTrue; * Integration tests for separate management and main service ports. * * @author Dave Syer - * */ -public class ShutdownServiceBootstrapApplicationTests { +public class ShutdownSampleActuatorApplicationTests { private static ConfigurableApplicationContext context; @@ -48,7 +62,7 @@ public class ShutdownServiceBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(ServiceBootstrapApplication.class); + .run(SampleActuatorApplication.class); } }); context = future.get(10, TimeUnit.SECONDS); 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/zero/sample/actuator/UnsecureSampleActuatorApplicationTests.java similarity index 74% 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/zero/sample/actuator/UnsecureSampleActuatorApplicationTests.java index d08a0f764a4..46eff5ffa61 100644 --- 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/zero/sample/actuator/UnsecureSampleActuatorApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.test; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.actuator; import java.io.IOException; import java.util.Map; @@ -11,7 +27,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.sample.service.ServiceBootstrapApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -27,9 +42,8 @@ import static org.junit.Assert.assertFalse; * classpath). * * @author Dave Syer - * */ -public class UnsecureServiceBootstrapApplicationTests { +public class UnsecureSampleActuatorApplicationTests { private static ConfigurableApplicationContext context; @@ -41,7 +55,7 @@ public class UnsecureServiceBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(ServiceBootstrapApplication.class, + .run(SampleActuatorApplication.class, "--security.basic.enabled=false"); } }); diff --git a/spring-zero-samples/spring-zero-sample-actuator/start.groovy b/spring-zero-samples/spring-zero-sample-actuator/start.groovy new file mode 100644 index 00000000000..59610a9bb8d --- /dev/null +++ b/spring-zero-samples/spring-zero-sample-actuator/start.groovy @@ -0,0 +1,5 @@ +@Grab("org.springframework.zero:spring-zero-actuator:0.5.0.BUILD-SNAPSHOT") +@Grab("org.springframework.zero:spring-zero-starter-web:0.5.0.BUILD-SNAPSHOT") +@ComponentScan("org.springframework.zero.sample.service") +class Start { +} 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..47aea5414f2 --- /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-starter-batch + ${project.version} + + + + + + ${project.groupId} + spring-package-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/zero/sample/batch/SampleBatchApplication.java similarity index 91% 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/zero/sample/batch/SampleBatchApplication.java index e24f32cdf4d..a6f9e1ca284 100644 --- 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/zero/sample/batch/SampleBatchApplication.java @@ -14,8 +14,9 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.batch; +package org.springframework.zero.sample.batch; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepContribution; @@ -27,7 +28,6 @@ import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.repeat.RepeatStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -36,7 +36,7 @@ import org.springframework.context.annotation.Configuration; @EnableAutoConfiguration @ComponentScan @EnableBatchProcessing -public class BatchBootstrapApplication { +public class SampleBatchApplication { @Autowired private JobBuilderFactory jobs; @@ -69,6 +69,6 @@ public class BatchBootstrapApplication { // System.exit is common for Batch applications since the exit code can be used to // drive a workflow System.exit(SpringApplication.exit(SpringApplication.run( - BatchBootstrapApplication.class, args))); + SampleBatchApplication.class, args))); } } 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/zero/sample/batch/SampleBatchApplicationTests.java similarity index 91% 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/zero/sample/batch/SampleBatchApplicationTests.java index 879eb2af0bc..873fbfbf672 100644 --- 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/zero/sample/batch/SampleBatchApplicationTests.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.bootstrap.sample.batch; + +package org.springframework.zero.sample.batch; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -26,7 +27,7 @@ import org.springframework.bootstrap.SpringApplication; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -public class BatchBootstrapApplicationTests { +public class SampleBatchApplicationTests { private PrintStream savedOutput; private ByteArrayOutputStream output; @@ -51,7 +52,7 @@ public class BatchBootstrapApplicationTests { @Test public void testDefaultSettings() throws Exception { assertEquals(0, SpringApplication.exit(SpringApplication - .run(BatchBootstrapApplication.class))); + .run(SampleBatchApplication.class))); String output = getOutput(); assertTrue("Wrong output: " + output, output.contains("completed with the following parameters")); 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..b1d97e44465 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-starter-data-jpa ${project.version} - org.springframework.batch - spring-batch-core - - - org.springframework - spring-jdbc + ${project.groupId} + spring-starter-web + ${project.version} org.hsqldb hsqldb - - - org.slf4j - slf4j-jdk14 runtime + + + + ${project.groupId} + spring-package-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/zero/sample/data/jpa/SampleDataJpaApplication.java similarity index 79% 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/zero/sample/data/jpa/SampleDataJpaApplication.java index de8159fd997..fc6ab264431 100644 --- 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/zero/sample/data/jpa/SampleDataJpaApplication.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data; +package org.springframework.zero.sample.data.jpa; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @ComponentScan @EnableAutoConfiguration -public class DataBootstrapApplication { +public class SampleDataJpaApplication { public static void main(String[] args) throws Exception { - SpringApplication.run(DataBootstrapApplication.class, args); + SpringApplication.run(SampleDataJpaApplication.class, args); } } diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/City.java similarity index 95% rename from spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java rename to spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/City.java index 1b161879388..e06bdd18aca 100644 --- a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/orm/jpa/test/City.java +++ b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/java/org/springframework/zero/sample/data/jpa/domain/City.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.autoconfigure.orm.jpa.test; +package org.springframework.zero.sample.data.jpa.domain; import java.io.Serializable; 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/zero/sample/data/jpa/domain/Hotel.java similarity index 96% 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/zero/sample/data/jpa/domain/Hotel.java index 9d0370b5e07..60fc40cff1c 100644 --- 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/zero/sample/data/jpa/domain/Hotel.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain; +package org.springframework.zero.sample.data.jpa.domain; import java.io.Serializable; import java.util.Set; 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/zero/sample/data/jpa/domain/HotelSummary.java similarity index 96% 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/zero/sample/data/jpa/domain/HotelSummary.java index 390f3e44749..03be7fd9f7e 100644 --- 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/zero/sample/data/jpa/domain/HotelSummary.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain; +package org.springframework.zero.sample.data.jpa.domain; import java.io.Serializable; import java.math.BigDecimal; 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/zero/sample/data/jpa/domain/Rating.java similarity index 92% 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/zero/sample/data/jpa/domain/Rating.java index 002786d194f..db46dff8580 100644 --- 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/zero/sample/data/jpa/domain/Rating.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain; +package org.springframework.zero.sample.data.jpa.domain; public enum Rating { TERRIBLE, POOR, AVERAGE, GOOD, EXCELLENT, 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/zero/sample/data/jpa/domain/RatingCount.java similarity index 94% 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/zero/sample/data/jpa/domain/RatingCount.java index 8a757a65aa0..5b0c928a091 100644 --- 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/zero/sample/data/jpa/domain/RatingCount.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain; +package org.springframework.zero.sample.data.jpa.domain; import java.io.Serializable; 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/zero/sample/data/jpa/domain/Review.java similarity index 98% 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/zero/sample/data/jpa/domain/Review.java index fd85f5436f0..afcb0544314 100644 --- 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/zero/sample/data/jpa/domain/Review.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain; +package org.springframework.zero.sample.data.jpa.domain; import java.io.Serializable; import java.util.Date; 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/zero/sample/data/jpa/domain/ReviewDetails.java similarity index 96% 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/zero/sample/data/jpa/domain/ReviewDetails.java index 1914cd83c2a..f51eb18660c 100644 --- 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/zero/sample/data/jpa/domain/ReviewDetails.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain; +package org.springframework.zero.sample.data.jpa.domain; import java.io.Serializable; import java.util.Date; 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/zero/sample/data/jpa/domain/TripType.java similarity index 92% 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/zero/sample/data/jpa/domain/TripType.java index e60f2cbe22c..5a7729f204f 100644 --- 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/zero/sample/data/jpa/domain/TripType.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain; +package org.springframework.zero.sample.data.jpa.domain; public enum TripType { BUSINESS, COUPLES, FAMILY, FRIENDS, SOLO 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/zero/sample/data/jpa/domain/repository/CityRepository.java similarity index 89% 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/zero/sample/data/jpa/domain/repository/CityRepository.java index f8eb726ab87..59adf3e3f9f 100644 --- 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/zero/sample/data/jpa/domain/repository/CityRepository.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain.repository; +package org.springframework.zero.sample.data.jpa.domain.repository; -import org.springframework.bootstrap.sample.data.domain.City; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.Repository; +import org.springframework.zero.sample.data.jpa.domain.City; public interface CityRepository extends Repository { 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/zero/sample/data/jpa/domain/repository/HotelRepository.java similarity index 80% 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/zero/sample/data/jpa/domain/repository/HotelRepository.java index 16d80592441..dd55b2c1632 100644 --- 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/zero/sample/data/jpa/domain/repository/HotelRepository.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain.repository; +package org.springframework.zero.sample.data.jpa.domain.repository; -import org.springframework.bootstrap.sample.data.domain.City; -import org.springframework.bootstrap.sample.data.domain.Hotel; import org.springframework.data.repository.Repository; +import org.springframework.zero.sample.data.jpa.domain.City; +import org.springframework.zero.sample.data.jpa.domain.Hotel; public interface HotelRepository extends Repository { 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/zero/sample/data/jpa/domain/repository/HotelSummaryRepository.java similarity index 91% 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/zero/sample/data/jpa/domain/repository/HotelSummaryRepository.java index c8b1a36baee..01ccb52ac92 100644 --- 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/zero/sample/data/jpa/domain/repository/HotelSummaryRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain.repository; +package org.springframework.zero.sample.data.jpa.domain.repository; import java.util.List; import java.util.Locale; @@ -23,16 +23,16 @@ import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; -import org.springframework.bootstrap.sample.data.domain.City; -import org.springframework.bootstrap.sample.data.domain.Hotel; -import org.springframework.bootstrap.sample.data.domain.HotelSummary; -import org.springframework.bootstrap.sample.data.domain.RatingCount; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Order; import org.springframework.stereotype.Repository; +import org.springframework.zero.sample.data.jpa.domain.City; +import org.springframework.zero.sample.data.jpa.domain.Hotel; +import org.springframework.zero.sample.data.jpa.domain.HotelSummary; +import org.springframework.zero.sample.data.jpa.domain.RatingCount; @Repository public class HotelSummaryRepository { 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/zero/sample/data/jpa/domain/repository/ReviewRepository.java similarity index 83% 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/zero/sample/data/jpa/domain/repository/ReviewRepository.java index 636f5568e27..1d9ed4ae422 100644 --- 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/zero/sample/data/jpa/domain/repository/ReviewRepository.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.domain.repository; +package org.springframework.zero.sample.data.jpa.domain.repository; -import org.springframework.bootstrap.sample.data.domain.Hotel; -import org.springframework.bootstrap.sample.data.domain.Review; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.Repository; +import org.springframework.zero.sample.data.jpa.domain.Hotel; +import org.springframework.zero.sample.data.jpa.domain.Review; public interface ReviewRepository extends Repository { 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/zero/sample/data/jpa/service/CitySearchCriteria.java similarity index 94% 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/zero/sample/data/jpa/service/CitySearchCriteria.java index fe4a055526d..aa959542bbc 100644 --- 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/zero/sample/data/jpa/service/CitySearchCriteria.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.service; +package org.springframework.zero.sample.data.jpa.service; import java.io.Serializable; 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/zero/sample/data/jpa/service/CityService.java similarity index 82% 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/zero/sample/data/jpa/service/CityService.java index 130a6ad431f..8ab550bba93 100644 --- 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/zero/sample/data/jpa/service/CityService.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.service; +package org.springframework.zero.sample.data.jpa.service; -import org.springframework.bootstrap.sample.data.domain.City; -import org.springframework.bootstrap.sample.data.domain.HotelSummary; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.zero.sample.data.jpa.domain.City; +import org.springframework.zero.sample.data.jpa.domain.HotelSummary; public interface CityService { 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/zero/sample/data/jpa/service/HotelService.java similarity index 75% 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/zero/sample/data/jpa/service/HotelService.java index 9759bdc4e83..a3c70a5789f 100644 --- 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/zero/sample/data/jpa/service/HotelService.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.service; +package org.springframework.zero.sample.data.jpa.service; -import org.springframework.bootstrap.sample.data.domain.City; -import org.springframework.bootstrap.sample.data.domain.Hotel; -import org.springframework.bootstrap.sample.data.domain.Review; -import org.springframework.bootstrap.sample.data.domain.ReviewDetails; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.zero.sample.data.jpa.domain.City; +import org.springframework.zero.sample.data.jpa.domain.Hotel; +import org.springframework.zero.sample.data.jpa.domain.Review; +import org.springframework.zero.sample.data.jpa.domain.ReviewDetails; public interface HotelService { 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/zero/sample/data/jpa/service/ReviewsSummary.java similarity index 85% 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/zero/sample/data/jpa/service/ReviewsSummary.java index 21d63f706bb..acd8df2ec5b 100644 --- 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/zero/sample/data/jpa/service/ReviewsSummary.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.service; +package org.springframework.zero.sample.data.jpa.service; -import org.springframework.bootstrap.sample.data.domain.Rating; +import org.springframework.zero.sample.data.jpa.domain.Rating; public interface ReviewsSummary { 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/zero/sample/data/jpa/service/impl/CityServiceImpl.java similarity index 83% 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/zero/sample/data/jpa/service/impl/CityServiceImpl.java index 90c4a628975..70280837f42 100644 --- 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/zero/sample/data/jpa/service/impl/CityServiceImpl.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.service.impl; +package org.springframework.zero.sample.data.jpa.service.impl; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.sample.data.domain.City; -import org.springframework.bootstrap.sample.data.domain.HotelSummary; -import org.springframework.bootstrap.sample.data.domain.repository.CityRepository; -import org.springframework.bootstrap.sample.data.domain.repository.HotelSummaryRepository; -import org.springframework.bootstrap.sample.data.service.CitySearchCriteria; -import org.springframework.bootstrap.sample.data.service.CityService; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import org.springframework.util.StringUtils; +import org.springframework.zero.sample.data.jpa.domain.City; +import org.springframework.zero.sample.data.jpa.domain.HotelSummary; +import org.springframework.zero.sample.data.jpa.domain.repository.CityRepository; +import org.springframework.zero.sample.data.jpa.domain.repository.HotelSummaryRepository; +import org.springframework.zero.sample.data.jpa.service.CitySearchCriteria; +import org.springframework.zero.sample.data.jpa.service.CityService; @Component("cityService") @Transactional 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/zero/sample/data/jpa/service/impl/HotelServiceImpl.java similarity index 78% 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/zero/sample/data/jpa/service/impl/HotelServiceImpl.java index 898418f9e59..f24c6fc7a11 100644 --- 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/zero/sample/data/jpa/service/impl/HotelServiceImpl.java @@ -14,29 +14,29 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.service.impl; +package org.springframework.zero.sample.data.jpa.service.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.sample.data.domain.City; -import org.springframework.bootstrap.sample.data.domain.Hotel; -import org.springframework.bootstrap.sample.data.domain.Rating; -import org.springframework.bootstrap.sample.data.domain.RatingCount; -import org.springframework.bootstrap.sample.data.domain.Review; -import org.springframework.bootstrap.sample.data.domain.ReviewDetails; -import org.springframework.bootstrap.sample.data.domain.repository.HotelRepository; -import org.springframework.bootstrap.sample.data.domain.repository.HotelSummaryRepository; -import org.springframework.bootstrap.sample.data.domain.repository.ReviewRepository; -import org.springframework.bootstrap.sample.data.service.HotelService; -import org.springframework.bootstrap.sample.data.service.ReviewsSummary; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; +import org.springframework.zero.sample.data.jpa.domain.City; +import org.springframework.zero.sample.data.jpa.domain.Hotel; +import org.springframework.zero.sample.data.jpa.domain.Rating; +import org.springframework.zero.sample.data.jpa.domain.RatingCount; +import org.springframework.zero.sample.data.jpa.domain.Review; +import org.springframework.zero.sample.data.jpa.domain.ReviewDetails; +import org.springframework.zero.sample.data.jpa.domain.repository.HotelRepository; +import org.springframework.zero.sample.data.jpa.domain.repository.HotelSummaryRepository; +import org.springframework.zero.sample.data.jpa.domain.repository.ReviewRepository; +import org.springframework.zero.sample.data.jpa.service.HotelService; +import org.springframework.zero.sample.data.jpa.service.ReviewsSummary; @Component("hotelService") @Transactional 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/zero/sample/data/jpa/web/SampleController.java similarity index 89% 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/zero/sample/data/jpa/web/SampleController.java index f8d4be19ceb..9de90d5f69f 100644 --- 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/zero/sample/data/jpa/web/SampleController.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.data.web; +package org.springframework.zero.sample.data.jpa.web; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.sample.data.service.CityService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.zero.sample.data.jpa.service.CityService; @Controller public class SampleController { diff --git a/spring-zero-samples/spring-zero-sample-data-jpa/src/main/resources/application.properties b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/resources/application.properties new file mode 100644 index 00000000000..2793254e4ef --- /dev/null +++ b/spring-zero-samples/spring-zero-sample-data-jpa/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.jpa.ddl_auto: create-drop \ No newline at end of file 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/zero/sample/data/jpa/SampleDataJpaApplicationTests.java similarity index 71% 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/zero/sample/data/jpa/SampleDataJpaApplicationTests.java index 231dac09d0f..eaac3109e81 100644 --- 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/zero/sample/data/jpa/SampleDataJpaApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.data; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.data.jpa; import java.io.IOException; import java.util.concurrent.Callable; @@ -24,7 +40,7 @@ import static org.junit.Assert.assertEquals; * * @author Dave Syer */ -public class DataBootstrapApplicationTests { +public class SampleDataJpaApplicationTests { private static ConfigurableApplicationContext context; @@ -36,7 +52,7 @@ public class DataBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(DataBootstrapApplication.class); + .run(SampleDataJpaApplication.class); } }); context = future.get(10, TimeUnit.SECONDS); 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..536c18e0b4f --- /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-starter-integration + ${project.version} + + + + + + ${project.groupId} + spring-package-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/zero/sample/integration/HelloWorldService.java similarity index 94% 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/zero/sample/integration/HelloWorldService.java index 95b0798945b..299edfa399a 100644 --- 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/zero/sample/integration/HelloWorldService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.consumer; +package org.springframework.zero.sample.integration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; 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/zero/sample/integration/SampleEndpoint.java similarity index 95% 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/zero/sample/integration/SampleEndpoint.java index 925bd763496..0e80ddbb951 100644 --- 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/zero/sample/integration/SampleEndpoint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.consumer; +package org.springframework.zero.sample.integration; import java.io.File; import java.io.FileInputStream; 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/zero/sample/integration/SampleIntegrationApplication.java similarity index 77% 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/zero/sample/integration/SampleIntegrationApplication.java index b9e0c5b3a2f..7d26d2e54d9 100644 --- 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/zero/sample/integration/SampleIntegrationApplication.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.consumer; +package org.springframework.zero.sample.integration; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties; +import org.springframework.bootstrap.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; @@ -28,10 +28,10 @@ import org.springframework.context.annotation.ImportResource; @EnableConfigurationProperties(ServiceProperties.class) @ComponentScan @ImportResource("integration-context.xml") -public class IntegrationBootstrapApplication { +public class SampleIntegrationApplication { public static void main(String[] args) throws Exception { - SpringApplication.run(IntegrationBootstrapApplication.class, args); + SpringApplication.run(SampleIntegrationApplication.class, args); } } 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/zero/sample/integration/ServiceProperties.java similarity index 88% 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/zero/sample/integration/ServiceProperties.java index 17a71ccb25d..8c9792e1cba 100644 --- 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/zero/sample/integration/ServiceProperties.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.consumer; +package org.springframework.zero.sample.integration; -import org.springframework.bootstrap.context.annotation.ConfigurationProperties; +import org.springframework.bootstrap.context.properties.ConfigurationProperties; @ConfigurationProperties(name = "service", ignoreUnknownFields = false) public class ServiceProperties { 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/zero/sample/integration/consumer/SampleIntegrationApplicationTests.java similarity index 67% 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/zero/sample/integration/consumer/SampleIntegrationApplicationTests.java index 3518866e675..02e50a5befd 100644 --- 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/zero/sample/integration/consumer/SampleIntegrationApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.consumer; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.integration.consumer; import java.util.concurrent.Callable; import java.util.concurrent.Executors; @@ -9,12 +25,13 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.sample.producer.ProducerApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.Resource; import org.springframework.core.io.support.ResourcePatternUtils; import org.springframework.util.StreamUtils; +import org.springframework.zero.sample.integration.SampleIntegrationApplication; +import org.springframework.zero.sample.integration.producer.ProducerApplication; import static org.junit.Assert.assertTrue; @@ -23,14 +40,14 @@ import static org.junit.Assert.assertTrue; * * @author Dave Syer */ -public class IntegrationBootstrapApplicationTests { +public class SampleIntegrationApplicationTests { private static ConfigurableApplicationContext context; @BeforeClass public static void start() throws Exception { context = (ConfigurableApplicationContext) SpringApplication - .run(IntegrationBootstrapApplication.class); + .run(SampleIntegrationApplication.class); } @AfterClass diff --git a/spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/zero/sample/integration/producer/ProducerApplication.java b/spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/zero/sample/integration/producer/ProducerApplication.java new file mode 100644 index 00000000000..915b13bfb07 --- /dev/null +++ b/spring-zero-samples/spring-zero-sample-integration/src/test/java/org/springframework/zero/sample/integration/producer/ProducerApplication.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.sample.integration.producer; + +import java.io.File; +import java.io.FileOutputStream; + +import org.springframework.bootstrap.CommandLineRunner; +import org.springframework.bootstrap.SpringApplication; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class ProducerApplication implements CommandLineRunner { + + @Override + public void run(String... args) throws Exception { + new File("target/input").mkdirs(); + if (args.length > 0) { + FileOutputStream stream = new FileOutputStream("target/input/data" + + System.currentTimeMillis() + ".txt"); + for (String arg : args) { + stream.write(arg.getBytes()); + } + stream.flush(); + stream.close(); + } + } + + public static void main(String[] args) throws Exception { + SpringApplication.run(ProducerApplication.class, args); + } + +} 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..9852f847919 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-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-package-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/zero/sample/jetty/SampleJettyApplication.java similarity index 79% 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/zero/sample/jetty/SampleJettyApplication.java index 33f114eac8a..b0a3dabde98 100644 --- 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/zero/sample/jetty/SampleJettyApplication.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.jetty; +package org.springframework.zero.sample.jetty; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @EnableAutoConfiguration @ComponentScan -public class JettyBootstrapApplication { +public class SampleJettyApplication { public static void main(String[] args) throws Exception { - SpringApplication.run(JettyBootstrapApplication.class, args); + SpringApplication.run(SampleJettyApplication.class, args); } } 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/zero/sample/jetty/service/HelloWorldService.java similarity index 93% 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/zero/sample/jetty/service/HelloWorldService.java index f648ed7f220..573514f811c 100644 --- 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/zero/sample/jetty/service/HelloWorldService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.jetty.service; +package org.springframework.zero.sample.jetty.service; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; 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/zero/sample/jetty/web/SampleController.java similarity index 89% 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/zero/sample/jetty/web/SampleController.java index 8d2308bcb50..8e1a2171e29 100644 --- 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/zero/sample/jetty/web/SampleController.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.jetty.web; +package org.springframework.zero.sample.jetty.web; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.sample.jetty.service.HelloWorldService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.zero.sample.jetty.service.HelloWorldService; @Controller public class SampleController { 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/zero/sample/jetty/SampleJettyApplicationTests.java similarity index 71% 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/zero/sample/jetty/SampleJettyApplicationTests.java index 878b2f454da..0fde9232e10 100644 --- 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/zero/sample/jetty/SampleJettyApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.jetty; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.jetty; import java.io.IOException; import java.util.concurrent.Callable; @@ -23,9 +39,8 @@ import static org.junit.Assert.assertEquals; * Basic integration tests for demo application. * * @author Dave Syer - * */ -public class JettyBootstrapApplicationTests { +public class SampleJettyApplicationTests { private static ConfigurableApplicationContext context; @@ -37,7 +52,7 @@ public class JettyBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(JettyBootstrapApplication.class); + .run(SampleJettyApplication.class); } }); context = future.get(10, TimeUnit.SECONDS); 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..31e5d3e6d11 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-starter ${project.version} - - org.slf4j - slf4j-jdk14 - runtime - org.yaml snakeyaml runtime + + + + ${project.groupId} + spring-package-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/zero/sample/profile/SampleProfileApplication.java similarity index 80% 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/zero/sample/profile/SampleProfileApplication.java index 03439c26409..3fd108e4482 100644 --- 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/zero/sample/profile/SampleProfileApplication.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.simple; +package org.springframework.zero.sample.profile; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.bootstrap.CommandLineRunner; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.sample.simple.service.MessageService; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import org.springframework.zero.sample.profile.service.MessageService; @Configuration @EnableAutoConfiguration @ComponentScan -public class ProfileBootstrapApplication implements CommandLineRunner { +public class SampleProfileApplication implements CommandLineRunner { // Simple example shows how a command line spring application can execute an // injected bean service. Also demonstrates how you can use @Value to inject @@ -42,6 +42,6 @@ public class ProfileBootstrapApplication implements CommandLineRunner { } public static void main(String[] args) throws Exception { - SpringApplication.run(ProfileBootstrapApplication.class, args); + SpringApplication.run(SampleProfileApplication.class, args); } } 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/zero/sample/profile/service/GoodbyeWorldService.java similarity index 94% 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/zero/sample/profile/service/GoodbyeWorldService.java index 11189115b88..6d7be8d3107 100644 --- 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/zero/sample/profile/service/GoodbyeWorldService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.simple.service; +package org.springframework.zero.sample.profile.service; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; 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/zero/sample/profile/service/HelloWorldService.java similarity index 94% 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/zero/sample/profile/service/HelloWorldService.java index e9a39feebcf..dd388f535f7 100644 --- 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/zero/sample/profile/service/HelloWorldService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.simple.service; +package org.springframework.zero.sample.profile.service; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; 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/zero/sample/profile/service/MessageService.java similarity index 92% 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/zero/sample/profile/service/MessageService.java index bce760282be..f3758cb1802 100644 --- 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/zero/sample/profile/service/MessageService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.simple.service; +package org.springframework.zero.sample.profile.service; /** * @author Dave Syer 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/zero/sample/profile/SampleProfileApplicationTests.java similarity index 65% 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/zero/sample/profile/SampleProfileApplicationTests.java index f9bb21fdc20..03eb7460582 100644 --- 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/zero/sample/profile/SampleProfileApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.simple; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.profile; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -11,7 +27,7 @@ import org.junit.Test; import static org.junit.Assert.assertTrue; -public class ProfileBootstrapApplicationTests { +public class SampleProfileApplicationTests { private static PrintStream savedOutput; private static ByteArrayOutputStream output; @@ -33,7 +49,8 @@ public class ProfileBootstrapApplicationTests { public void after() { if (this.profiles != null) { System.setProperty("spring.profiles.active", this.profiles); - } else { + } + else { System.clearProperty("spring.profiles.active"); } } @@ -49,7 +66,7 @@ public class ProfileBootstrapApplicationTests { @Test public void testDefaultProfile() throws Exception { - ProfileBootstrapApplication.main(new String[0]); + SampleProfileApplication.main(new String[0]); String output = getOutput(); assertTrue("Wrong output: " + output, output.contains("Hello Phil")); } @@ -57,14 +74,14 @@ public class ProfileBootstrapApplicationTests { @Test public void testGoodbyeProfile() throws Exception { System.setProperty("spring.profiles.active", "goodbye"); - ProfileBootstrapApplication.main(new String[0]); + SampleProfileApplication.main(new String[0]); String output = getOutput(); assertTrue("Wrong output: " + output, output.contains("Goodbye Everyone")); } @Test public void testGoodbyeProfileFromCommandline() throws Exception { - ProfileBootstrapApplication + SampleProfileApplication .main(new String[] { "--spring.profiles.active=goodbye" }); String output = getOutput(); assertTrue("Wrong output: " + output, output.contains("Goodbye Everyone")); diff --git a/spring-bootstrap-samples/spring-bootstrap-xml-sample/pom.xml b/spring-zero-samples/spring-zero-sample-simple/pom.xml similarity index 51% rename from spring-bootstrap-samples/spring-bootstrap-xml-sample/pom.xml rename to spring-zero-samples/spring-zero-sample-simple/pom.xml index 8bf8a520f7b..ae892af52ba 100644 --- a/spring-bootstrap-samples/spring-bootstrap-xml-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-xml-sample + spring-zero-sample-simple executable-jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-starter ${project.version} - - org.slf4j - slf4j-jdk14 - runtime - + + + + ${project.groupId} + spring-package-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/zero/sample/simple/SampleSimpleApplication.java similarity index 80% 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/zero/sample/simple/SampleSimpleApplication.java index 98496190c15..f9f60dea65a 100644 --- 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/zero/sample/simple/SampleSimpleApplication.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.simple; +package org.springframework.zero.sample.simple; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.bootstrap.CommandLineRunner; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; -import org.springframework.bootstrap.sample.simple.service.HelloWorldService; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import org.springframework.zero.sample.simple.service.HelloWorldService; @Configuration @EnableAutoConfiguration @ComponentScan -public class SimpleBootstrapApplication implements CommandLineRunner { +public class SampleSimpleApplication implements CommandLineRunner { // Simple example shows how a command line spring application can execute an // injected bean service. Also demonstrates how you can use @Value to inject @@ -42,6 +42,6 @@ public class SimpleBootstrapApplication implements CommandLineRunner { } public static void main(String[] args) throws Exception { - SpringApplication.run(SimpleBootstrapApplication.class, args); + SpringApplication.run(SampleSimpleApplication.class, args); } } 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-simple/src/main/java/org/springframework/zero/sample/simple/service/HelloWorldService.java similarity index 93% 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-simple/src/main/java/org/springframework/zero/sample/simple/service/HelloWorldService.java index 9416a4032a4..60266ba21da 100644 --- 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-simple/src/main/java/org/springframework/zero/sample/simple/service/HelloWorldService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.xml.service; +package org.springframework.zero.sample.simple.service; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; 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/zero/sample/simple/SampleSimpleApplicationTests.java similarity index 54% 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/zero/sample/simple/SampleSimpleApplicationTests.java index 4a3905edf34..f9459132b80 100644 --- 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/zero/sample/simple/SampleSimpleApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.simple; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.simple; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -9,10 +25,18 @@ import org.junit.Test; import static org.junit.Assert.assertTrue; -public class SimpleBootstrapApplicationTests { +/** + * Tests for {@link SampleSimpleApplication}. + * + * @author Dave Syer + * @author Phillip Webb + */ +public class SampleSimpleApplicationTests { private PrintStream savedOutput; + private ByteArrayOutputStream output; + private String profiles; @Before @@ -27,7 +51,8 @@ public class SimpleBootstrapApplicationTests { public void after() { if (this.profiles != null) { System.setProperty("spring.profiles.active", this.profiles); - } else { + } + else { System.clearProperty("spring.profiles.active"); } System.setOut(this.savedOutput); @@ -39,14 +64,14 @@ public class SimpleBootstrapApplicationTests { @Test public void testDefaultSettings() throws Exception { - SimpleBootstrapApplication.main(new String[0]); + SampleSimpleApplication.main(new String[0]); String output = getOutput(); assertTrue("Wrong output: " + output, output.contains("Hello Phil")); } @Test public void testCommandLineOverrides() throws Exception { - SimpleBootstrapApplication.main(new String[] { "--name=Gordon" }); + SampleSimpleApplication.main(new String[] { "--name=Gordon" }); String output = getOutput(); assertTrue("Wrong output: " + output, output.contains("Hello Gordon")); } 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..7af98507b50 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-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-package-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-tomcat/src/main/java/org/springframework/zero/sample/tomcat/SampleTomcatApplication.java similarity index 79% 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-tomcat/src/main/java/org/springframework/zero/sample/tomcat/SampleTomcatApplication.java index 6facbc86c37..e66d71400ef 100644 --- 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-tomcat/src/main/java/org/springframework/zero/sample/tomcat/SampleTomcatApplication.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.trad; +package org.springframework.zero.sample.tomcat; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @EnableAutoConfiguration @ComponentScan -public class TradBootstrapApplication { +public class SampleTomcatApplication { public static void main(String[] args) throws Exception { - SpringApplication.run(TradBootstrapApplication.class, args); + SpringApplication.run(SampleTomcatApplication.class, args); } } 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-tomcat/src/main/java/org/springframework/zero/sample/tomcat/service/HelloWorldService.java similarity index 93% 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-tomcat/src/main/java/org/springframework/zero/sample/tomcat/service/HelloWorldService.java index 6f7134c7197..33c9f4e0430 100644 --- 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-tomcat/src/main/java/org/springframework/zero/sample/tomcat/service/HelloWorldService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.simple.service; +package org.springframework.zero.sample.tomcat.service; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; 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/zero/sample/tomcat/web/SampleController.java similarity index 88% 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/zero/sample/tomcat/web/SampleController.java index d6c871fb445..7a74c8443a8 100644 --- 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/zero/sample/tomcat/web/SampleController.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.tomcat.web; +package org.springframework.zero.sample.tomcat.web; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.sample.tomcat.service.HelloWorldService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.zero.sample.tomcat.service.HelloWorldService; @Controller public class SampleController { 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/zero/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java similarity index 61% 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/zero/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java index cc01bb3ad56..75b940f53ac 100644 --- 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/zero/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.tomcat; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.tomcat; import java.io.IOException; import java.util.concurrent.Callable; @@ -9,12 +25,10 @@ import java.util.concurrent.TimeUnit; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.springframework.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.autoconfigure.web.WebMvcAutoConfiguration; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; -import org.springframework.bootstrap.autoconfigure.web.WebMvcAutoConfiguration; -import org.springframework.bootstrap.sample.tomcat.service.HelloWorldService; -import org.springframework.bootstrap.sample.tomcat.web.SampleController; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -24,6 +38,8 @@ import org.springframework.http.ResponseEntity; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.DefaultResponseErrorHandler; import org.springframework.web.client.RestTemplate; +import org.springframework.zero.sample.tomcat.service.HelloWorldService; +import org.springframework.zero.sample.tomcat.web.SampleController; import static org.junit.Assert.assertEquals; @@ -31,20 +47,19 @@ import static org.junit.Assert.assertEquals; * Basic integration tests for demo application. * * @author Dave Syer - * */ -public class NonAutoConfigurationBootstrapApplicationTests { +public class NonAutoConfigurationSampleTomcatApplicationTests { 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 { + public static class NonAutoConfigurationSampleTomcatApplication { public static void main(String[] args) throws Exception { - SpringApplication.run(TomcatBootstrapApplication.class, args); + SpringApplication.run(SampleTomcatApplication.class, args); } } @@ -57,7 +72,7 @@ public class NonAutoConfigurationBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(NonAutoConfigurationBootstrapApplication.class); + .run(NonAutoConfigurationSampleTomcatApplication.class); } }); context = future.get(10, TimeUnit.SECONDS); 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/zero/sample/tomcat/SampleTomcatApplicationTests.java similarity index 71% 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/zero/sample/tomcat/SampleTomcatApplicationTests.java index f57b61800e4..3f318fe78ec 100644 --- 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/zero/sample/tomcat/SampleTomcatApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.tomcat; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.tomcat; import java.io.IOException; import java.util.concurrent.Callable; @@ -23,9 +39,8 @@ import static org.junit.Assert.assertEquals; * Basic integration tests for demo application. * * @author Dave Syer - * */ -public class TomcatBootstrapApplicationTests { +public class SampleTomcatApplicationTests { private static ConfigurableApplicationContext context; @@ -37,7 +52,7 @@ public class TomcatBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(TomcatBootstrapApplication.class); + .run(SampleTomcatApplication.class); } }); context = future.get(10, TimeUnit.SECONDS); 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..d964433de46 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-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-package-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-traditional/src/main/java/org/springframework/zero/sample/traditional/SampleTraditionalApplication.java similarity index 79% 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-traditional/src/main/java/org/springframework/zero/sample/traditional/SampleTraditionalApplication.java index 0cec9ced8bd..80f18d28580 100644 --- 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-traditional/src/main/java/org/springframework/zero/sample/traditional/SampleTraditionalApplication.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.tomcat; +package org.springframework.zero.sample.traditional; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @EnableAutoConfiguration @ComponentScan -public class TomcatBootstrapApplication { +public class SampleTraditionalApplication { public static void main(String[] args) throws Exception { - SpringApplication.run(TomcatBootstrapApplication.class, args); + SpringApplication.run(SampleTraditionalApplication.class, args); } } 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/zero/sample/traditional/config/WebConfig.java similarity index 97% 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/zero/sample/traditional/config/WebConfig.java index 0d34d22b6ac..b3a36006789 100644 --- 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/zero/sample/traditional/config/WebConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.trad.config; +package org.springframework.zero.sample.traditional.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; 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/zero/sample/traditional/SampleTraditionalApplicationTests.java similarity index 76% 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/zero/sample/traditional/SampleTraditionalApplicationTests.java index 11c19959321..165ce412f17 100644 --- 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/zero/sample/traditional/SampleTraditionalApplicationTests.java @@ -1,4 +1,20 @@ -package org.springframework.bootstrap.sample.trad; +/* + * Copyright 2012-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.sample.traditional; import java.io.IOException; import java.util.concurrent.Callable; @@ -25,7 +41,7 @@ import static org.junit.Assert.assertTrue; * * @author Dave Syer */ -public class TradBootstrapApplicationTests { +public class SampleTraditionalApplicationTests { private static ConfigurableApplicationContext context; @@ -37,7 +53,7 @@ public class TradBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(TradBootstrapApplication.class); + .run(SampleTraditionalApplication.class); } }); context = future.get(30, TimeUnit.SECONDS); 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..16f71b89ca5 --- /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-starter-web + ${project.version} + + + org.thymeleaf + thymeleaf-spring3 + + + nz.net.ultraq.web.thymeleaf + thymeleaf-layout-dialect + + + + + + ${project.groupId} + spring-package-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/zero/sample/web/ui/InMemoryMessageRespository.java similarity index 96% 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/zero/sample/web/ui/InMemoryMessageRespository.java index d8f19e686dd..9a82f027cc5 100644 --- 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/zero/sample/web/ui/InMemoryMessageRespository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.ui; +package org.springframework.zero.sample.web.ui; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; 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/zero/sample/web/ui/Message.java similarity index 96% 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/zero/sample/web/ui/Message.java index 2a9f3632316..c013381b5ef 100644 --- 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/zero/sample/web/ui/Message.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. */ -package org.springframework.bootstrap.sample.ui; +package org.springframework.zero.sample.web.ui; import java.util.Calendar; 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/zero/sample/web/ui/MessageRepository.java similarity index 94% 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/zero/sample/web/ui/MessageRepository.java index de917bdc4f5..057149a859f 100644 --- 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/zero/sample/web/ui/MessageRepository.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. */ -package org.springframework.bootstrap.sample.ui; +package org.springframework.zero.sample.web.ui; /** * @author Rob Winch 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/zero/sample/web/ui/SampleWebUiApplication.java similarity index 85% 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/zero/sample/web/ui/SampleWebUiApplication.java index d1b1cb78f41..987d109cd55 100644 --- 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/zero/sample/web/ui/SampleWebUiApplication.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.ui; +package org.springframework.zero.sample.web.ui; +import org.springframework.autoconfigure.EnableAutoConfiguration; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -26,7 +26,7 @@ import org.springframework.core.convert.converter.Converter; @Configuration @EnableAutoConfiguration @ComponentScan -public class UiBootstrapApplication { +public class SampleWebUiApplication { @Bean public MessageRepository messageRepository() { @@ -44,7 +44,7 @@ public class UiBootstrapApplication { } public static void main(String[] args) throws Exception { - SpringApplication.run(UiBootstrapApplication.class, args); + SpringApplication.run(SampleWebUiApplication.class, args); } } 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/zero/sample/web/ui/mvc/MessageController.java similarity index 93% 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/zero/sample/web/ui/mvc/MessageController.java index e9f0570703b..c9203d23736 100644 --- 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/zero/sample/web/ui/mvc/MessageController.java @@ -11,13 +11,11 @@ * specific language governing permissions and limitations under the License. */ -package org.springframework.bootstrap.sample.ui.mvc; +package org.springframework.zero.sample.web.ui.mvc; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.bootstrap.sample.ui.Message; -import org.springframework.bootstrap.sample.ui.MessageRepository; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; @@ -26,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import org.springframework.zero.sample.web.ui.Message; +import org.springframework.zero.sample.web.ui.MessageRepository; /** * @author Rob Winch 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/zero/sample/web/ui/SampleWebUiApplicationTests.java similarity index 95% 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/zero/sample/web/ui/SampleWebUiApplicationTests.java index 1b0a2a34c0a..5bc3fbc01b7 100644 --- 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/zero/sample/web/ui/SampleWebUiApplicationTests.java @@ -1,4 +1,4 @@ -package org.springframework.bootstrap.sample.ui; +package org.springframework.zero.sample.web.ui; import java.io.IOException; import java.net.URI; @@ -28,9 +28,8 @@ import static org.junit.Assert.assertTrue; * Basic integration tests for demo application. * * @author Dave Syer - * */ -public class UiBootstrapApplicationTests { +public class SampleWebUiApplicationTests { private static ConfigurableApplicationContext context; @@ -42,7 +41,7 @@ public class UiBootstrapApplicationTests { @Override public ConfigurableApplicationContext call() throws Exception { return (ConfigurableApplicationContext) SpringApplication - .run(UiBootstrapApplication.class); + .run(SampleWebUiApplication.class); } }); context = future.get(30, TimeUnit.SECONDS); 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 70% 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..95c0d6b589d 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.zero.context.annotation.level = ALL diff --git a/spring-bootstrap-samples/spring-bootstrap-simple-sample/pom.xml b/spring-zero-samples/spring-zero-sample-xml/pom.xml similarity index 51% rename from spring-bootstrap-samples/spring-bootstrap-simple-sample/pom.xml rename to spring-zero-samples/spring-zero-sample-xml/pom.xml index b9c5b9ece22..4d335a23f6f 100644 --- a/spring-bootstrap-samples/spring-bootstrap-simple-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-simple-sample + spring-zero-sample-xml executable-jar + + ${basedir}/../.. + ${project.groupId} - spring-bootstrap + spring-starter ${project.version} - - org.slf4j - slf4j-jdk14 - runtime - + + + + ${project.groupId} + spring-package-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/zero/sample/xml/SampleSpringXmlApplication.java similarity index 80% 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/zero/sample/xml/SampleSpringXmlApplication.java index 6349f11952a..d503e9ad644 100644 --- 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/zero/sample/xml/SampleSpringXmlApplication.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.xml; +package org.springframework.zero.sample.xml; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.bootstrap.CommandLineRunner; import org.springframework.bootstrap.SpringApplication; -import org.springframework.bootstrap.sample.xml.service.HelloWorldService; +import org.springframework.zero.sample.xml.service.HelloWorldService; -public class XmlBootstrapApplication implements CommandLineRunner { +public class SampleSpringXmlApplication implements CommandLineRunner { @Autowired private HelloWorldService helloWorldService; @@ -32,7 +32,7 @@ public class XmlBootstrapApplication implements CommandLineRunner { } public static void main(String[] args) throws Exception { - // TODO: to make this a pure XML example, will need + // TODO: to make this a pure XML example, will need SpringApplication.run("classpath:/META-INF/application-context.xml", args); } } 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-xml/src/main/java/org/springframework/zero/sample/xml/service/HelloWorldService.java similarity index 93% 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-xml/src/main/java/org/springframework/zero/sample/xml/service/HelloWorldService.java index cfad0ac5966..96bae7d73fe 100644 --- 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-xml/src/main/java/org/springframework/zero/sample/xml/service/HelloWorldService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.bootstrap.sample.tomcat.service; +package org.springframework.zero.sample.xml.service; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; 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 72% 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 index 60af614af7d..369e0795244 100644 --- 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 @@ -8,7 +8,7 @@ - - + + diff --git a/spring-zero-samples/spring-zero-sample-xml/src/test/java/org/springframework/zero/sample/xml/SampleSpringXmlApplicationTests.java b/spring-zero-samples/spring-zero-sample-xml/src/test/java/org/springframework/zero/sample/xml/SampleSpringXmlApplicationTests.java new file mode 100644 index 00000000000..1e5f33ce998 --- /dev/null +++ b/spring-zero-samples/spring-zero-sample-xml/src/test/java/org/springframework/zero/sample/xml/SampleSpringXmlApplicationTests.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.sample.xml; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +public class SampleSpringXmlApplicationTests { + + private static PrintStream savedOutput; + private static ByteArrayOutputStream output; + + @BeforeClass + public static void init() { + savedOutput = System.out; + output = new ByteArrayOutputStream(); + System.setOut(new PrintStream(output)); + } + + @AfterClass + public static void clear() { + System.setOut(savedOutput); + } + + private static String getOutput() { + return output.toString(); + } + + @Test + public void testDefaultSettings() throws Exception { + SampleSpringXmlApplication.main(new String[0]); + String output = getOutput(); + assertTrue("Wrong output: " + output, output.contains("Hello World")); + } + +} diff --git a/spring-zero.java.hsp b/spring-zero.java.hsp new file mode 100644 index 00000000000..08f9d8e5d60 --- /dev/null +++ b/spring-zero.java.hsp @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Top-level breakout (depth=2) + + + +