欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

使用SpringBoot+MyBatis框架做查詢(xún)操作-創(chuàng)新互聯(lián)

一.在你建立的工程下創(chuàng)建 Module 選擇Spring initializr創(chuàng)建。
使用Spring Boot+MyBatis框架做查詢(xún)操作

創(chuàng)新互聯(lián)基于分布式IDC數(shù)據(jù)中心構(gòu)建的平臺(tái)為眾多戶(hù)提供成都服務(wù)器托管 四川大帶寬租用 成都機(jī)柜租用 成都服務(wù)器租用。

二.在Type處選擇: Maven Project(項(xiàng)目的構(gòu)建工具)
使用Spring Boot+MyBatis框架做查詢(xún)操作

三.創(chuàng)建依賴(lài)時(shí)勾上web,mybatis,mysql(這個(gè)看你個(gè)人需要吧,可以自主選擇)
使用Spring Boot+MyBatis框架做查詢(xún)操作

使用Spring Boot+MyBatis框架做查詢(xún)操作

建立好的項(xiàng)目結(jié)構(gòu)如下:
使用Spring Boot+MyBatis框架做查詢(xún)操作

注意:application.properties和application.yml是同一個(gè)東西,均為項(xiàng)目的核心配置文件

內(nèi)容如下:

#連接數(shù)據(jù)庫(kù)
spring.datasource.url=jdbc:mysql://localhost:3306/smbms
spring.datasource.username=root
spring.datasource.password=1234
spring.datasource.driverClassName=com.mysql.jdbc.Driver
#引入mybatis的配置文件
mybatis:
mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=com.example.sprboot.pojo

相應(yīng)的pom.xml文件
  <?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.example</groupId>
<artifactId>springboot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>springboot</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.5.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>
<dependencies>
    <!--添加web依賴(lài)-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <!--引入spring boot包-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <!-- Spring-Mybatis -->
    <dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <version>1.3.0</version>
    </dependency>
    <!-- MySQL -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
    <!--使用json對(duì)象-->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>fastjson</artifactId>
        <version>1.2.49</version>
    </dependency>
    <!--使用thymeleaf標(biāo)簽-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

</project>

相應(yīng)的接口UserMapper如下:

@Repository
public interface UserMapper {
List<User> getList();
}

service如下:

public interface UserService {
List<User> getList();
}

impl如下:

@Service
public class UserServiceImpl implements UserService {@Resource
br/>@Resource
br/>@Override
return userMapper.getList();
}
}

在resources中建一個(gè)文件夾mapper里面放mapper.xml文件,代碼如下:

<table>
<th>工號(hào)</th>
<th>用戶(hù)名</th>
<th>姓名</th>
<th>性別</th>
<th>生日</th>
<th>電話(huà)</th>
<th>地址</th>
<th>創(chuàng)建時(shí)間</th>
<tr th:each="user : ${users}">
<td th:text="${user.id}"></td>
<td th:text="${user.userCode}"></td>
<td th:text="${user.userName}"></td>
<td th:text="${user.gender}"></td>
<td th:text="${user.birthday}"></td>
<td th:text="${user.phone}"></td>
<td th:text="${user.address}"></td>
<td th:text="${user.createdBY}"></td>
</tr>
</table>

此處有一個(gè)th標(biāo)簽,需要引入一個(gè)<html xmlns:th="http://www.thymeleaf.org">
并在pom.xml中引入對(duì)應(yīng)的jar包(html中不能使用jstl表達(dá)式)

大家可以擴(kuò)展一下thymeleaf的知識(shí)

控制器代碼如下:

@Controller
public class UserController {@Resource
br/>@Resource
br/>@RequestMapping("/")
List<User> list=userService.getList();
model.addAttribute("users",list);
System.out.println(list);
return "/index.html";
}
}

注:在調(diào)通的時(shí)候,可能會(huì)報(bào)很多的錯(cuò),基本上都是注解的使用出錯(cuò),希望各位能夠細(xì)心點(diǎn)

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。

網(wǎng)頁(yè)名稱(chēng):使用SpringBoot+MyBatis框架做查詢(xún)操作-創(chuàng)新互聯(lián)
本文地址:http://aaarwkj.com/article26/geojg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、品牌網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站制作、App開(kāi)發(fā)、品牌網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名
免费激情在线视频网址| 黄色日韩欧美在线观看| 亚洲精品色婷婷一区二区| 成人作爱视频免费播放| 亚洲欧美二区中文字幕| 亚洲精品视频久久免费| 在线观看中文字幕日韩精品| 日本久久久视频在线观看| 熟妞人妻精品一区二区视频| 国产男女在线视频观看| 欧美亚洲午夜精品久久久| 国产欧美日韩一区二区三区不卡| 综合久久精品亚洲天堂| 亚洲人妻乱人伦中文字幕在线| 人妻激情偷乱视91九色| 成人爱爱免费观看视频| 国产在线精品91国自产拍| 人妻少妇麻豆中文字幕久久精品| 欧美激情片免费在线观看| 在线中文字幕日韩精品| 免费激情在线视频网址| 日韩欧美二区三区在线| 天堂av五月在线观看| 国内丰满少妇嗷嗷叫在线播放 | 亚洲女同另类在线播放视频| 日本的黄色录像一级带| 久久日韩一区二区三区| 中文字幕一区二区精品区| 国产又粗又爽视频免费| 国产一区精品在线免费看| 日本在线电影一区二区三区| 日本国产精品免费在线观看| 免费在线观看一级av| 久久这里有精品免费观看| 国产伦人偷精品免费视频| 欧美亚洲成人免费电影| 欧美日韩午夜福利视频| 欧美一区二区三区中文字幕| 99久久精品国产国产毛片| 国产成人一区二区二区三区| 综合国产精品久久久久久|