IntelliJ IDEA 2021.3 EAP 6: Enhanced HTTP Client, Kotlin Support for CDI, and More
A new EAP build of IntelliJ IDEA 2021.3 is here! Take a look at the new features and improvements it brings, such as an enhanced HTTP client, support for the Qute template language, Kotlin support for CDI, and much more.
Please note that all the features that we will highlight in this blog post are available in IntelliJ IDEA Ultimate only.
HTTP client enhancements
In this release cycle we have significantly improved the IntelliJ IDEA HTTP client. We added support for gRPC requests, output redirection to a custom file or directory, support for text and JSON streams, support for HTTP request identifiers, and support for binary responses. Let’s take a more detailed look at these new features.
gRPC requests in the HTTP client
Starting with v2021.3, IntelliJ IDEA’s HTTP client supports gRPC requests. Simply start your requests with the GRPC keyword to have the HTTP client treat them as gRPC requests. The HTTP client now provides completion for gRPC: all known gRPC services, unary and server-streaming methods of a particular server, and, most importantly, fields of accepted messages in the request body.
Currently the supported RPC types that can be executed in the HTTP client are unary and server-streaming. Like in ordinary HTTP requests, the request body and responses are plain JSON files.
One more useful feature in this area is that in the upcoming IntelliJ IDEA 2021.3 you can automatically generate a gRPC request in the HTTP client by simply clicking on the gutter icons in your .proto files.
Support for text streams and JSON streams in the HTTP Client
It is now easier to test streaming applications in your favorite IDE because the upcoming v2021.3 supports the following content types: text/event-stream, application/stream+json, and application/x-ndjson. This means the HTTP client will no longer wait for a stream to end and will instead display the output on the fly.
The HTTP client will also listen for the end of a stream and will show a message when the process is finished.
Binary responses in the HTTP client
In the upcoming IntelliJ IDEA 2021.3, the HTTP client shows an image preview in the response console if a response is an image.
The HTTP client does not show a preview for a response if it isn’t clear whether it is a text response.
Output redirection to custom file or directory
The HTTP client can now redirect output to a custom file or directory. It supports two operators for force and soft redirects:
- The >> operator always creates a new file, adding an -n suffix to a file name if the requested file name already exists.
- The >>! operator rewrites the file if it already exists.
Support for HTTP request identifiers
The upcoming IntelliJ IDEA 2021.3 now understands identifiers (or names) for requests. The IDE understands identifiers both that were declared as a comment with @name and that were declared as text in the first separator (###).
You can invoke a request by its identifier from the Services tool window or from the Run Configuration, Run Anything, or Search Everywhere dialogs.
Qute template language support
IntelliJ IDEA 2021.3 is adding Qute to the list of supported template languages. The IDE will provide code highlighting, autocompletion, inspections, context actions, and additional useful features to help you develop templates while working on your Quarkus project.
References resolve and completion from secondary specification files
Even if your OpenAPI specifications are located in several files and linked via $ref, IntelliJ IDEA will understand that those files reference each other and it will provide completion based on this understanding.
New Blocking and Non-Blocking annotations for reactive code
We recently updated JetBrains collection of annotations that are available as a separate project by adding two new annotations: @Blocking and @NonBlocking.
Add ‘org.jetbrains:annotations:22.0.0’ to your project dependencies and annotate your classes and methods as @Blocking or @NonBlocking to help the IDE detect blocking calls in non-blocking contexts, such as Kotlin coroutines or reactive code with Project Reactor, RxJava, and SmallRye Mutiny.
What’s more, the IDE automatically supports the corresponding annotations from Micronaut and SmallRye Mutiny.
Improved blocking code detection in Spring and Java EE
The IDE now detects more cases of blocking code in Spring and Java EE. The upcoming IntelliJ IDEA 2021.3 considers the following Spring and Java EE APIs as blocking: Spring Data’s JpaRepository and CrudRepository, RestTemplate and JdbcTemplate, Spring Feign interface methods, and any methods and classes annotated as @Transactional when the methods return a non-reactive result type.
The same applies to JPA EntityManager calls: they are considered as blocking and will be highlighted when called in non-blocking contexts.
Revamped Spring Boot Run Configurations dialog
We recently updated the Run Configuration dialog for Java projects, and with this upcoming release the Spring Boot Run Configurations dialog is being updated. It looks neater, and the most frequently used settings are now gathered on one screen.
If you need to configure any advanced parameters, click Modify Options.
Improved support for Spring Boot application files
The IDE now provides code completion in additional configuration files (properties or .yaml files) when a spring.config.import key is used to link them.
Also, the IDE is better at handling complex and custom Spring Boot configuration file setups.
References to application.yaml
For Spring Boot projects, the IDE now provides references with completion and find usages to application.yaml from @Value, @Scheduled, and Environment.getProperty().
Better support for @NamedQuery used from Spring Data repositories
In your Spring Data JPA projects, queries that are declared as @NamedQuery will now be available in query method completion.
You can now also navigate to the @NamedQuery definition via the gutter icon.
Kotlin support for Java EE CDI
Starting with IntelliJ IDEA 2021.3, all CDI inspections that previously worked only for Java files will work for Kotlin files as well.
Additionally, CDI gutter icons are now available in Kotlin files. You can go to injection points or injection candidates, bean makers, disposer methods, and events.
Improved UML class diagrams
We’ve significantly improved the user experience for UML class diagrams for Java and Kotlin. First of all, we improved the performance of UML class diagrams so that diagram building, category switching, zoom, and the undo/redo functionality will happen much faster.
Other notable changes include a new fancy grid, member highlighting, and a quick doc preview pop-up.
You can control the appearance of the diagram via context menu | Appearance. For example, you can disable the grid.