栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

easycode使用指南

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

easycode使用指南

1、首先创建一个空的SpringBoot项目

2、导入以下依赖


        
            org.springframework.boot
            spring-boot-starter
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
            org.springframework
            spring-web
            5.3.16
        
        
            org.springframework.data
            spring-data-commons
        
        
            org.mybatis
            mybatis-spring
            2.0.7
        

        
        
            mysql
            mysql-connector-java
            runtime
        

        
        
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            2.2.2
        

        
        
            com.alibaba
            druid-spring-boot-starter
            1.2.8
        

        
            org.springframework.boot
            spring-boot-starter-web
        
    

3、选择连接数据库

4、选择要生成代码的表,生成代码

5、给配置文件添加配置

# Spring配置
spring:
  datasource:
    driverClassName: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/数据库名字?useSSL=false&characterEncoding=utf-8&useUnicode=true&serverTimezone=Asia/Shanghai
    username: root
    password: 12345678
server:
  port: 8080
# MyBatis配置
mybatis:
  # 搜索指定包别名
#  typeAliasesPackage: com.xxx.entity
  # 配置mapper的扫描,找到所有的mapper.xml映射文件
  mapperLocations: classpath:mapper/*.xml
  # 加载全局的配置文件

#  configLocation: classpath:mybatis/mybatis-config.xml

6、在Application文件里添加以下注解

@MapperScan("com.xxx.dao")

7、启动项目

8、随便点击一个接口测试,就成功了!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/947131.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号