🐱福利
想不想自定义spring Boot启动Logo
哪里改springboot的启动标志?
spring boot启动总会显示这样的图标,但是我想不一样
方法:
首先我们在resource目录下面放入一个banner.txt文件
Spring Boot启动项目的时候就会优先启动这个文件中的内容。
然后我们用在线生成字符图标工具
http://www.network-science.de/ascii/
http://patorjk.com/software/taag/
找了一个shell的文本,放在resource目录下面放入一个banner.txt里,启动如下:
到这会不会感觉它还是不够美观,那么加点颜色,岂不是更棒!
Spring Boot提供了一个枚举类AnsiColor,这个类可以控制banner.txt中的字符颜色,而且非常容易使用。
比如我可以将字符设置成颜色:BRIGHT_YELLOW
版本号颜色设置成:BRIGHT_BLUE
${AnsiColor.BRIGHT_YELLOW}
_ _ _ _ _ _
/ /\ / /\ / /\ /\ \ _\ \ _\ \
/ / \ / / / / / / / \ \ /\__ \ /\__ \
/ / /\ \__ / /_/ / / / / /\ \ \ / /_ \_\ / /_ \_\
/ / /\ \___\ / /\ \__/ / / / / /\ \_\ / / /\/_/ / / /\/_/
\ \ \ \/___/ / /\ \___\/ / / /_/_ \/_/ / / / / / /
\ \ \ / / /\/___/ / / /____/\ / / / / / /
_ \ \ \ / / / / / / / /\____\/ / / / ____ / / / ____
/_/\__/ / / / / / / / / / / /______ / /_/_/ ___/\ / /_/_/ ___/\
\ \/___/ / / / / / / / / / /_______\ /_______/\__\/ /_______/\__\/
\_____\/ \/_/ \/_/ \/__________/ \_______\/ \_______\/
效果如下:
还有设置版本号的一些参数:
${application.version} 这个是MANIFEST.MF文件中的版本号
${application.formatted-version} 这个是上面的的版本号前面加v后上括号
${spring-boot.version} 这个是springboot的版本号
${spring-boot.formatted-version}同上
搞明白了配置文件的一系列属性的意义!
server:
port: 8080
servlet:
context-path: /XX
spring:
servlet:
multipart:
max-file-size: 10MB
max-request-size: 50MB
profiles:
active: '@profile.active@'
datasource:
driverClassName: xxxx
type: com.alibaba.druid.pool.DruidDataSource
druid:
connection-properties: xxxx
filters: stat
initial-size: 5
max-active: 20
max-pool-prepared-statement-per-connection-size: 20
max-wait: 60000
min-evictable-idle-time-millis: 300000
min-idle: 5
pool-prepared-statements: true
stat-view-servlet:
enabled: true
login-password: 123456
login-username: admin
reset-enable: false
url-pattern: /druid/*
test-on-borrow: false
test-on-return: false
test-while-idle: true
time-between-eviction-runs-millis: 60000
use-global-data-source-stat: true
validation-query: SELECT 1 FROM DUAL
web-stat-filter:
enabled: true是否启用StatFilter默认值true
exclusions: '*.js,*.gif,*.jpg,*.bmp,/druid/*'
url-pattern: /*
jpa:
database: MYSQL
generate-ddl: false
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5Dialect
show-sql: false
activiti:
check-process-definitions: false
database-schema-update: true
history-level: full
cors:
enabled: true
allowed-origins: '*'
allowed-methods: 'OPTIONS,GET,POST,PUT,DELETE'
allowed-headers: 'x-requested-with,Cache-Control,Pragma,Content-Type,Authorization'
allow-credentials: 'true'
max-age: '1800'
jwt:
enabled: true
encrypt-jwt-key: base.archetype
token-expire-time: 0
url-patterns: /com/*
allowed-paths: /com/authorizations/login
orika:
enabled: true
useBuiltinConverters: true
useAutoMapping: true
mapNulls: false
dumpStateOnException: false
favorExtension: false
captureFieldContext: false
swagger:
enabled: true
title: XXX
version: V1.0.1
base-package: cn.itfu.server.api
base-path: /**
globalOperationParameters[0]:
name: Authorization
description: 请求接口所需令牌
modelRef: string
parameterType: header
required: false
job:
enabled: true
job-parameters[0]:
cron: '0 0 0 * * ?'
jobClass: cn.net.weilai.ha
jobNumber: job1
jobGroup: group1
enabled: true
jpush:
enabled: true
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)