Spring Boot 1.4.0 M1 Release Notes

Stéphane Nicoll edited this page May 18, 2016 · 15 revisions
Clone this wiki locally

Spring Boot 1.4.0 M1 Release Notes

Upgrading from Spring Boot 1.3

Executable jar layout

The layout of executable jars has changed. If you are using Spring Boot’s Maven, Gradle, or Ant support to build your application this change will not affect you. If you are building an executable archive yourself, please be aware that an application’s dependencies are now packaged in BOOT-INF/lib rather than lib, and an application’s own classes are now packaged in BOOT-INF/classes rather than the root of the jar.

When deploying an application to Cloud Foundry, you may need to specify the buildpack using -b:

$ cf push -b https://github.com/cloudfoundry/java-buildpack.git …

Deprecations from Spring Boot 1.3

Classes, methods and properties that were deprecated in Spring Boot 1.3 have been removed in this release. Please ensure that you aren’t calling deprecated methods before upgrading.

In particular, log4j 1 support has been removed following Apache EOL announcement

DataSource binding

Prior to Spring Boot 1.4, auto-configured datasources were bound to the spring.datasource namespace. In 1.4, we only bind the common settings to spring.datasource (see DataSourceProperties) and we have defined new specific namespaces for the four connections pools we support (in that order):

  • spring.datasource.tomcat for org.apache.tomcat.jdbc.pool.DataSource

  • spring.datasource.hikari for com.zaxxer.hikari.HikariDataSource

  • spring.datasource.dbcp for org.apache.commons.dbcp.BasicDataSource

  • spring.datasource.dbcp2 for org.apache.commons.dbcp2.BasicDataSource

If you were using specific settings of the connection pool implementation that you are using, you will have to move that configuration to the relevant namespace. For instance, if you were using Tomcat’s testOnBorrow flag, you’ll have to move it from spring.datasource.test-on-borrow to spring.datasource.tomcat.test-on-borrow.

If you are using configuration assistance in your IDE, you can now see which settings are available per connection pools rather than having all of them mixed in the spring.datasource namespace. This should make your life much easier figuring out what implementation supports what features.

JTA settings binding

Similarly to DataSource binding, JTA provider-specific configuration properties for Atomikos and Bitronix were bound to spring.jta. They are now bound to spring.jta.atomikos.properties and spring.jta.bitronix.properties respectively; the meta-data for these entries has been greatly improved as well.

@ConfigurationProperties default bean names

When a @ConfigurationProperties bean is registered via @EnableConfigurationProperties(SomeBean.class), we used to generate a bean name of the form <prefix>.CONFIGURATION_PROPERTIES. As of Spring Boot 1.4, we have changed that pattern to avoid name clashes if two beans use the same prefix.

The new conventional name is <prefix>-<fqn>, where <prefix> is the environment key prefix specified in the @ConfigurationProperties annotation and <fqn> the fully qualified name of the bean. If the annotation does not provide any prefix, only the fully qualified name of the bean is used.

Jetty JNDI support

The spring-boot-starter-jetty "Starter" no longer includes org.eclipse.jetty:jetty-jndi. If you are using Jetty with JNDI you will now need to directly add this dependency yourself.

spring-boot.version

The spring-boot.version property has been removed from the spring-boot-dependencies pom. See issue 5104 for details.

New and Noteworthy

Tip
Check the configuration changelog for a complete overview of the changes in configuration.

Analysis of startup failures

Spring Boot will now perform analysis of common startup failures and provide useful diagnostic information rather than simply logging an exception and its stack trace. For example, a startup failure due to the embedded servlet container’s port being in use looked like this in earlier versions of Spring Boot:

2016-02-16 17:46:14.334 ERROR 24753 --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.RuntimeException: java.net.BindException: Address already in use
    at io.undertow.Undertow.start(Undertow.java:181) ~[undertow-core-1.3.14.Final.jar:1.3.14.Final]
    at org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainer.start(UndertowEmbeddedServletContainer.java:121) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at sample.undertow.SampleUndertowApplication.main(SampleUndertowApplication.java:26) [classes/:na]
Caused by: java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_60]
    at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_60]
    at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_60]
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_60]
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_60]
    at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:190) ~[xnio-nio-3.3.4.Final.jar:3.3.4.Final]
    at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:243) ~[xnio-api-3.3.4.Final.jar:3.3.4.Final]
    at io.undertow.Undertow.start(Undertow.java:137) ~[undertow-core-1.3.14.Final.jar:1.3.14.Final]
    ... 11 common frames omitted

In 1.4, it will look like this:

2016-02-16 17:44:49.179 ERROR 24745 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Embedded servlet container failed to start. Port 8080 was already in use.

Action:

Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.

If you still want to see the stacktrace of the underlying cause, enable debug logging for org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter.

Test utilities

spring-boot-starter-test now brings the Assert4J assertions library.

Test utilities from the org.springframework.boot.test package have been moved to a spring-boot-test dedicated artifact.