由于我的jboss项目去在容器中运行的,所以我习惯上把这些扩展功能添加到cli文件 ,然后在Dockerfile里把它们进行添加,动态为主程序添加功能。

Dockerfile
FROM jboss/keycloak:14.0.0USER root# 日志ADD log4.cli /opt/jboss/startup-scripts/# 静态文件路由ADD static_resource.cli /opt/jboss/startup-scripts/
log4.cli
embed-server --server-config=standalone-ha.xml --std-out=echobatch/subsystem=logging/logger=org.keycloak.events:add/subsystem=logging/logger=org.keycloak.events:write-attribute(name=level,value=DEBUG)/subsystem=logging/size-rotating-file-handler=EVENTLOG:add(file={path=events.log,relative-to=jboss.server.log.dir})/subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=level,value=DEBUG)/subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=rotate-size, value=10M)/subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=max-backup-index, value=5)/subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=append,value=true)/subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=formatter,value="%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n")/subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=autoflush,value=true)/subsystem=logging/root-logger=ROOT:add-handler(name=EVENTLOG)/subsystem=logging/size-rotating-file-handler=ACCESSLOG:add(file={path=access_log.log,relative-to=jboss.server.log.dir})/subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=level,value=INFO)/subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=rotate-size, value=10M)/subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=max-backup-index, value=5)/subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=append,value=true)/subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=formatter,value="%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n")/subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=autoflush,value=true)/subsystem=logging/root-logger=ROOT:add-handler(name=ACCESSLOG)/subsystem=logging/size-rotating-file-handler=SERVERLOG:add(file={path=server.log,relative-to=jboss.server.log.dir})/subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=level,value=INFO)/subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=rotate-size, value=10M)/subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=max-backup-index, value=5)/subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=append,value=true)/subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=formatter,value="%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n")/subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=autoflush,value=true)/subsystem=logging/root-logger=ROOT:add-handler(name=SERVERLOG)run-batchstop-embedded-server
static_resource.cli
embed-server --server-config=standalone-ha.xml --std-out=echobatch/subsystem=undertow/configuration=handler/file=static_resource:add(path="/opt/jboss/keycloak/standalone/welcome-content")/subsystem=undertow/server=default-server/host=default-host/location=\/:write-attribute(name=handler,value=static_resource)run-batchstop-embedded-server

愿与诸君共进步,大量的面试题及答案还有资深架构师录制的视频录像:有Spring,MyBatis,Netty源码分析,高并发、高性能、分布式、微服务架构的原理,JVM性能优化、分布式架构等这些成为架构师必备的知识体系,可以微信搜索539413949获取,最后祝大家都能拿到自己心仪的offer