Skip to content

File Templates

Alessandro Falappa edited this page Sep 5, 2018 · 10 revisions

The plugin adds a series of file templates useful when programming with the Spring and Spring Boot frameworks.

The templates appear in the New File dialog when a maven project is selected and that project contains specific spring-boot-starter dependencies. For example the Repository Interface template of the Spring Data category appears only if the selected maven project has a dependency on spring-boot-starter-data-jpa.

The maven project must be selected in the Project view before choosing File > New File.... Alternatively right-click on the project icon in the Project view and choose New File > Other... from the contextual menu.

Spring Boot

CommandLineRunner Class and ApplicationRunner Class create a class, respectively implementing the Spring Boot CommandLineRunner and ApplicationRunner interfaces.

Configuration Properties Class creates a class annotated with @ConfigurationProperties to be used for Spring Boot type safe configuration properties.

Application Properties: creates a new configuration properties file. The wizard produces files in src/main/resources/ (optionally in a config/ subdirectory) adhering to the standard naming convention that can also be profile specific.

Additional Properties Metadata: creates a spring-boot-additional-metadata.json file. The file is automatically placed in META-INF subdirectory of src/main/resources folder and overwrites a pre-existing one. The wizard allows to choose which sections to create in the file.

Spring Framework

Configuration Class: creates a Spring beans Java configuration class, i.e. a class annotated with @Configuration.

Component Class: creates a generic Spring bean class, i.e. a class annotated with @Component.

Service Class: creates a Spring bean intended as a service implementation, i.e. a class annotated with @Service.

Controller Class: creates a Spring MVC controller class, i.e. a class annotated with @Controller, with a basic method annotated with @RequestMapping. The wizard allows to choose whether to generate error managing code.

REST Controller Class: creates a Spring MVC REST controller class, i.e. a class annotated with @RestController and @RequestMapping. The wizard allows to choose whether to create a set of methods responding to the various HTTP verbs on a resource and whether to generate error managing code.

Repository Interface: creates a Spring Data repository interface. The wizard allows to choose the base repository interface to extend and to specify the entity and identification class names.

Clone this wiki locally