Follow the steps to complete a spring boot item (c) import template configuration items springboot
1. Open the eclipse project import spring boot, auto-configuration pom.xml download jar package.
After 2 eclise below autoconfiguration maven Item
3 in FIG console output application running spring
4 spring configuration file format we use yaml, application.properties changed application.yml file.
5 Modify the start port:
We modified application.yml: There is a space between the port and start proved to be successful.
6 custom banner
we can modify the console display of spring into mainserver add a baner.txt increase their character to the resources inside.
Website for online editing characters: http://patorjk.com/software/taag
6 test interface browser and enter http: // localhost: 8001
We create a new controller package, create a test controller to add a method. If there is an error message, you can import the package.
package com.ylz.spring_boot.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping(value="/hello")
public Object hello()
{
return "hello spring";
}
}
Re-request Address: hellospring can return to normal,
HTTP: // localhost: 8001 / the Hello