BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News IntelliJ IDEA 2017.3: Enhanced Support for Java EE 8, Spring Boot, and JUnit

IntelliJ IDEA 2017.3: Enhanced Support for Java EE 8, Spring Boot, and JUnit

This item in japanese

JetBrains recently released version 2017.3 of their flagship product, IntelliJ IDEA, with a host of new features including enhanced support for Java, Java EE 8, Spring Boot, Kotlin, and Docker. This latest version comes just three months after the release of version 2017.2. Before this release, JetBrains provided a public review of this latest version to solicit feedback and bug reports from the community. We highlight some of these enhancements here.

Java EE 8

A few key features of Java EE 8 have been expanded to support for CDI 2.0 and HTTP/2 for Servlet 4.0.

Enhancements for CDI 2.0 include:

  • Asynchronous events - allows navigation between fired and received CDI asynchronous events
  • Dynamic beans - a CDI extension that allows navigation between an injection point and injected bean
  • Supports new built-in interfaces, RequestContextController and InterceptionFactory
  • Supports implicit (no beans.xml required) and explicit bean archives

A demonstration of CDI 2.0 asynchronous events is shown below.

The Java Servlet 4.0 specification (JSR 369) introduced a server push feature that includes a new interface, PushBuilder. As demonstrated below, this latest release of IntelliJ IDEA offers path completion for PushBuilder.

Configurable Command Line Shortener

When a project's classpath reaches the operating system's command line limit, the configurable command line shortener offers methods for shortening the classpath. Zlata Kalyuzhnaya, marketing manager at JetBrains, described the challenges of implementing this feature:

There are several approaches to shorten the classpath. Initially, IntelliJ IDEA tried to write the long classpath into the text file (which means an intermediate classloader to the application). But unfortunately, this didn't work for some frameworks, e.g. JMock. Then, IntelliJ IDEA tried to use a more or less standard way, which was to pack the long classpath into the classpath.jar. Unfortunately, that didn't work either, for some other frameworks.

And, sadly, there is no way to predict which kind of shortening would work for the user application. So the user is left having to make this decision. For Application, JUnit and TestNG configurations, 2017.3 provides a way to configure the shortener.

Spring Boot/Spring MVC

Additional support for Spring Boot and Spring MVC includes syntax highlighting for Spring Boot configuration files, Spring Boot 2.0 actuator endpoints, the Spring Cloud framework and automatic detection of an MVC context. As demonstrated below, it is now easier to navigate among related files in a Spring MVC application.

For Spring Boot 2.0 applications, the Run Dashboard provides pertinent actuator endpoint information while the application is running.

JUnit 5

While IntelliJ IDEA offered JUnit 5 support before the official release of JUnit 5, this latest release offers even more features including an option to migrate unit tests to JUnit 5. For example, consider the following JUnit 4 unit test:

    
import org.junit.Assert;
import org.junit.Test;

public class FirstTest {

    @Test
    public void myFirstTest() {
        Assert.assertEquals("one plus one should equal two", 2, 1 + 1);
        }
    }
    

Selecting the "Migrate to JUnit 5" from the inspection menu will transform the unit test to JUnit 5:

    
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class FirstTest {

    @Test
    public void myFirstTest() {
        Assertions.assertEquals(2, 1 + 1, "one plus one should equal two");
        }
    }
    

Resources

IntelliJ iDEA 2017.2: Smarter, Neater, and Faster by InfoQ (August 27, 2017)

IntelliJ IDEA 2017.3 EAP: Configurable Command Line Shortener and More by Zlata Kalyuzhnaya (October 11, 2017)

What's New in IntelliJ IDEA 2017.3 EAP for Java EE 8 by Zlata Kalyuzhnaya (October 17, 2017)

What's New in IntelliJ IDEA 2017.3 for Spring Boot by Zlata Kalyuzhnaya (November 3, 2017)

IntelliJ IDEA 2017.3: JUnit Support by Zlata Kalyuzhnaya (November 15, 2017)

Rate this Article

Adoption
Style

BT