Comments (12)
I have commit demonstration code of building plugin jar. Please checkout 9107e87 for more details. Also, you could read the doc describe further more.
Regarding to
Managing plugins with the shape of spring boot application, is SBP library aware to search classes under BOOT-INF folder?
the quick answer is no. I recommand search plugins jar via file system, rather than searching classpath. It's design to load/unload plugins dynamically at runtime time. If you use classpath, sbp has not difference as other ordinary monolithic Spring Boot application.
from sbp.
I recommand search plugins jar via file system, rather than searching classpath
I'm added the plugin jar via file system, but my jar is a spring boot executable jar, not a standard jar. Look at this link to browser the structure of a spring boot executable jar: https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-executable-jar-format.html#executable-jar-jar-file-structure
You've done a wonderful work with this library, but since it addresses pluggability of spring boot apps, I'm expecting that it's possible to provide via filesystem a spring boot executable jar because it's a standard way to build for spring.
So, according your opinion, loading a plugin jar with that structure, is it possibile to specify to sbp plugin loader the path (inside jar): /BOOT-INF/classes
and /BOOT-INF/libs
?
I've tried with classes-directories
properties but it doesn't work in deployment mode.
EDIT: I've just tried to load a standard jar (not spring boot executable jar ) assembling manually it with "libs" and it run OK. I think it could be more convenient to load a spring boot executable jar, because it contains all libs by default.
from sbp.
got your point.
I think this could be done by add a custom PluginLoader
. Right now SbpAutoConfiguration.pluginManager
use two PluginLoader
as here and here. You could implement an ExecutableJarPluginLoader
to locate the dependent jars in BOOT-INFO/libs
, and then add it to SbpAutoConfiguration.pluginManager
by overridding it.
from sbp.
Thank you for the answer. Now, it's clear to me how to define a new PluginLoader
in the PluginManager
bean.
I think that the ExecutableJarPluginLoader
should use an extended version of your SpringBootPluginClassLoader
. Could you help me to understand which method to override in SpringBootPluginClassLoader
to locate (inside the jar) classes and libs into the folders BOOT-INFO/classes
and BOOT-INFO/libs
?
from sbp.
I have just added a configuration spring.sbp.custom-plugin-loaders to allow you customize your own PluginLoader
(example)
You could use the SNAPSHOT version to experience it.
from sbp.
Good, so it's easier to add a custom plugin loader. Very nice!
But I don't understand yet how to develop this custom plugin loader to load classes from a jar with the structure of a spring-executable-jar.
It should be like the native JarPluginLoader but with an extendend SpringBootPluginClassLoader
, I suppose.
Which method should I override in SpringBootPluginClassLoader to locate (inside the jar) classes and libs into the folders BOOT-INFO/classes
and BOOT-INFO/libs
?
from sbp.
I don't suggest you to extend SpringBootPluginClassLoader
. There are complex class loading strategies behind it.
What you have to do now is to load jars inside a jar. Looks like there are no out-of-box solution till today(can't believe that >_<!). Here is antoher example.
Then you could implement a custom FatJarPluginLoader
, who holds the PluginClassLoader
, and tell this PluginClassLoader
to load the jars by pluginClassLoader.addFile(myJarFile);
just as other PluginLoader
did.
from sbp.
What you have to do now is to load jars inside a jar
Not only jars, also the classes are in another folder (BOOT-INF/classes
) inside the plugin.jar
from sbp.
With spring.sbp.custom-plugin-loaders
does the CustomPluginLoader
replace the default ones or add itself to the list of default loaders?
from sbp.
adding, after the builtin pluginLoader DefaultPluginLoader
/JarPluginLoader
from sbp.
Ok, I would need to remove/replace JarPluginLoader because it's apply to all jars. I would like to have an extended JarPluginLoader
that supports standard jar and spring boot jar.
from sbp.
Have make custom-plugin-loader
exclusive as #13 mentioned.
from sbp.
Related Issues (20)
- Plugins lifecycle issue HOT 3
- Can't start with java 8 HOT 7
- java.lang.IllegalArgumentException: class org.springframework.boot.context.ConfigurationWarningsApplicationContextInitializer is not assignable to interface org.springframework.context.ApplicationContextInitializer
- Can't run plugin in test project HOT 1
- Different classLoader is used with spring-dev-tools HOT 1
- auto-start-plugin property doesn't work HOT 2
- Add third-party lib to plugin HOT 4
- Add third-party lib to plugin HOT 2
- How plugins can read application.properties outside plugin jar HOT 1
- Plugin not loading when using Swagger in Application with below error HOT 3
- How to specify multiple plugin folders? HOT 1
- ClassCastException: class org.laxture.sbp.spring.boot.SbpAutoConfiguration$1 HOT 6
- Support multiple Jvm/Spring Boot version HOT 1
- Can i use dubbo in this framework? HOT 9
- Bean with that name has already been defined HOT 4
- Support for Spring Boot 2.7.x HOT 2
- Support Spring Boot 3.0 HOT 2
- Support WebFlux
- Unit tetss for core, etc HOT 3
- Application can't load the plugin's resourse HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sbp.