springboot+spring+springmvc+mybatis详解

本文介绍了如何配置和使用SpringBoot、Spring、SpringMVC和Mybatis,包括Gradle环境配置、实体类、Mapper配置、DAO层和服务层的详细讲解,旨在简化大型项目的依赖管理和数据库操作。
摘要由CSDN通过智能技术生成


文件结构

再三注意:   在阅读本文之前务必配置Gradle环境。

gradle倒入jar包教程


在开始之前。我认为有必要提醒。你需要先点击FILE->NEW->OTHERS->Gradle project。如果没有Gradle project说明你没有配置gradle环境。
那么什么是Gradle呢?传统的配置环境过程中,不得不去官网下载所需要的jar包,然后build path手动导入。而gradle可以自动下载用到的jar包这样就不用一个一个去官网上下了。至于要用到什么jar包,要在做项目之前就想好(比如说我要用spring来写代码,那么我就要去下载关于spring的jar包)。然后在gradle的配置文件当中写上你要用到的jar包。然后gradle就会自动去帮你下载。Gradle只需要你在build.gradle写好配置代码即可。那么配置代码怎么写呢。我们根据以下代码再做解释。
/*
 * This build file was auto generated by running the Gradle 'init' task
 * by '18301353897' at '17-8-1 涓嬪崍2:57' with Gradle 2.4
 *
 * This generated file contains a sample Java project to get you started.
 * For more details take a look at the Java Quickstart chapter in the Gradle
 * user guide available at http://gradle.org/docs/2.4/userguide/tutorial_java_projects.html
 */

// Apply the java plugin to add support for Java
apply plugin: 'java'

// In this section you declare where to find the dependencies of your project
repositories {
    // Use 'jcenter' for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}

dependencies {
// https://mvnrepository.com/artifact/com.alibaba/fastjson
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.8'

// https://mvnrepository.com/artifact/mysql/mysql-connector-java
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.34'

// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-undertow
compile group: 'org.springframework.boot', name: 'spring-boot-starter-undertow', version: '1.3.2.RELEASE'

// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jdbc
compile group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version: '1.3.2.RELEASE'

// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.3.2.RELEASE'

// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot
compile group: 'org.springframework.boot', name: 'spring-boot', version: '1.3.2.RELEASE'

// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter
compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: '1.3.2.RELEASE'

// https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'

// https://mvnrepository.com/artifact/com.miglayout/miglayout
compile group: 'com.miglayout', name: 'miglayout', version: '3.7.3.1'

// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.6.5'

// https://mvnrepository.com/artifact/com.alibaba/druid
compile group: 'com.alibaba', name: '
  • 3
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值