Skip to content

File Templates

Alessandro Falappa edited this page Jul 26, 2016 · 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 containing the relevant dependencies on spring-boot-starters is selected. 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 Other... from the contextual menu.

See how to use file templates here.

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

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.

Spring MVC

Controller Class: creates a Spring MVC controller class, i.e. a class annotated with @Controller, with a basic method annotated with @RequestMapping.

REST Controller Class: creates a Spring MVC REST controller class with , i.e. a class annotated with @RestController and @RequestMapping, with a set of methods responding to the various HTTP verbs on a resource.

Spring Data

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 interface class names.

Clone this wiki locally