当前位置:网站首页>web项目访问引用jar内部的静态资源
web项目访问引用jar内部的静态资源
2022-08-10 22:14:00 【字母哥哥】
一、实现原理
web项目访问引用jar内部的静态资源,在Servlet3协议规范中,包含在JAR文件/META-INFO/resources/
路径下的资源可以直接访问。
二、举例说明
如下图所示,是我新建的一个Spring Boot Starter项目:zimug-minitor-threadpool,用于实现可配置、可观测的线程池。其中pool.html
就是线程池运行状态的监控页面。放在如下图所示的位置。
位置放置正确之后,将项目打包。我的最终打包结果是zimug-minitor-threadpool-1.0.jar
。当一个Spring Boot项目需要引用这个jar包的时候,直接通过maven坐标引入即可。访问服务的/pool.html
即可获取当前SpringBoot服务的线程池配置信息,以及运行时状态信息。
说明按照这种方式,访问jar包里面的静态资源是可行的。
如果您觉得有帮助,期待您的关注、转发,您的支持是我不接的创作动力! 更多精彩内容欢迎关注我的公众号!
边栏推荐
猜你喜欢
FPGA - Memory Resources of 7 Series FPGA Internal Structure -03- Built-in Error Correction Function
《DevOps围炉夜话》- Pilot - CNCF开源DevOps项目DevStream简介 - feat. PMC成员胡涛
What are the concepts, purposes, processes, and testing methods of interface testing?
Conditional Statements of Shell Programming (2)
CFdiv2-Beautiful Mirrors-(期望)
Research on multi-element N-k fault model of power system based on AC power flow (implemented by Matlab code) [Power System Fault]
camera预览流程 --- 从HAL到OEM
阿里云贾朝辉:云XR平台支持彼真科技呈现国风科幻虚拟演唱会
[Maui official version] Create a cross-platform Maui program, as well as the implementation and demonstration of dependency injection and MVVM two-way binding
Distribution Network Expansion Planning: Consider Decisions Using Probabilistic Energy Production and Consumption Profiles (Matlab Code Implementation)
随机推荐
Introduction to the use of counter instructions in Rockwell AB PLC RSLogix5000
An article to teach you a quick start and basic explanation of Pytest, be sure to read
测试4年感觉和1、2年时没什么不同?这和应届生有什么区别?
The perfect alternative to domestic Gravatar avatars Cravatar
CIKM2022 | Sequence Recommendation Based on Bidirectional Transformers Contrastive Learning
亲测有效|处理风控数据特征缺失的一种方法
“数据引擎”开启前装规模量产新赛道,「智协慧同」崭露头角
Research on multi-element N-k fault model of power system based on AC power flow (implemented by Matlab code) [Power System Fault]
STL-deque
geemap的详细安装步骤及环境配置
配电网络扩展规划:考虑使用概率性能源生产和消费概况的决策(Matlab代码实现)
带着昇腾去旅行:一日看尽金陵城里的AI胜景
2022年8月的10篇论文推荐
Addition of linked lists (2)
高通平台开发系列讲解(应用篇)QCMAP应用框架介绍
ASCII、Unicode和UTF-8
JS use regular expressions in g model and non g difference
字节跳动原来这么容易就能进去...
"DevOps Night Talk" - Pilot - Introduction to CNCF Open Source DevOps Project DevStream - feat. PMC member Hu Tao
How many threads does LabVIEW allocate?