springboot就是一个企业级生产级的框架
1.springboot是可以去轻松的创建独立的生产级的基于Spring的应用程序
2.springboot默认的嵌入了多个像tomcat一样的服务器,在我们的日常使用中是十分方便的
springboot在使用的时候就是我们自己做的很少,但是干的很多
springboot的快速入门
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hspedu</groupId>
<artifactId>quicstart</artifactId>
<version>1.0-SNAPSHOT</version>
<!--导入springboot的父工程-规定的写法-->
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>2.5.3</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
package com.hspedu.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author Spring
* @description Java Lotus
* @date 2024-08-08 14:56
*/
@SpringBootApplication
public class MainApp {
public static void main(String[] args) {
//启动我们的springboot的应用的程序
//本类的程序传进去,之后再把这个args的相关的参数传进去
SpringApplication.run(MainApp.class,args);
}
}
package com.hspedu.springboot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author Spring
* @description Java Lotus
* @date 2024-08-08 14:59
*/
@Controller
public class HelloController {
//返回这个hello,springboot
@RequestMapping("/hello")
@ResponseBody
public String hello(){
return "hello,SpringBoot";
}
}