springboot + gradle +mybatis +thymeleaf 搭建项目

本文介绍了一个使用Gradle构建工具配置的Spring Boot应用案例,包括依赖管理、插件应用、数据源配置及启动类等核心内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先是gradle的配置

group 'zhanSystem'
version '1.0-SNAPSHOT'

apply plugin: 'java'


buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:$springVersion")
    }
}

apply plugin: 'org.springframework.boot'

dependencies {

    compile("org.springframework.boot:spring-boot-starter-thymeleaf")
    compile("tk.mybatis:mapper-spring-boot-starter:2.0.3")

    compile project(':common-utils')
    compile("org.springframework.boot:spring-boot-starter:$springVersion")
    compile("org.mybatis.spring.boot:mybatis-spring-boot-starter:$mybatisVersion")
    compile("org.springframework.boot:spring-boot-starter-data-redis:$springVersion")
    compile("mysql:mysql-connector-java:$mysqlDriverVersion")
    compile("org.mybatis.caches:mybatis-ehcache:$mybatisEhcacheVersion")
    compile("org.projectlombok:lombok:1.18.0")
    compile("javax.persistence:persistence-api:1.0")
    compile("org.apache.commons:commons-lang3:3.3")
    compile("org.apache.commons:commons-collections4:4.1")
    compile ("commons-beanutils:commons-beanutils:1.9.1")
    compile ("org.springframework.boot:spring-boot-devtools")
    compile group: 'org.apache.poi', name: 'poi', version: '3.12'
    compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.12'
    compile group: 'com.alibaba', name: 'fastjson', version: '1.2.47'
    /*引入外部JAR包,包文件过大,下载较慢*/
    compile group: 'edu.stanford.nlp', name: 'stanford-corenlp', version: '3.9.1'
    compile files('lib/stanford-corenlp-3.9.1-javadoc.jar')
    compile files('lib/stanford-corenlp-3.9.1-models.jar')
    compile files('lib/stanford-corenlp-3.9.1-sources.jar')
    compile files('lib/xom.jar')
    testCompile("org.springframework.boot:spring-boot-starter-test:$springVersion")
}

application.properties配置

spring.profiles.active=dev


#环境变量
server.max-http-header-size=10240
#服务端口
server.port=8069
#mybatis配置
mybatis.mapperLocations = classpath:mapper/*.xml
mybatis.type-aliases-package = com.zhan.model


spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false


#日志级别
logging.level.com.zhan.config = info
logging.level.com.zhan.controller = info
logging.level.com.zhan.domain = info
logging.level.com.zhan.mapper = debug
logging.level.com.zhan.service = info
logging.level.com.zhan.utils = info
logging.path=/data/logs/TpoWords

#日志颜色
spring.output.ansi.enabled=always


## 数据源配置
spring.datasource.driver-class-name = com.mysql.jdbc.Driver
spring.datasource.url = jdbc:mysql://0.0.0.0:3306/wordsdb?useUnicode=true&characterEncoding=UTF-8
spring.datasource.username =
spring.datasource.password =


启动类

package com.zhan;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import tk.mybatis.spring.annotation.MapperScan;




/**
 * 项目启动类
 * @author bean.zhang
 * @date 2018-07-13
 */
@EnableTransactionManagement
@SpringBootApplication
@MapperScan(basePackages = "com.zhan.mapper")
public class TpoWordApplication {

    public static void main(String[] args) {
        SpringApplication.run(TpoWordApplication.class, args);
    }
}

项目的目录结构

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值