Monday, April 20, 2015

Spring Boot demo with Maven:


Using:


Java 1.7
Maven 3.2

Steps:


Install spring CLI :
--------------------------


Unzip it and set the path of the folder to environment variables.

Set Environment Variables
---------------------------
set SPRING_HOME to point to a specific installation. 
You should also add SPRING_HOME/bin to your PATH environment variable.

Checking Your Installation
----------------------------
To test if you have successfully install the CLI you can run the following command:

               spring --version

Create a demo using the following link:
-----------------------------


Check Actuator under section “Ops” and Web.

Click generate project and then import that project in eclipse or your IDE.

In DemoApplication class:
--------------------------------

@RestController
@EnableAutoConfiguration
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
   
    @RequestMapping("/")
    String home() {
        return "Hello World!";
    }
}

Run the demo:
----------------------------

Using the command: mvn spring-boot:run

Run your demo and hit localhost:8080




No comments:

Post a Comment