zoukankan      html  css  js  c++  java
  • springboot application.yml的常用配置

    原文地址:https://blog.csdn.net/lxh18682851338/article/details/78661607

    1. application.yml

    # mysql 的数据库配置
    spring:
    datasource:
    url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
    username: root
    password:
    driver-class-name: com.mysql.jdbc.Driver
    server:
    port: 8081
    context-path: /spring-boot-demo # 访问地址:http://localhost:8081/spring-boot-demo/hi
    # tomcat:
    # uri-encoding: UTF-8
    # session:
    # timeout:
    # jsp
    # mvc:
    # view:
    # prefix: /WEB-INF/ # 页面默认前缀目录
    # suffix: .jsp # 响应页面默认后缀

    #热部署
    devtools:
    restart:
    enabled: true #热部署生效
    #设置重启的目录
    additional-paths: src/main/java
    exclude: WEB-INF/** #classpath目录下的WEB-INF文件夹内容修改不重启
    # spring mvc 视图解析器
    mvc:
    view:
    prefix: /WEB-INF/views
    suffix: .jsp
    # jpa:
    # hibernate:
    # ddl-auto: update # create (自动创建表,要先创建类,每次都是先删再创建) update:如果表存在则不创建,只在第一次初始化时创建表
    # show-sql: true

    mybatis:
    mapper-locations: classpath*:mybatis/*Mapper.xml
    type-aliases-package: com.demo.entity

    #spring:
    # profiles:
    # active: dev

    #spring:
    # profiles:
    # active: prod


    2. application.properties

    # 加载mybatis 配置文件
    mybatis.mapper-locations=classpath:mapper/*Mapper.xml
    # 定义别名
    mybatis.type-aliases-package=com.boot.bean

    # 配置数据源
    spring.datasource.url=jdbc:mysql://localhost:3306/test
    spring.datasource.username=root
    spring.datasource.password=123
    spring.datasource.driver-class-name=com.mysql.jdbc.Driver

    #整合redis 单机版
    #spring.redis.host=192.168.0.101
    #spring.redis.port=8023

    #整合redis 集群
    #spring.redis.cluster.nodes=192.168.0.101:7001,192.168.0.101:7002,192.168.0.101:7003,192.168.0.101:7004
    ————————————————
    版权声明:本文为CSDN博主「往事随风非」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/lxh18682851338/article/details/78661607

  • 相关阅读:
    greenplum 常用整理
    postgresql 常用整理
    数据源整理
    hive 以like方式建表(携带表结构)
    kudu 常用整理
    mysql常用整理
    Linux查看文件内容的常用方式(more,less,head,tail,cat)
    python2.7 安装docx错误
    python2.7 安装搜索引擎错误
    mysql数据库安装错误
  • 原文地址:https://www.cnblogs.com/linwenbin/p/11375326.html
Copyright © 2011-2022 走看看