The objective for NixMash Spring v0.4.0 was to upgrade Spring Boot from Release 1.3.5 to 1.4. When you upgrade the framework upon which your application is built, and especially if your app has a lot of moving parts, you know there’s going to be some pain. But there ARE rewards.
This is my story…
There are always going to be functions that have been deprecated in a new release. Here is what we were looking at on an initial Project Build with Spring Boot 1.4. Not bad at all.
Those were usually resolved by using the updated class listed in the excellent @Deprecated Javadoc info like in this SpringBootServletInitializer example.
Here’s another example of swapping out classes.
Velocity goes ByeBye
I was sorry to learn that Velocity support was going away. Moving to Freemarker shouldn’t be a big deal, but as an Apache Velocity fan it was not something I had planned to do. Here’s a link to the Spring SPR announcing discontinued Velocity support.
One of the big draws to Spring Boot 1.4 was several new testing features. Here is an example where @SpringBootTest replaces @SpringApplicationConfiguration and @WebAppConfiguration.
JSON Constant now JSON_UTF8
This falls under the category of “Details, details…”
Unregistering DBCP2 Beans
I spent more time on Unregistering DBCP2 DataSource XMBeans than I wanted to. I was hitting
InstanceNotFoundException:on closing Application Context in a Launcher class with ctx.close(). Here’s a GitHub Issue on it.
I added @Bean(destroyMethod = “close”) on my dataSource Beans, but the ultimate solution was to add a spring.jmx.enabled=false property to the JPA project’s application.properties file.
Hibernate 5? Fugetaboutit!
There’s a good bit of discussion out there on Hibernate 5 with Spring like GitHub Spring Boot Issue #2763.
This was the most unpleasant aspect of upgrading to Spring Boot 1.4. The exceptions being thrown in DEBUG log outputs offered no clue as to possible solutions. After probably too many hours finding my Spring Boot 1.4 and Hibernate 5 Happy Place I cut my loses to wait for the solution which I knew would come over time. I went back to Hibernate 4.3.11 with the following addition to my root build.gradle file.
ext['hibernate.version'] = '4.3.11.Final'
I had a similar experience trying to use Solr 5 with Spring Boot 1.3. Standalone Solr worked great but Embedded Solr threw exceptions on creating Application Context. Going back to Solr 4.10.4 saved the day. Now with Spring Boot 1.4, Solr 5.5.2 is standard and works across the board.
NixMash Spring is an executable WAR. I thought we were home free until I tested running the site in its WAR format and encountered WebJar File Not Found Exceptions.
I’ve had a number of build issues with WebJars over time, but they’re still worth the occasional problems. In this case all that was required was updating the Locator libraries
Other than being rewarded with the sweet display of Spring Boot 1.4.0 dependencies we saw at the top, we can view the Spring Boot and Framework releases on the NixMash Spring Home Page.
Bonus Spring Version Display Block!
From the GeneralController class method mapped to root, here is how we’re displaying the Spring Versions on the Home Page.