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- ...
随机推荐
- 键盘回收(text filed,textview)
键盘回收 #pragma mark - TextField 代理方法 - (BOOL)textFieldShouldReturn:(UITextField *)textField { [self.vi ...
- 最长递增子序列( LIS)
LIS LIS的优化说白了其实是贪心算法,比如说让你求一个最长上升子序列把,一起走一遍. 比如说(4, 2, 3, 1, 2,3,5)这个序列,求他的最长上升子序列,那么来看,如果求最长的上升序列,那 ...
- nested exception is java.lang.ClassNotFoundException
当出现nested exception is java.lang.ClassNotFoundException这个异常的时候,首先排查类是否存在.如果存在,是maven项目的话,clean.insta ...
- ASP.NET WebApi技术从入门到实战演练
一.课程介绍 曾经有一位不知名的讲师说过这么一句名言: 一门RPC技术不会,那么千万万门RPC技术将都不会!在今天移动互联网的时代,作为攻城师的我们,谁不想着只写一套API就可以让我们的Web, An ...
- ASP.NET Core WebApi
ASP.NET Core WebApi 创建项目 使用VS新建项目,选择ASP.NET Core WebAPI即可. 此时Startup的Configure.ConfigureService方法中如下 ...
- Why validation set ?
Let's assume that you are training a model whose performance depends on a set of hyperparameters. In ...
- 转: linux centos7 下安装maven
转: https://www.tecmint.com/install-apache-maven-on-centos-7/
- Git上传空文件夹
git上传的文件夹为空的时候 1,先删除空的文件夹 参考:https://www.cnblogs.com/wang715100018066/p/9694532.html 2,这个只能说是技巧不能说是方 ...
- WSDL测试webservice接口记录
收到一个事情,需要对接第三方API,对方给了个service,看了一下,原来是webservices的. 上一次测试webervice的接口,还是至少八九年前的时候了,这种相对比较老旧的也好久不在使用 ...
- XCode各种问题
2018.07.10 1.clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated] 2.2018.07.29 海康 ...