Developing SpringBoot Applications With NetBeans
NetBeans provides some support for Spring application development, however this support can be greatly enhanced by using the NB SpringBoot plugin by Alessandro Falappa. In this article, you'll learn how to create a SpringBoot project and how to manage the Maven dependencies within it.
The NBSpringBoot plugin is available from the NetBeans plugin menu. Installation is as simple as any NetBeans plugin - simply select the
NB SpringBoot plugin and press the
Install button. After restarting NetBeans, the plugin will be enabled.
Creating a Project
When creating a new project, NetBeans now provides 2 new Maven Project types:
- Spring Boot basic project
- Spring Boot Initializr project
Selection the frst project type,
Spring Boot basic project, simply creates an empty Maven project configured with the minimal Spring Boot
starter Maven dependencies. This is useful if you want complete control and want to start completely from scratch.
If, however, you want to create a project in a similar fashion to the Spring Initializr, select the second project type -
Spring Boot Initializr project. After selecting the project type, NetBeans displays the standard new project screen for defining the Maven group, artifact and version etc. Continuing with the wizard however, displays the
Dependencies tab where all of the different Sring Boot dependencies can be selected along with the version of Spring Boot to use within the project.
As seen in the screen shot above, the majority of Spring Boot Dependencies here have a link to both the reference documentation for the dependency and a link to the development guide - excellent resources for both new and seasoned developers to the selected dependency.
As with the Spring Initializr, you can filter the list of dependencies that are shown using the
Filter edit box.
Updating a Project's Dependencies
NetBeans provides excellent support for adding Maven dependencies into a project, but the NB SpringBoot takes this to the next level by allowing Spring Boot dependencies to be added using the same style interface as when creating a project.
Whilst editing the
pom.xml file, select the
Insert Code option. On the pop-up menu, note the new option
Spring Boot Dependencies...
Upon selecting this, a dispay similar to that when creating the project is shown, listing all of the different Spring Boot dependencies that can be selected and added to the project. Again, filtering is available to help identify the required dependencies.
As you can see, the NB SpringBoot plugin provides some excellent features to help you create and manage Maven based Spring Boot applications. The plugin provides many other features to aid Spring Boot developers which we'll cover in another article.