Thursday, March 22, 2018

Spring Boot Basic Course 01 - Web Introduction

01.Basic Structure
Ctrl+Shift+T
package - com..sbbasiccourse

02.How to Change Port and contextPath

application.properties

server.port = 9090
server.context-path = /springboot
Now URL : localhost:9090/springboot

03.Devtools Dependencies for auto restart server
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-devtools</artifactId>
   <scope>runtime</scope>
</dependency>


04.Add to Controller
package com.sbbasiccourse.controller;



@RestController
public class WelcomeController {
@RequestMapping(name="/")
public String index(){
return "Spring Boot Basic Course";
}
}
Now run and call URL - localhost:9090/springboot


05.Default API calling


<dependency>

  <groupId>org.springframework.boot</groupId>

  <artifactId>spring-boot-starter-actuator</artifactId>

</dependency>

And you have to add application.properties 
management.security.enabled=false

06.Default API calling

No comments:

Post a Comment