Microsoft Updates Java in VS Code with Spring Functionality, Debugging

Java developers using Microsoft's Visual Studio Code (VS Code) source-code editor will find new features for the Spring Framework, as well as improvements for build tools and debugging, in the latest update.

In the August 2022 update, the Redmond dev team aimed to provide a better "getting-started" experience for Spring Initializr, which provides an extensible API to generate JVM-based projects, and to inspect the metadata used to generate projects—for example, to list the available dependencies and versions.

"When a developer uses Spring Initializr to create a new project, it generates a, which provides useful information to help developer get started," explained Nick Zhu Senior Program Manager in Microsoft's Developer Division, in a blog post. "However, previously many developers would not realize this file was there or it was simply ignored. It would be helpful if this file can be automatically opened in Visual Studio Code.

This feature was added, Zhu said, so that Spring developers can have a smoother getting started experience.

To use the new features, developers need to install the Spring Boot Extension Pack in addition to the Extension Pack for Java.

The Redmond dev team maintains Java tools available in the code editor's marketplace, including Extension Pack for Java, which has been installed nearly 14.5 million times. The Spring Framework, which is one of the most popular Java platforms, provides comprehensive infrastructure support for developing Java applications.

Another new feature in this update affects Spring beans, which are objects that are instantiated, assembled, and managed by a Spring IoC container. These objects form the backbone of an application. In this update, bean property, a key attribute that developers often need to look at, has been made available on the Spring dashboard under the heading "Beans."

The Spring IoC Container constitutes the core of the Spring Framework. It creates the objects, configures, and assembles their dependencies, manages their entire life cycle. And it uses Dependency Injection (DI) to manage the components that make up the application.

When a developer starts a Spring app from the Spring dashboard, Zhu explained, as soon as the beans connect to the live process and go "green," the bean property information will automatically appear next to the bean name. "You will see if the bean is a singleton, prototype, and so on," Zhu said. "If a bean is defined by a developer and not by the Spring framework, you will see 'defined' as well."

Microsoft also beefed up functionality for the open-source Apache Maven and Gradle build tools, which are used primarily for Java projects. Maven allows a library consumer to override a dependency by version. Gradle, often used with Maven, supplies customizable dependency selection and substitution rules, which can help developers handle unwanted project-wide dependencies.

"We have heard from developers that they want better Maven and Gradle integration in our extensions, and this is one of the areas we will keep working on," Zhu said. "In our latest release, we have added Maven and Gradle menu items in our Java Project Explorer, so that developers can directly access certain actions in a more convenient way."

To use this feature, Zhu explained, all developers need to do is right click on an application node inside the Java Project Explorer view in a Maven or Gradle project and they will find the actions at the bottom of pop-up menu.

On the debugging front, two contributions from the community improve support for method breakpoints and also show target virtual machine exceptions as result in evaluate requests.


About the Author

David Ramel is an editor and writer for Converge360.