This Week in Spring - March 22nd, 2016

Engineering | Josh Long | March 22, 2016 | ...

Welcome to another installation of This Week in Spring! As usual, we've got a lot to cover so let's get to it! This week I'm supposed to be in Paris and Belgium. Unfortunately, because of the recent, tragic, disgusting and cowardly attacks on the Brussels airport and metro, I am not entirely sure about whether I'll be in Belgium physically. Tonight's meetup talk, however, will carry on remotely, via streaming. Stay tuned to my Twitter handle - @starbuxman for more.

That said, there's a lot of great content so let's get to it!

The Spring Boot Dashboard in STS - Part 4: Working with Cloud Foundry manifest files

Engineering | Martin Lippert | March 22, 2016 | ...

Welcome back Spring community,

the latest release 3.7.3 of the Spring Tool Suite introduces a number of new features around the Spring Boot Dashboard. Therefore we continue the blog post series that started last year and introduced you to the new way of working with Spring Boot based microservice projects in your IDE (you can find links to the previous parts at the bottom).

Cloud Foundry manifest files

In this new part of the series we take a closer look at Cloud Foundry manifest files. They are a Cloud Foundry concept used as a shortcut to define configurations for applications on Cloud Foundry. Instead of passing every argument and configuration to the command line when doing a “cf push”, you can put all your configuration data into a YAML file and pass that to the push command instead. More detailed information about Cloud Foundry Manifest files can be found here.

The early versions of the Spring Boot Dashboard already used the manifest files for deploying an app to CF if a file called “manifest.yml” existed in the project. This was done “under the hood” for your convenience. That was nice and useful. But it also caused confusion due to the “hidden nature” of this support.

Choose a manifest file when deploying an app

The new version of the Spring Boot Dashboard supports Cloud Foundry manifest files as a first-class citizen. This starts to show up when you deploy an application from within the Boot Dashboard to a Cloud Foundry target for the first time. A dialog comes up and asks you which manifest file should be used for this deployment operation.

This dialog allows you to select the manifest file you would like to use to deploy the app. This also allows you to have multiple manifest files in your projects - for example for different spaces on Cloud Foundry or different deployment environments. You can also deploy the same app multiple times to the same Cloud Foundry target by choosing a different manifest file for each deploy operation.

The dialog shows the content of the selected manifest file, so that you can verify that you selected the correct one. And if something is wrong inside of the manifest file, you don’t need to go back to the main IDE workbench, open the file, edit it, save it, and go back to the deploy operation. Instead edit the manifest file content directly within the dialog. This makes deploying an app to Cloud Foundry really easy.

The boot dashboard will remember your choice and use the same manifest file again if you update your project on Cloud Foundry. That also means that changes to the manifest file will be taken into account the next time the app is re-deployed to Cloud Foundry (during a boot dashboard restart operation, for example).

Of course you can change your mind and decide to choose a different manifest file. An action in the context menu allows you to open the same “choose the manifest file” dialog and make a different choice. The next redeploy of the app will take that change into account. You can also use this dialog to quickly check which manifest file is currently associated with the project.

Deploying without a manifest file

Sometimes you don’t already have a manifest file or you don’t want to use an existing manifest file. In that case you can choose the “manual mode” in the dialog.

It opens up an editor area for a temporary manifest file and fills that with some default content. You can edit this temporary manifest content, add properties or change existing ones. This allows you to completely define the way the app should be deployed to Cloud Foundry.

The content of that temporary manifest is not stored anywhere (we may add a convenience option to quickly save the manually entered manifest content to a new file) and the IDE doesn’t remember it for the next time you update the application on Cloud Foundry. Instead the existing configuration on Cloud Foundry will be kept and used while updating the application.

This is also true if you have used a manifest file in the past and then decided to switch to the manual mode. Subsequent updates to the application will keep the configuration on Cloud Foundry untouched.

Changed configurations on CF

Let’s imagine you have used a manifest file to deploy your application from within the boot dashboard to Cloud Foundry. Then you go to the web console and add a service to the already deployed app - or change the memory settings, scale it up, or do similar changes to the configuration. If you go back to the boot dashboard, maybe change some code of the app, and restart (and therefore update) the app on Cloud Foundry, the boot dashboard would use the manifest file again - and trash all the changes to the configuration that you made on CF. To avoid this, the boot dashboard checks for configuration changes on Cloud Foundry when re-deploying an application that uses a manifest file. If a configuration mismatch is found, it opens up a diff and merge dialog - and displays the detailed changes.

This feature prevents you from override configuration changes by accident. And it is a powerful dialog that lets you merge configuration changes on CF to your local manifest file. You can merge individual changes as well as all changes at once. That makes it easy to update the local manifest file with those changes and you can continue to use the manifest file when updating the application in the future.

In case you don’t want those configuration changes on CF to be reflected in your local manifest file, select the “forget manifest” button and the boot dashboard will keep the configuration on Cloud Foundry as it is. It switches the application to the “manual mode” deployment.

Again, if you would like to explicitly change those settings, go to the context menu and choose the “select manifest” operation.

Editing manifest files

While the Cloud Foundry manifest files are a nice and clean way to configure your application for Cloud Foundry, it can be cumbersome to edit those files. Luckily the new version of the Spring Tool Suite comes with a specialized editor for Cloud Foundry manifest files.

It provides nice content-assist for property names and selected property values.

If you hover over the properties, you get additional help about the property and examples how and when to use it.

The file is also validated while typing. Reconcile errors are showing up directly in the editor in the same way they do in Spring Boot property files or when editing Java code.

And the good news is: this advanced editing support is available in the “select the manifest file” dialog, too (for example when working on the manual manifest or changing the selected manifest file content):

Coming up

The next part of this blog series will cover the new support for working with multiple launch configurations for local Spring Boot applications. Stay tuned.

The Spring Boot Dashboard blog series:

If you happen to be in Barcelona mid May (never a bad time to be in Barcelona anyway!), don't miss the chance to join the Spring I/O conference where I'll be presenting on the latest and greatest in Spring in general. Also, the registration for SpringOne Platform (early August, Las Vegas) has opened recently, in case you want to benefit from early bird ticket pricing.

A Geospatial Messenger with Kotlin, Spring Boot and PostgreSQL

Engineering | Sébastien Deleuze | March 20, 2016 | ...

Following my first Kotlin blog post, today I want introduce the new Spring Boot + Kotlin application I have developed for my upcoming Spring I/O 2016 conference talk "Developing Geospatial Web Services with Kotlin and Spring Boot".

Dealing with native database functionalities

One of the goal of this application is to see how to take advantage of native database functionalities like we do in NoSQL world. Here we want to use Geospatial support provided by PostGIS, the spatial database extender for PostgreSQL. Native JSON support could also be a good use case.

This Geospatial Messenger sample application is available on GitHub

This Week in Spring - March 15th, 2016

Engineering | Josh Long | March 15, 2016 | ...

Welcome to another installment of This Week in Spring! What a crazy week it's been since we last talked! I spent a day in San Francisco, Germany, Scotland, and Romania between Monday and Friday last. It's nice this week to be in (warm!) southern California in Los Angeles and San Diego speaking to customers and at a couple of meetups! If you're around, I hope you'll join me for the Cloud Native Meetup here in Los Angeles (tonight!).

Spring for Apache Kafka Milestone 1 Available

Engineering | Gary Russell | March 14, 2016 | ...

I am pleased to announce that the spring-kafka (Spring for Apache Kafka) first milestone is now available (1.0.0.M1).

The existing spring-integration-kafka extension project - currently at version 1.3.0.RELEASE supports Kafka 0.8.x.x and is used in Spring XD (Kafka MessageBus) and Spring Cloud Stream (Kafka Binder).

This new project (spring-kafka) breaks out the core components into a separate project. It is based on the new 0.9.0.x pure Java Kafka clients.

spring-kafka brings the familiar Spring programming model to Apache Kafka for any Spring user, not just those using Spring Integration. An upcoming spring-integration-kafka release will be a complete rewrite, utilizing the spring-kafka

This Week in Spring - March 8th, 2016

Engineering | Josh Long | March 08, 2016 | ...

Welcome to another installment of This Week in Spring! This week I'm in Bruhl, Germany for the amazing JavaLand show, then it's off to Scotland to visit a large customer, and then it's off to Romania for Voxxed Days Bucharest. If you're in any of those places, I'd love to connect!

Core container refinements in Spring Framework 4.3

Engineering | Stéphane Nicoll | March 04, 2016 | ...

Spring Framework 4.3.RC1 is around the corner and brings nice core container refinements which we are going to explore in this post...

Implicit constructor injection for single-constructor scenarios

Consider the following service class:

@Service
public class FooService {

    private final FooRepository repository;

    @Autowired
    public FooService(FooRepository repository) {
        this.repository = repository
    }
}

Quite a common use case but if you forget the @Autowired annotation on the constructor, the container will throw an exception looking for a default constructor, unless you explicitly indicate autowire mode 'constructor' in your bean definition setup (e.g. in an XML <bean>

This Week in Spring - March 1, 2016

Engineering | Josh Long | March 01, 2016 | ...

Welcome to another installment of This Week in Spring! This week, I'm in Shenzhen, China and Zurich, Switzerland for Voxxed Days Zurich. It's going to be a busy week indeed though I sure hope to see you there! Anyway, we've got a lot to cover this week so let's get to it!

This Week in Spring - February 23, 2016

Engineering | Josh Long | February 23, 2016 | ...

Welcome to another installment of This Week in Spring! We're already staring down the last weeks of February!

This Week in Spring - February 16th, 2016

Engineering | Josh Long | February 16, 2016 | ...

Welcome to another installment of This Week in Spring! It's been a busy week for all of us on the Spring team, as you're about to see! I've just finished my presentation at the epic DevNexus show and now I'm off to visit customers in Hartford and Los Angeles before making my way to the epic ConFoo conference in Montreal, Canada. If you're in the area, be sure to ping me and say hi!

We've got a lot to cover, so let's get to it!

Get the Spring newsletter

Stay connected with the Spring newsletter

Subscribe

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all