Spring Boot
For Spring Boot I am using Spring STS (Spring Tool Suite) a customize version of eclipse.
- 1) Create a Maven project
- Fill Group Id: E.x: com.boot
- Fill Artifact Id: Ex. das.boot
- 2) Add in pom.xml, Spring boot. The parent and dependecy:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.1.RELEASE</version>
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
- 3) Create packages as:
- controller
- model
- repository
- service
- 4) Create a Controller
- In the Controller package create a class named: HomeController
- add to the class @RestController
- Create the request mapping
- Run the App.class as Java Application
@RestController
public class HomeController {
@RequestMapping("/")
public String home(){
return "Das boot";
}
}
- 5) In App.java
Add the notation @SpringBootApplication above the class
In the main method add- SpringApplication.run(App.class, args);
Web Initializer
http://start.spring.io/
This page creates the pom validating the version for each dependency of many frameworks
Comentarios
Publicar un comentario