zoukankan      html  css  js  c++  java
  • Spring Boot 整合 jdbctemplate 单数据源

    参考地址:https://www.cnblogs.com/huasonglin/p/10817940.html

    1.pom.xml引包

    <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
    
            <!-- 引入jdbc支持 -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jdbc</artifactId>
            </dependency>
            <!-- 连接MySQL数据库 -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.46</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <!-- 生成api文档 -->
    
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>2.2.2</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>2.2.2</version>
            </dependency>
        </dependencies>

    2. 在application.properties配置连接MySQL数据库

    spring.datasource.url=jdbc:mysql://localhost:3306/test_db?serverTimezone=GMT%2B8&useSSL=false
    spring.datasource.username=root
    spring.datasource.password=123456
    spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  • 相关阅读:
    性能测试流程
    登录时获取验证码
    xpath在谷歌下的安装教程
    浏览器驱动安装
    Python3.3+Selenium3.0框架实战Web自动化测试实战
    selenium+python+unittest实现自动化测试(入门篇)
    python 3 的环境搭建Robot Framework
    canvas
    学习webpack
    开始学习typescript
  • 原文地址:https://www.cnblogs.com/gjq1126-web/p/13958980.html
Copyright © 2011-2022 走看看