• 最小化springboot数据库查询


    在 main下建立 webapp目录,放jsp页面。

    1. application.yml

    springboot 2.4.3以后的版本,不需要把连接字符串写上时区了,

    spring:
      mvc:
        view:
          suffix: .jsp
          prefix: /
      datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://localhost:3306/zhouyi2?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
        username: root
        password: xxxxx
    mybatis:
      mapper-locations: mapper/**
      configuration:
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

    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>cn.taotao</groupId>
        <artifactId>maven01</artifactId>
        <version>1.0-SNAPSHOT</version>
    <parent>
       <artifactId>spring-boot-starter-parent</artifactId>
        <groupId>org.springframework.boot</groupId>
        <version>2.4.2</version>
    </parent>
    
        <properties>
            <maven.compiler.source>8</maven.compiler.source>
            <maven.compiler.target>8</maven.compiler.target>
        </properties>
    
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
    
            </dependency>
    
           <dependency>
                <groupId>org.apache.tomcat.embed</groupId>
                <artifactId>tomcat-embed-jasper</artifactId>
                <scope>provided</scope>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>2.2.2</version>
            </dependency>
    
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
            </dependency>
        </dependencies>
    </project>
  • 相关阅读:
    [Android实例] 同一Activity的实例被多次重复创建
    js 只能输入数字和小数点的文本框改进版
    DDMS文件权限设置
    form search 带参数 提交
    Jquery-UI dialog与ZeroClipboard 冲突问题的解决
    ZeroClipboard实现跨浏览器复制
    WebSocket使用80端口的方法
    Leetcode题目:First Bad Version
    Leetcode题目:Longest Common Prefix
    Leetcode题目:Counting Bits
  • 原文地址:https://www.cnblogs.com/sdgtxuyong/p/16080917.html
Copyright © 2020-2023  润新知