SpringBoot- Introduction (a)

Why should we use Springboot it?

When we use the framework, the profile cumbersome, and very messy, in the absence of SpringBoot, called "Configure hell." So the use of Spring boot can be very easily and quickly create applications based on the Spring Framework, which allows coding change simple, simple configuration change, and change simple deployment, monitoring becomes easy.

SpringBoot Starter: he will rely on common packet integration, incorporate it into a dependent, so that you can add to a one-time project to build Gradle or Maven also solve the problems of our guide, this package is simply our software development. staff in the spring ah.

SpringBoot properties

1. Be able to quickly create a Spring-based applications. (Simplified configuration)

2. be able to directly use the main method of java to start Tomcat, Jetty server running Spring boot program built-in, you do not need to deploy war package file.

3. Provide starter POM agreed to simplify the configuration to simplify Maven, Maven make configuration easy.

4. The configuration of the dependent maven project, Spring boot autoconfiguration Spring, SpringMVC and other open source framework.

5. Provide health screening program and other functions. (Check the operation state of the internal and the like)

6. Basic can complete absence of xml configuration files, configuration using annotations. (Or default configuration convention, the code has been implemented)

hello,SpringBoot

The first step to open the IDEA, click New Project

It represents the rapid creation of a SpringBoot project.

After waiting we can write the file into the controller

The second step select Start web project

The third step is to write controller

@Controller
public class HelloController {
    @RequestMapping("/h")
    @ResponseBody
    public String hello(){

        return "hello,Springboot";
    }


}

第四步找到启动类

编写好后我们找到springBoot的启动类,idea已经帮我们生成好了

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {


        SpringApplication.run(DemoApplication.class, args);
    }

}

他就是负责启动我们的springBoot项目的.

然后我们点击运行,我们不用配置文件.

我们看到Tomcat也启动了,应为springboot继承了Tomcat等一系列web开发的所依赖的.

结果:

这时候我们的hello,SpringBoot就出来了,为什么呢?springBoot竟然这么强大到底是什么原因呢?下次博客一一分享而来.

 

Guess you like

Origin www.cnblogs.com/xiaoqiqistudy/p/11329468.html