前言——项目整体的一些配置文件以及说明

这篇文章主要介绍项目的整体一些设置,避免在以后的开发过程中一点一点的配置

项目的地址

https://github.com/Pink-Smile/DatabaseDesign

使用的技术栈

  • SpringBoot 2.2.6
  • 前端UI:layui-2.x + X-admin2.2
  • 前后端数据传输:ajax + thymeleaf
  • Java版本:jdk1.8.0_251
  • Maven版本:apache-maven-3.6.2
  • Mybatis版本:Mybatis-2.0.0
  • 权限控制:Shiro

下面是项目使用的配置,整个项目所有的设置就是这样

pom.xml项目依赖


<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>
    <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.2.5.RELEASEversion>
        <relativePath/> 
    parent>
    <groupId>pinksmile.databasegroupId>
    <artifactId>demoartifactId>
    <version>0.0.1-SNAPSHOTversion>
    <name>DatabaseManagername>
    <description>Demo project for Spring Bootdescription>

    <properties>
        <java.version>1.8java.version>
    properties>

    <dependencies>
        
        <dependency>
            <groupId>com.github.pagehelpergroupId>
            <artifactId>pagehelper-spring-boot-starterartifactId>
            <version>1.2.5version>
        dependency>
        
        <dependency>
            <groupId>org.apache.shirogroupId>
            <artifactId>shiro-springartifactId>
            <version>1.4.2version>
        dependency>
        
        <dependency>
            <groupId>com.github.theborakompanionigroupId>
            <artifactId>thymeleaf-extras-shiroartifactId>
            <version>2.0.0version>
        dependency>
        





        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-aopartifactId>
        dependency>
        
        <dependency>
            <groupId>com.github.pengglegroupId>
            <artifactId>kaptchaartifactId>
            <version>2.3.2version>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-data-jdbcartifactId>
        dependency>
        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-thymeleafartifactId>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>
        <dependency>
            <groupId>org.mybatis.spring.bootgroupId>
            <artifactId>mybatis-spring-boot-starterartifactId>
            <version>2.0.0version>
        dependency>

        <dependency>
            <groupId>org.projectlombokgroupId>
            <artifactId>lombokartifactId>
            <scope>providedscope>
        dependency>

        <dependency>
            <groupId>mysqlgroupId>
            <artifactId>mysql-connector-javaartifactId>
            <scope>runtimescope>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintagegroupId>
                    <artifactId>junit-vintage-engineartifactId>
                exclusion>
            exclusions>
        dependency>
    dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
            plugin>
        plugins>
    build>

project>

application.properties设置

spring.datasource.url=jdbc:mysql://localhost:3306/database-manager?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=123456

server.port=8888

mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=pinksmile.database.domin
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.configuration.logImpl=org.apache.ibatis.logging.stdout.StdOutImpl

# 关闭模板缓存
spring.thymeleaf.cache=false
# 表示html页面在resources文件夹下的templates文件夹中
spring.thymeleaf.prefix=classpath:/templates/
# 表示页面后缀是html格式
spring.thymeleaf.suffix=.html
# 采用utf-8编码,避免页面乱码
spring.thymeleaf.encoding=UTF-8
# 文档MIME类型是text/html,也就是html格式的文档
spring.thymeleaf.servlet.content-type=text/html

spring.mvc.date-format=yyyy-MM-dd
#spring.jackson.date-format=yyyy-MM-dd
#spring.jackson.time-zone=GMT+8

# 资源缓存时间,单位秒
spring.resources.cache.period=604800
# 开启gzip压缩
spring.resources.chain.compressed=true
# 启用缓存
spring.resources.chain.cache=true
# 使用MD5版本号
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**

数据库创建文件请见Github

你可能感兴趣的:(SpringBoot)