From ef4f83e7b12e7f7b51578ad30dbe2468c4c2e64a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 24 Jan 2017 20:25:54 +0000 Subject: [PATCH] Update reference guide to reflect Java 8 requirement Closes gh-8090 --- .../src/main/asciidoc/deployment.adoc | 25 +++++--------- .../src/main/asciidoc/getting-started.adoc | 32 +++++++---------- spring-boot-docs/src/main/asciidoc/howto.adoc | 34 ------------------- .../asciidoc/production-ready-features.adoc | 19 ----------- .../src/main/asciidoc/using-spring-boot.adoc | 21 ++---------- 5 files changed, 24 insertions(+), 107 deletions(-) diff --git a/spring-boot-docs/src/main/asciidoc/deployment.adoc b/spring-boot-docs/src/main/asciidoc/deployment.adoc index 6a4820eafe7..2884a5cd293 100644 --- a/spring-boot-docs/src/main/asciidoc/deployment.adoc +++ b/spring-boot-docs/src/main/asciidoc/deployment.adoc @@ -72,15 +72,18 @@ At this point `cf` will start uploading your application: Uploading acloudyspringtime... *OK* Preparing to start acloudyspringtime... *OK* -----> Downloaded app package (*8.9M*) - -----> Java Buildpack source: system - -----> Downloading Open JDK 1.7.0_51 from .../x86_64/openjdk-1.7.0_51.tar.gz (*1.8s*) - Expanding Open JDK to .java-buildpack/open_jdk (*1.2s*) - -----> Downloading Spring Auto Reconfiguration from 0.8.7 .../auto-reconfiguration-0.8.7.jar (*0.1s*) - -----> Uploading droplet (*44M*) + -----> Java Buildpack Version: v3.12 (offline) | https://github.com/cloudfoundry/java-buildpack.git#6f25b7e + -----> Downloading Open Jdk JRE 1.8.0_121 from https://java-buildpack.cloudfoundry.org/openjdk/trusty/x86_64/openjdk-1.8.0_121.tar.gz (found in cache) + Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.6s) + -----> Downloading Open JDK Like Memory Calculator 2.0.2_RELEASE from https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-2.0.2_RELEASE.tar.gz (found in cache) + Memory Settings: -Xss349K -Xmx681574K -XX:MaxMetaspaceSize=104857K -Xms681574K -XX:MetaspaceSize=104857K + -----> Downloading Container Certificate Trust Store 1.0.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-certificate-trust-store/container-certificate-trust-store-1.0.0_RELEASE.jar (found in cache) + Adding certificates to .java-buildpack/container_certificate_trust_store/truststore.jks (0.6s) + -----> Downloading Spring Auto Reconfiguration 1.10.0_RELEASE from https://java-buildpack.cloudfoundry.org/auto-reconfiguration/auto-reconfiguration-1.10.0_RELEASE.jar (found in cache) Checking status of app 'acloudyspringtime'... 0 of 1 instances running (1 starting) ... - 0 of 1 instances running (1 down) + 0 of 1 instances running (1 starting) ... 0 of 1 instances running (1 starting) ... @@ -171,16 +174,6 @@ Spring Boot makes `-D` arguments available as properties accessible from a Sprin Tomcat, Jetty or Undertow instance which then uses it when it starts up. The `$PORT` environment variable is assigned to us by the Heroku PaaS. -Heroku by default will use Java 1.8. This is fine as long as your Maven or Gradle build -is set to use the same version (Maven users can use the java.version property). If you -want to use JDK 1.7, create a new file adjacent to your `pom.xml` and `Procfile`, -called `system.properties`. In this file add the following: - -[indent=0] ----- - java.runtime.version=1.7 ----- - This should be everything you need. The most common workflow for Heroku deployments is to `git push` the code to production. diff --git a/spring-boot-docs/src/main/asciidoc/getting-started.adoc b/spring-boot-docs/src/main/asciidoc/getting-started.adoc index 7104f05c372..e69b1a1475f 100644 --- a/spring-boot-docs/src/main/asciidoc/getting-started.adoc +++ b/spring-boot-docs/src/main/asciidoc/getting-started.adoc @@ -36,31 +36,26 @@ diverge from the defaults. [[getting-started-system-requirements]] == System Requirements -By default, Spring Boot {spring-boot-version} requires http://www.java.com[Java 7] and -Spring Framework {spring-version} or above. You can use Spring Boot with Java 6 with some -additional configuration. See <> for more details. Explicit -build support is provided for Maven (3.2+), and Gradle 2 (2.9 or later) and 3. +Spring Boot {spring-boot-version} requires http://www.java.com[Java 8] and Spring +Framework {spring-version} or above. Explicit build support is provided for Maven +(3.2+), and Gradle 2 (2.9 or later) and 3. -TIP: Although you can use Spring Boot with Java 6 or 7, we generally recommend Java 8 if -at all possible. +[[getting-started-system-requirements-servlet-containers]] === Servlet containers The following embedded servlet containers are supported out of the box: |=== -|Name |Servlet Version |Java Version +|Name |Servlet Version | |Tomcat 8.5 |3.1 -|Java 7+ |Jetty 9.4 |3.1 -|Java 8+ |Undertow 1.3 |3.1 -|Java 7+ |=== You can also deploy Spring Boot applications to any Servlet 3.0+ compatible container. @@ -70,7 +65,7 @@ You can also deploy Spring Boot applications to any Servlet 3.0+ compatible cont [[getting-started-installing-spring-boot]] == Installing Spring Boot Spring Boot can be used with "`classic`" Java development tools or installed as a command -line tool. Regardless, you will need http://www.java.com[Java SDK v1.6] or higher. You +line tool. Regardless, you will need http://www.java.com[Java SDK v1.8] or higher. You should check your current Java installation before you begin: [indent=0] @@ -82,9 +77,6 @@ If you are new to Java development, or if you just want to experiment with Sprin you might want to try the <> first, otherwise, read on for "`classic`" installation instructions. -TIP: Although Spring Boot is compatible with Java 1.6, if possible, you should consider -using the latest version of Java. - [[getting-started-installation-instructions-for-java]] @@ -460,17 +452,17 @@ installed. [indent=0] ---- $ java -version - java version "1.7.0_51" - Java(TM) SE Runtime Environment (build 1.7.0_51-b13) - Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) + java version "1.8.0_102" + Java(TM) SE Runtime Environment (build 1.8.0_102-b14) + Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode) ---- [indent=0] ---- $ mvn -v - Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T13:58:10-07:00) - Maven home: /Users/user/tools/apache-maven-3.1.1 - Java version: 1.7.0_51, vendor: Oracle Corporation + Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00) + Maven home: /usr/local/Cellar/maven/3.3.9/libexec + Java version: 1.8.0_102, vendor: Oracle Corporation ---- NOTE: This sample needs to be created in its own folder. Subsequent instructions assume diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index aca580ecfee..08bcbe47f3b 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -2824,40 +2824,6 @@ after which you can run the application with -[[howto-use-java-6]] -=== How to use Java 6 -If you want to use Spring Boot with Java 6 there are a small number of configuration -changes that you will have to make. The exact changes depend on your application's -functionality. - - - -[[howto-use-java-6-embedded-container]] -==== Embedded servlet container compatibility -If you are using one of Boot's embedded Servlet containers you will have to use a -Java 6-compatible container. Both Tomcat 7 and Jetty 8 are Java 6 compatible. See -<> and <> for details. - - - -[[howto-use-java-6-jackson]] -==== Jackson -Jackson 2.7 and later requires Java 7. If you want to use Jackson with Java 6 you -will have to downgrade to Jackson 2.6. - - - -[[how-to-use-java-6-jta-api]] -==== JTA API compatibility -While the Java Transaction API itself doesn't require Java 7 the official API jar -contains classes that have been built to require Java 7. If you are using JTA then -you will need to replace the official JTA 1.2 API jar with one that has been built -to work on Java 6. To do so, exclude any transitive dependencies on -`javax.transaction:javax.transaction-api` and replace them with a dependency on -`org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final` - - - [[howto-traditional-deployment]] == Traditional deployment diff --git a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index bca98e94334..21d1b405f8a 100644 --- a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -1045,25 +1045,6 @@ beans are gathered by the endpoint. You can easily change that by defining your -[[production-ready-metric-repositories]] -=== Special features with Java 8 -The default implementation of `GaugeService` and `CounterService` provided by Spring Boot -depends on the version of Java that you are using. With Java 8 (or better) the -implementation switches to a high-performance version optimized for fast writes, backed by -atomic in-memory buffers, rather than by the immutable but relatively expensive -`Metric` type (counters are approximately 5 times faster and gauges approximately twice -as fast as the repository-based implementations). The Dropwizard metrics services (see -below) are also very efficient even for Java 7 (they have backports of some of the Java 8 -concurrency libraries), but they do not record timestamps for metric values. If -performance of metric gathering is a concern then it is always advisable to use one of the -high-performance options, and also to only read metrics infrequently, so that the writes -are buffered locally and only read when needed. - -NOTE: The old `MetricRepository` and its `InMemoryMetricRepository` implementation are not -used by default if you are on Java 8 or if you are using Dropwizard metrics. - - - [[production-ready-metric-writers]] === Metric writers, exporters and aggregation Spring Boot provides a couple of implementations of a marker interface called `Exporter` diff --git a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc index 3c110b49eca..8360e74e37b 100644 --- a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc +++ b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc @@ -54,7 +54,7 @@ Framework so we **highly** recommend you to not specify its version on your own. Maven users can inherit from the `spring-boot-starter-parent` project to obtain sensible defaults. The parent project provides the following features: -* Java 1.6 as the default compiler level. +* Java 1.8 as the default compiler level. * UTF-8 source encoding. * A <>, allowing you to omit `` tags for common dependencies, inherited from the @@ -168,21 +168,6 @@ that way. -[[using-boot-maven-java-version]] -==== Changing the Java version -The `spring-boot-starter-parent` chooses fairly conservative Java compatibility. If you -want to follow our recommendation and use a later Java version you can add a -`java.version` property: - -[source,xml,indent=0,subs="verbatim,quotes,attributes"] ----- - - 1.8 - ----- - - - [[using-boot-maven-plugin]] ==== Using the Spring Boot Maven plugin Spring Boot includes a <> @@ -693,7 +678,7 @@ You might also want to use the useful operating system environment variable: [indent=0,subs="attributes"] ---- - $ export MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=128M + $ export MAVEN_OPTS=-Xmx1024m ---- @@ -713,7 +698,7 @@ You might also want to use this useful operating system environment variable: [indent=0,subs="attributes"] ---- - $ export JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=128M + $ export JAVA_OPTS=-Xmx1024m ----