Java ape small circle of SpringBoot entry --HelloWorld

Friends want to do java, presumably also to find out about spring, spring boot simplifying the spring development, involving all aspects of Spring, it is a stunning magical invention. Spring Boot is a new framework provided by Pivotal team, which is designed to simplify the development process as well as the initial build new Spring applications. The framework uses a particular manner be configured so that the developer is no longer necessary to define the configuration of the template. In this way, Spring Boot committed to rapid application development booming (rapid application development) to be a leader.

Since spring boot so powerful, that followed a small ape lap pace, learn about spring boot first chapter of the hello world!

A, spring boot most always four core:

1, the automatic configuration (Automatic configuration): Spring applications for many common application functionality, Spring Boot automatically provide configuration.

2, start-dependent (Starter dependencies): Spring Boot tell what needs to function, it will be able to introduce the required libraries.

3, command-line interface (The command-line interface): This is an optional feature of Spring Boot, whereby you simply write the code to complete the full application, without the traditional project build.

4, Actuator: let Spring Boot-depth application you can run in, check it out.

Second, install the plug-STS

STS plug-in installation there are many ways, here only one of the eclipse for all versions (and some not search the eclipse plugin)

Plug-in download:

1, not all plug-ins are possible, download the plug-in version must be adapted to eclipse their own use, such as my eclipse version 4.5.0 (see the eclipse version: Help-> About Eclipse)

2, https://spring.io/tools3/sts/legacy to download their own plug-ins

3, open the eclipse, Help-> Install New Software

4. Click add, Name just write

5、add

6, only need to select 4 "at the end of the IDE," there is the following update option is not checked, as shown:


 

7, all the way next, wait a few minutes just fine.

8, File-> New-> Project, did not look good installed

Third, create a project

1、New Project:Spring->Spring Starter Project


 

2. Select a Web can finally Finsh (no other option)

3, run HelloWorldApplication.java

Methods: Right -> Run As-> Spring Boot App

Fourth, the implementation code

1, the new HelloWorldController

package cn.javacat;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;



@RestController

public class HelloWorldController {
    @RequestMapping("/hi")

    public String say() {

        return "Spring Boot你好!";

    }

}

2、浏览器访问:http://localhost:8080/hi

3、页面会出现:Spring Boot你好!  成功了!!!

用spring boot实现第一个项目,神秘又强大的spring大家还那么神秘吗?揭开第一篇面纱,大家往下学就不会感觉这个框架很难,现在感觉spring没有那么神秘了,但是它的功能还是相当强大的,接下来内容大家可以跟随小猿圈的步伐,继续学习spring boot框架,希望大家能把这个框架学会、学好。

Guess you like

Origin www.cnblogs.com/xiaoyuanquan/p/10973347.html