Developing SpringBoot Applications With NetBeans Part 2

Login | Register

Developing SpringBoot Applications With NetBeans Part 2

In the previous article, we saw how to create SpringBoot projects within NetBeans using the awesome NB SpringBoot plugin.

In this article, we'll continue the tour of the NB SpringBoot plugin and see in what other ways it can help you to develop Spring Boot applications usng NetBeans.

File Templates

In addition to creating Spring Boot projects, the NB SpringBoot plugin provides differrent templates when creating classes. On the New Class wizard, NB SpringBoot provides the options:

  • Configuration Properties Class - creates a class annotated with @ConfigurationProperties
  • CommandLineRunner Class - creates a class that implements CommandLineRunner
  • ApplicationRunner Class - creates a class that implements ApplicationRunner
  • Application Properties - creates an application.properties file
  • Additional Properties Metadata - creates a additional-spring-configuration-metadata.json file
  • Configuration Class - creates a class annotated with @Configuration
  • Component Class - creates a class annotated with @Component
  • Service Class - creates a class annotated with @Service
  • Controller Class - creates a class annotated with @Controller
  • REST Controller Class - creates a class annotated with @RestController

The Controller and RestController options are only available if you have added the spring-boot-starter-web artifact to a project.

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

Properties Editor

One of my favourite features of the NB SpringBoot plugin is the application.properties file editor and its syntax highlghting and name completion.

When editing an application.properties file, the editor provides popup completion for attribute name and attribute values as can be seen in the screen shot above. This can provide a great productivity boost when you can't remember the exact name of properties to set. All of the available properties are displayed along with their type and a short description of what they do.

Request Mappings Navigation

On the Navigator panel within NetBeans, a new Request Mappings drop down is avaiable. Selecting this shows all of the @RequestMapping method within the currently selected class. Double clicking on any of these opens the appropriate method within the code editor.

Conclusion

There are many more features available within the NB SpringBoot plugin such as forcing a restart of a SpringBoot application, or confiring the start-up options for the application, but in this and the previous article we've seen how Spring Boot support is enhanced within NetBeans by installing the NB SpringBoot plugin.

If you develop applications in Spring Boot, this is a must-have plugin for NetBeans users.

What's your favourite feature of this plugin, or do you think anthing is missing? Leave your comments below.

About

At Develop In Java, we've been a part of the Java community for over 10 years. If there's anything you'd like us to cover, just ask !

Current versions

  • Java - 1.8
  • Java EE - 7
  • Spring - 4.x