0
点赞
收藏
分享

微信扫一扫

java基础-day70-SpringBoot

IT影子 2021-09-29 阅读 9
基础知识

一、SpringBoot介绍


1.1 SpringBoot简介

1.2 SpringBoot的特点

1.3 SpringBoot的核心功能

二、SpringBoot介绍


三、SpringBoot快速入门


项目创建完成!

此时pom.xml文件中会自动导入springboot所需依赖,并且在src下会生成一个配置类。

注意:若pom.xml中依赖无法下载,需要修改maven工程对应的settings.xml文件,找到settings.xml文件中的镜像配置,原因是maven中央仓库下载不下来springboot关联的架包,所以建议使用阿里云的镜像.

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The     
repository that
     | this mirror serves has an ID that matches the mirrorOf element of this   mirror. 
IDs are used
     | for inheritance and direct lookup purposes, and must be unique   across the set of mirrors.
     |
    -->
      
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus-aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

</mirrors>

此时pom.xml文件中会自动导入springboot所需依赖,并且在src下会生成一个配置类。

注意:若pom.xml中依赖无法下载,需要修改maven工程对应的settings.xml文件,找到settings.xml文件中的镜像配置,原因是maven中央仓库下载不下来springboot关联的架包,所以建议使用阿里云的镜像.

<mirrors>

<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus-aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

</mirrors></pre>

手动编写Controller进行进一步测试(注意:需要将controller类,放在启动类的子包中或者同级包下)

package com.qf.controller;

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

@RestController
public class UserController {

    @RequestMapping("/login")
    public String login(){

        System.out.println("登录");

        return "success";
    }
}

四、SpringBoot热部署配置


<!--热部署配置-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>

举报

相关推荐

Day70(贪心算法)

Java基础day03

JAVA基础day04

Java基础day2

java基础 Day13

Java基础Day02

Java基础day06

java基础 Day07

java基础 Day14

0 条评论