最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Idea之沒(méi)有網(wǎng)絡(luò)的情況下創(chuàng)建SpringBoot項(xiàng)目的方法實(shí)現(xiàn)

 更新時(shí)間:2023年09月13日 11:27:35   作者:往日時(shí)光--  
本文主要介紹了Idea之沒(méi)有網(wǎng)絡(luò)的情況下創(chuàng)建SpringBoot項(xiàng)目的方法實(shí)現(xiàn),文中通過(guò)圖文介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

一丶創(chuàng)建SpringBoot有兩個(gè)方式

1.沒(méi)有網(wǎng)絡(luò)的情況下使用Maven創(chuàng)建

1.1:用Idea創(chuàng)建maven項(xiàng)目 不要勾選 next

1.2:這里填寫(xiě)自己的groupId和artifactid 然后next到創(chuàng)建結(jié)束

1.3:現(xiàn)在這里就是我們已經(jīng)創(chuàng)建了一個(gè)maven工程 現(xiàn)在我們?cè)趍aven工程基礎(chǔ)上 添加springboot基礎(chǔ)依賴(lài)

1.4:添加以下依賴(lài)

<!--springboot基礎(chǔ)的創(chuàng)建 告訴maven我們要?jiǎng)?chuàng)建的是一個(gè)springboot項(xiàng)目-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <dependencies>
        <!--SpringBook所需的jar包 默認(rèn)不需要寫(xiě)版本號(hào) 繼承父類(lèi)的版本號(hào)-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!--Mysql依賴(lài) springboot 2.2.0 好像默認(rèn)需要一個(gè)數(shù)據(jù)庫(kù)連接 不寫(xiě)會(huì)報(bào)錯(cuò)-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.13</version>
        </dependency>
    </dependencies>
    <!--spirng 打包成war包-->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

1.5:添加完成后的樣子

1.6:然后我們?cè)陧?xiàng)目中創(chuàng)建以下目錄和文件

1.7:然后我們?cè)谙鄳?yīng)的目錄下創(chuàng)建啟動(dòng)類(lèi)和單元測(cè)試類(lèi)

1.7.1:啟動(dòng)類(lèi)代碼

package com.aaa.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication  //啟動(dòng)類(lèi)
public class SpringbootApplication {
    public static void main(String[]args)
    {
        SpringApplication.run(SpringbootApplication.class,args);
    }
}

1.7.2:單元測(cè)試類(lèi)代碼

package com.aaa.springboot;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest   //單元測(cè)試類(lèi)
public class SpringbootTest {
    @Test
    public void test1()
    {
        System.out.println(111);
    }
}

1.7.3:application.yml中對(duì)應(yīng)的數(shù)據(jù)連接

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 1234
    url: jdbc:mysql://127.0.0.1:3306/books?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true

1.8:創(chuàng)建對(duì)應(yīng)的controller和templates模板 以及我們?cè)L問(wèn)controller方法要跳到的頁(yè)面

1.8.1:controller代碼

package com.aaa.springboot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HelloWorldController {
    @RequestMapping("Hellow")
    public String HellowWord()
    {
        return "HelloWorld";
    }
}

1.8.2:html代碼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
歡迎你使用SpringBoot
</body>
</html>

1.9:現(xiàn)在我們來(lái)運(yùn)行

2.直接在idea中springboot快速創(chuàng)建

小編目前沒(méi)有網(wǎng),快速創(chuàng)建的話(huà)自行百度! 小編小白一個(gè) , 歡迎大佬指點(diǎn)

到此這篇關(guān)于Idea之沒(méi)有網(wǎng)絡(luò)的情況下創(chuàng)建SpringBoot項(xiàng)目的方法實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)Idea創(chuàng)建SpringBoot項(xiàng)目?jī)?nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

高陵县| 英山县| 历史| 云南省| 长寿区| 塘沽区| 平利县| 沂水县| 南部县| 邮箱| 永定县| 正定县| 临清市| 海口市| 如东县| 溧水县| 内黄县| 荆州市| 嘉鱼县| 高安市| 遂溪县| 丽水市| 徐闻县| 贵溪市| 承德县| 抚顺县| 西和县| 平凉市| 巫山县| 五大连池市| 虎林市| 武陟县| 新绛县| 孝昌县| 巴马| 四川省| 安新县| 濮阳县| 和田市| 衡南县| 萨嘎县|