(1)打开idea 新建-》spring Iniializr->选择自己jdk的位置 

选择spring初始化的网站(默认),有时候网站可能连不上,

-》next等待工程初始化-》写公司的名字如 com.baidu-》工程名称-》demo

->next-》选择web的web-》next-》工程名称-》工程所在的位置=》finish

(2)请等待工程加载完毕

Spring Boot 使用1

如果碰到mvn没有加载完毕

请刷新maven或者配置maven-》settings。xml

此文件在

Spring Boot 使用1

在settings。xml写入

<mirror>
    <!--This sends everything else to /public -->
    <id>nexus-aliyun</id>
    <mirrorOf>*</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

阿里云的maven repository

在pom.xml配置

<repositories>
    <repository>
        <id>nexus-aliyun</id>
        <name>nexus-aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

然后刷新maven

直到maven配置不变红

(3)

在file->settings->plugins->Browser repositories->搜索lombok-》安装

lombok可以用注解@Data实现getset方法

(4)

Spring Boot 使用1

写好包

resourece下的application。properties删除,新建一个application.yml文件

spring:
  datasource:
    username: root
    password: 密码
    url: jdbc:mysql://127.0.0.1:3306/数据库名字?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=true
    driver-class-name: com.mysql.jdbc.Driver
  mvc:
    view:
      suffix:
配置yml,必须有格式,否则无法进行编译

相关文章:

  • 2022-12-23
  • 2021-07-04
  • 2021-08-26
  • 2022-12-23
  • 2021-09-09
  • 2021-11-25
  • 2021-09-27
猜你喜欢
  • 2021-11-14
  • 2022-02-26
  • 2021-11-18
  • 2022-01-13
  • 2021-12-13
  • 2021-11-17
  • 2021-12-09
相关资源
相似解决方案