https://github.com/markiewb/spring-boot-propertieslauncher-with-external-jar
Example for a self-executable Spring Boot JAR, which accesses a 3rd-party JAR from a external directory.
https://github.com/markiewb/spring-boot-propertieslauncher-with-external-jar
Last synced: about 1 year ago
JSON representation
Example for a self-executable Spring Boot JAR, which accesses a 3rd-party JAR from a external directory.
- Host: GitHub
- URL: https://github.com/markiewb/spring-boot-propertieslauncher-with-external-jar
- Owner: markiewb
- License: unlicense
- Created: 2018-09-29T09:26:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-25T21:00:36.000Z (about 7 years ago)
- Last Synced: 2025-03-18T04:16:18.141Z (about 1 year ago)
- Language: Shell
- Size: 1.77 MB
- Stars: 12
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
Example for a self-executable Spring Boot JAR, which accesses a DB driver (or any other 3rd-party JAR) from a external (non-bundled) directory.
This may be useful if you are not allowed to bundle the DB driver with your application.
Tips:
* Use `ZIP` as layout in `spring-boot-maven-plugin` (to generate the `PropertiesLauncher` entry in the `MANIFEST.MF`)
* Set `true` to prepend a shell script to the resulting JAR
* See [command line examples](run.sh) for different types of running the JAR using the `loader.path` option
## Expected result
Have a look for the output
```
Try to use external driver
-------------> Found driver h2 1.4
```
in all variants. The same application is started using different types of loading an external jar.
```
--------------------------
Variant A via java -jar
--------------------------
...
2019-04-25 22:51:59.934 INFO 26947 --- [ main] com.example.x.Application : Started Application in 6.005 seconds (JVM running for 6.465)
Try to use external driver
-------------> Found driver h2 1.4
--------------------------
Variant B via java -jar
--------------------------
...
2019-04-25 22:52:06.447 INFO 26948 --- [ main] com.example.x.Application : Started Application in 5.996 seconds (JVM running for 6.456)
Try to use external driver
-------------> Found driver h2 1.4
------------------------------------------------------------------------------------------------
Variant C via self-executable and loader.path-configuration from (default-) loader.properties
------------------------------------------------------------------------------------------------
...
Try to use external driver
-------------> Found driver h2 1.4
--------------------------------------------------------------------------------------------
Variant D via self-executable and loader.path-configuration from different property file
--------------------------------------------------------------------------------------------
...
2019-04-25 22:52:19.494 INFO 26979 --- [ main] com.example.x.Application : Started Application in 6.005 seconds (JVM running for 6.453)
Try to use external driver
-------------> Found driver h2 1.4
------------------------------------------------------------
Variant E via self-executable and LOADER_PATH environment
------------------------------------------------------------
...
2019-04-25 22:52:26.024 INFO 26995 --- [ main] com.example.x.Application : Started Application in 5.967 seconds (JVM running for 6.439)
Try to use external driver
-------------> Found driver h2 1.4
```