application.properties配置文件
SpringBoot可以识别两种格式的配置文件,分别是yml文件与properties文件,可以将application.properties文件换成application.yml
application.properties默认放在:src/main/resource目录下,SpringBoot会自动加载
比较常用的配置
server.port=xxxx #端口
系统属性/变量
spring.profiles.active=xxx
该系统变量可以指明要使用的配置文件,一般应用于多环境配置分离
如:
spring.profiles.active=dev
在启动时会加载application-dev.properties配置文件,和application.properties在同一目录下
mysql基本配置
引入spring-boot-starter-jdbc
spring.datasource.url=jdbc:mysql://localhost:3306/dataname?serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
MyBatis配置
引入mybatis-spring-boot-starter
mybatis.config-location=classpath:mybatis/mybatis-config.xml #放在resources/mybatis/mybatis-config.xml中
mybatis.mapper-locations= classpath:mybatis/mapper/*.xml
mybatis.type-aliases-package=com.form.model #类型转换器包,多个逗号隔开
redis基本配置
引入spring-boot-starter-data-redis
spring.redis.host=127.0.0.1
spring.redis.port=
spring.redis.password=
spring.redis.timeout=
banner配置
项目启动时打印的一堆符号
banner.location=xxx.txt #可以自定义输出信息的位置
banner.charset=utf- #指定编码格式
spring.main.banner-mode=console/off #banner图开启或者打印模式
字符画生成的网站
http://www.network-science.de/ascii/
http://patorjk.com/software/taag/
application.properties配置文件的更多相关文章
- Spring Boot加载application.properties配置文件顺序规则
SpringApplication会从以下路径加载所有的application.properties文件: 1.file:./config/(当前目录下的config文件夹) 2.file:./(当前 ...
- eclipse创建spring boot项目加载不到application.properties配置文件
在配置文件application.properties中修改了端口号,但重启服务后发现端口号并没有跟着改变,发现是项目启动时没有加载application.properties文件导致 解决:项目-& ...
- Java 读取application.properties配置文件中配置
实际开发中若需要读取配置文件application.properties中的配置,代码如下.例:读取配置文件中name属性配置值: 代码如下: import org.springframework.c ...
- springboot使用外部application.properties配置文件
一.背景介绍 springboot默认的application.properties文件只能在项目内部,如果打成docker镜像后配置文件也打进去了,这样每次需要改动配置(比如数据库的连接信息)就需要 ...
- SpringBoot 项目不加载 application.properties 配置文件
起因:新安装的idea第一次运行springboot项目报url错误(Failed to configure a DataSource: 'url' attribute is not specifie ...
- eclips环境下开发spring boot项目,application.properties配置文件下中文乱码解决方案
如以上,application.properties文件下中文乱码.发生乱码一般都是由于编码格式不一样导致的. 打开Window-Preferences-General-content Types-T ...
- spring boot项目,application.properties配置文件下中文乱码解决方案
转自:https://blog.csdn.net/qq_40408534/article/details/79831807 如以上,application.properties文件下中文乱码.发生乱码 ...
- spring boot入门笔记 (二) - application.properties配置文件
项目最重要的一个东西,用来定义整个项目的一些东西(端口.访问项目的名称.数据源.日志.集成mybatis等框架.静态资源目录.thymeleaf.热部署等),很重要很重要的. #整个项目的端口号,默认 ...
- springboot项目logback.xml或者logback-spring.xml中读取不到application.yml或application.properties配置文件中的配置解决办法
在springboot项目中我们可能想要实现不同环境的日志项目配置不同,比如我想让不同环境的日志路径不同. 这时候我们很容易想: 1.到将日志路径配置在springboot的:application- ...
随机推荐
- CF 1033 D. Divisors
D. Divisors http://codeforces.com/contest/1033/problem/D 题意: 给n个(n<=500)个数,($a_i <= 2 \times 1 ...
- javaweb数据库编程代码详细讲解
import java.sql.*; /*默写数据库练习数据库编程及注释讲解代码*/ public class Main{ public static void main(String[]args)t ...
- Python中map函数
1.简介 python 提供内置函数map(), 接收两个参数,一个是函数,一个是序列,map将传入的函数依次作用到序列的每个元素,并把结果作为新的list返回.例如: (1)对于list [1, 2 ...
- win10电脑录教学视频的时候有回声或者通话的时候有回声,严重干扰录制效果,解决方式。
1.右键点击屏幕右下脚的小喇叭图标. 2.选择声音. 3.选择“录制”,出现如下 4.选择侦听 5.把侦听此设备 的打勾去掉.然后点击应用,点击确定,即可. 再也没有回声的烦恼了.
- openstack 之~keystone部署
第一:版本信息 官网http://docs.openstack.org/newton/install-guide-rdo/keystone.html 我们按照Newton这个版本来部署,opensta ...
- pygame-KidsCanCode系列jumpy-part8-记录历史最高分
通常在多玩家的游戏中,每个玩家都会有自己的得分,最高分数会成为该游戏的最佳记录.这一篇,学习下如何记录最高得分:(为了简化代码,本文采用文件方式,仅记录本机得分,明白原理后,可以将得分保存在云端或数据 ...
- 基于AllegroGraph实现Protege设计知识库模型的存储步骤
在 https://www.w3.org/2001/sw/wiki/Protege 网站看到以下词语: “.....The Protégé platform supports two main way ...
- 处理程序“AllowAccessJavaScripts”在其模块列表中有一个错误模块“ManagedPipelineHandler”
处理程序“AllowAccessJavaScripts”在其模块列表中有一个错误模块“ManagedPipelineHandler” 执行命令"cd C:\Windows\Microsoft ...
- 浪院长 | spark streaming的使用心得
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/rlnLo2pNEfx9c/article/details/82505159 今天.主要想聊聊spar ...
- 使用AShot进行网页全页截图
import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.Chrom ...