理解学习Springboot(二)
程序员文章站
2022-12-05 08:14:22
一、关闭banner 如果不想看到任何的banner,可以将其关闭。 当然也可以自己自定义banner,http://patorjk.com/software/taag/#p=display&h=3&v=3&f=4Max&t=itcast%20Spring%20Boot,有点鸡肋。 二、全局配置文件 ......
一、关闭banner
如果不想看到任何的banner,可以将其关闭。
当然也可以自己自定义banner,,有点鸡肋。
二、全局配置文件
阅读Springboot文档,全局的配置文件可以是application.properties或application.yml,在resources目录下或者类路径下的/config下,一般放到resources下。
1、修改启动端口号
2、配置log日志
在全局配置文件中配置log文件名称,路径,级别等。
1 # LOGGING 2 logging.config= # Location of the logging configuration file. For instance `classpath:logback.xml` for Logback 3 logging.exception-conversion-word=%wEx # Conversion word used when logging exceptions. 4 logging.file= # Log file name. For instance `myapp.log` 5 logging.level.*= # Log levels severity mapping. For instance `logging.level.org.springframework=DEBUG` 6 logging.path= # Location of the log file. For instance `/var/log` 7 logging.pattern.console= # Appender pattern for output to the console. Only supported with the default logback setup. 8 logging.pattern.file= # Appender pattern for output to the file. Only supported with the default logback setup. 9 logging.pattern.level= # Appender pattern for log level (default %5p). Only supported with the default logback setup. 10 logging.register-shutdown-hook=false # Register a shutdown hook for the logging system when it is initialized.
# LOGGING
logging.config= # Location of the logging configuration file. For instance `classpath:logback.xml` for Logback
logging.exception-conversion-word=%wEx # Conversion word used when logging exceptions.
logging.file= # Log file name. For instance `myapp.log`
logging.level.*= # Log levels severity mapping. For instance `logging.level.org.springframework=DEBUG`
logging.path= # Location of the log file. For instance `/var/log`
logging.pattern.console= # Appender pattern for output to the console. Only supported with the default logback setup.
logging.pattern.file= # Appender pattern for output to the file. Only supported with the default logback setup.
logging.pattern.level= # Appender pattern for log level (default %5p). Only supported with the default logback setup.
logging.register-shutdown-hook=false # Register a shutdown hook for the logging system when it is initialized.
三、获取配置文件内容:
也可以配置多个配置文件,在创建bean时,调用配置里面的参数。
@Component @ConfigurationProperties(prefix = "secConfig")
在controller中调用的时候通过实体bean自动注入,来操作bean对象。
上一篇: 记录mysql-8.0.17-winx64安装教程
下一篇: kafka单机环境搭建及其基本使用
推荐阅读
-
刚刚学习php,那位高手可以给个利用php实现链表和二叉树的代码解决方案
-
深入理解PHP几个算法:PHP冒泡、PHP二分法、PHP求素数、PHP乘法表_PHP教程
-
学习PHP&MySQL之——字符编码篇(二_MySQL
-
mongodb 学习笔记之二 mongodb入门(数据库、文档和集合)
-
PHP网页游戏学习之Xnova(ogame)源码解读(二)
-
Twig 的 tags学习(中文) 之二_PHP教程
-
刚刚学习php,那位高手可以给个利用php实现链表和二叉树的代码解决方案
-
【顶点实习】oracle的学习 二
-
html学习(二)_html/css_WEB-ITnose
-
php学习之道:WSDL详解(二)