zoukankan      html  css  js  c++  java
  • SpringBoot与MyBatis整合案例

    1.导入依赖

     <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.webjars</groupId>
                <artifactId>jquery</artifactId>
                <version>3.3.1</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>2.1.1</version>
            </dependency>
    
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.38</version>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
            <resources>
                <resource>
                    <directory>src/main/java</directory>
                    <includes>
                        <include>**/*.properties</include>
                        <include>**/*.xml</include>
                    </includes>
                </resource>
            </resources>
        </build>
    View Code

    2.实体类

     3.dao层接口

    4..dao层.xml

     5.Service

     6.ServiceImpl实现类

     7.application.properties

     8.Application

     9.Controller

     运行结果:

  • 相关阅读:
    weka使用笔记1cluster内方法的使用
    RCP导出的错误解决
    hadoop 无法启动tasktrack 和jobtrack 解决办法
    前段技术
    数字信号处理 - chap1 采样
    数字信号处理 - chap5 数字信号频谱
    数字信号处理-chap3 滤波、差分方程、卷积
    数字信号处理 - Chap7 DFT和FFT (1)DFT基础
    数字信号处理 - chap2 数字信号
    数字信号处理 - Chap8 小波 (1)基础
  • 原文地址:https://www.cnblogs.com/mayuan01/p/11993463.html
Copyright © 2011-2022 走看看