This Week in Spring - September 8, 2015

Engineering | Josh Long | September 08, 2015 | ...

Welcome to another installation of This Week in Spring! This week I left Tokyo, Japan, and have been in Shanghai, China, speaking to a few large-scale startups - including Ele.me, the largest food delivery service and application in a very crowded Chinese market with more than 2 million orders every day - about building cloud-native applications using Spring Boot, Spring Cloud and Cloud Foundry! Tomorrow, it's off to Oslo, Norway, for the amazing JavaZone conference. I love this conference and have, in the last two years, been unable to attend because it was concurrent with SpringOne2GX…

Spring REST Docs 1.0.0.RC1

Engineering | Andy Wilkinson | September 08, 2015 | ...

I'm delighted to announce that Spring REST Docs 1.0.0.RC1 has been released and is available from our milestone repository.

If you'd like to see some examples of what can be produced with Spring REST Docs, please take a look at the sample documentation.

What's new

Getting…

What's New In Spring Data Release Gosling?

Engineering | Christoph Strobl | September 04, 2015 | ...

Over 300 issues fixed across 12 projects makes it pretty hard to keep track on what has happened since the last release. So here's a more detailed excerpt of some of the new features we've been cooking during the last iteration.

Ad-hoc JPA fetch graphs.

Since the Dijkstra release train we have been able to refer to the named entity graph declared on the entity through the @EntityGraph annotation in JPA-backed repositories. In the example below this forces firstname and lastname to be loaded eagerly, while all others remain lazily loaded.

@Entity
@NamedEntityGraphs(
  @NamedEntityGraph(name…

Spring Boot 1.3.0.M5 Available Now

Releases | Phil Webb | September 04, 2015 | ...

Spring Boot v1.3.0.M5 is available now from the Spring milestone repository. Just in time for SpringOne 2GX, this release closes almost 50 issues and merges 15 pull-requests! Thanks again to everyone that has contributed.

Highlights of the new release include:

  • Lots of bug fixes and stabilization as we head towards RC1
  • Support for javax @WebServlet, @WebFilter and @WebListener annotations
  • Auto-configuration for Hazelcast
  • Improved "root first" exception logging

For a complete list of changes, and upgrade instructions, see the Spring Boot 1.3 Release Notes on the wiki and the updated reference documentation

React.js and Spring Data REST: Part 1 - Basic Features

Engineering | Greg L. Turnquist | September 01, 2015 | ...
To see updates to this code, visit our React.js and Spring Data REST tutorial.

Welcome Spring community,

This is the first of several blog entries. In this session, you will see how to get a bare-bones Spring Data REST application up and running quickly. Then you will build a simple UI on top of it using Facebook’s React.js toolset.

Step 0 - Setting up your environment

Feel free to grab the code from this repository and follow along.

If you want to do it yourself, visit http://start.spring.io and pick these items:

  • Rest Repositories
  • Thymeleaf
  • JPA
  • H2

This demo uses Java 8, Maven Project, and the latest stable release of Spring Boot. This will give you a clean, empty project. From there, you can add the various files shown explicitly in this session, and/or borrow from the repository listed above.

In the beginning…​

In the beginning there was data. And it was good. But then people wanted to access the data through various means. Over the years, people cobbled together lots of MVC controllers, many using Spring’s powerful REST support. But doing over and over cost a lot of time.

Spring Data REST addresses how simple this problem can be if some assumptions are made:

  • The developer uses a Spring Data project that supports the repository model.
  • The system uses well accepted, industry standard protocols, like HTTP verbs, standardized media types, and IANA-approved link names.

Declaring your domain

The cornerstone of any Spring Data REST-based application are the domain objects. For this session, you will build an application to track the employees for a company. Kick that off by creating a data type like this:

src/main/java/com/greglturnquist/payroll/Employee.java
@Data
@Entity
public class Employee {
private @Id @GeneratedValue Long id;
private String firstName;
private String lastName;
private String description;

private Employee() {}

public Employee(String firstName, String lastName, String description) {
	this.firstName = firstName;
	this.lastName = lastName;
	this.description = description;
}

}

  • @Entity is a JPA annotation that denotes the whole class for storage in a relational table.
  • @Id and @GeneratedValue are JPA annotation to note the primary key and that is generated automatically when needed.
  • @Data and @RequiredArgsConstructor are Project Lombok annotations to autogenerate getters, setters, constructors, toString, hash, equals, and other things. It cuts down on the boilerplate.

This entity is used to track employee information. In this case, their name and job description.

Note
Spring Data REST isn’t confined to JPA. It supports many NoSQL data stores, but you won’t be covering those here.

Defining the repository

Another key piece of a Spring Data REST application is to create a corresponding repository definition.

src/main/java/com/greglturnquist/payroll/EmployeeRepository.java
public interface EmployeeRepository extends CrudRepository<Employee, Long> {

}

  • The repository extends Spring Data Commons' CrudRepository and plugs in the type of the domain object and its primary key

That is all that is needed! In fact, you don’t even have to annotate this invisible if its top-level and visible. If you use your IDE and open up CrudRepository, you’ll find a fist full of pre-built methods already defined.

Note
You can define your own repository if you wish. Spring Data REST supports that as well.

Pre-loading the demo

To work this this application, you need to pre-load it with some data like this:

src/main/java/com/greglturnquist/payroll/DatabaseLoader.java
@Component
public class DatabaseLoader implements CommandLineRunner {
private final EmployeeRepository repository;

@Autowired
public DatabaseLoader(EmployeeRepository repository) {
	this.repository = repository;
}

@Override
public void run(String... strings) throws Exception {
	this.repository.save(new Employee("Frodo", "Baggins…

Spring Statemachine 1.0.0.RC1 Released

Releases | Janne Valkealahti | September 01, 2015 | ...

We’re pleased to announce a first release candicate of Spring Statemachine 1.0.0.RC1.

Focus of this release is to get core framework more stable and finally add jepsen tests for a distributed state machine. We also added a first version of a testing support. Resolved github tickets can be found from RC1 issues. We're relatively close to issue a release version, meaning if nothing major pop-up, next release will be a 1.0.0.RELEASE. If something urgent turns up we will do 1.0.0.RC2 prior to a release.

Now that we're here, let's crack it and see what new features we have in this release.

Beyond…

Spring Data Release Train Gosling Goes GA

Releases | Oliver Drotbohm | September 01, 2015 | ...

On behalf of the Spring Data team I'd like to announce the general availability of the Spring Data release train Gosling. Over the last 6 months we've fixed 344 tickets in total, 56 of that after the latest release candidate.

  • Upgraded Spring baseline to 4.1.
  • Easier implementability of custom repository code (per repo, see the reference documentation) .
  • Improved compatibility with Hibernate 5 (JPA module).
  • SpEl support for @Query methods in MongoDB (see this example).
  • Support to create Querydsl Predicates from web requests (see the reference documentation).
  • A new Spring Data KeyValue module for Map-backed repositories using SpEL as query language.
  • Improved POST forms for the HAL browser in Spring Data REST.
  • Support for internationalization of enum values and link titles in Spring Data REST.

This Week in Spring - September 1, 2015

Engineering | Josh Long | September 01, 2015 | ...

Welcome to another installment of This Week in Spring! The Spring team is hard at work on all the latest and greatest ahead of the SpringOne2GX event in Washington DC! Time is really flying! I can't beleive what we're staring down September already! This week I'm in Tokyo, Japan, participating in the Spring User Group's huge Spring in Summer event where I gave a keynote and two talks, on Spring Boot and Spring Cloud. The one day event attracted some of the company's largest websites and was a lot of fun!

Anyway, without further ado, let's get to it!

Spring Framework 4.2.1 Available Now

Releases | Stéphane Nicoll | September 01, 2015 | ...

It is my pleasure to announce that Spring Framework 4.2.1 is available from repo.spring.io and Maven Central. This first maintenance release in the 4.2 line contains a wide range of fixes for regressions and other issues reported against 4.2 GA.

4.2.1 also contains minor enhancements: refinement of our Jackson support (see Sébastien's updated blog post), meta-annotation processing improvements (@AliasFor), third-party dependencies alignment (including Hibernate 5.0 GA).

We strongly recommend an immediate upgrade to 4.2.1 for all 4.x users. The Spring Framework team is now working towards…

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