-
-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Enable ServiceConfig to use alternate ClassLoader - was ServiceConfig add setClassloader api #476
Comments
If you go serverConfig.setClassLoader(...) why not go serverConfig.setCurrentUserProvider(...) ? This does not make sense to me. |
serverConfig.setClassLoader(...) can set in framework, get from currentThread |
Nope, still not clear. "get from currentThread" ... what? Please put some effort into trying to give a meaningful explanation of the On 3 December 2015 at 21:53, icode notifications@github.com wrote:
|
In my framework not my app call |
Right. So no I'm not going to add serverConfig.setClassLoader(...) .... (at least On 3 December 2015 at 22:03, icode notifications@github.com wrote:
|
Now , in my framework can not configure ebean from config file, like play1, change classloader in dev model, so ebean |
I understand. It is just that your proposed solution On 3 December 2015 at 22:15, icode notifications@github.com wrote:
|
Right so this issue needs a "Reboot" taking it back to the original problem. Original Problem:A ClassNotFoundException can occur when the "current class loader" is not the correct classLoader to use when creating instances of CurrentUserProvider / NamingConvention etc. Potential Fixes / Changes:
Currently I see the suggestion of setting a classLoader on ServerConfig is an option but not the best solution in terms of providing the most flexibility. The start will be to implement the first 2 fixes / changes and then review. |
Yeah, you are right. I just to describe the problem. My English is not good, so I can only say so. |
…erviceConfig add setClassloader api --- part 1 : protected methods
…erviceConfig add setClassloader api --- part 2 : Use current context classLoader
No problem. I have pushed 2 commits that make some methods protected and will use the context classLoader. If you can build from master you can give it a try. I'm going to continue to look into the code more with a view to do a bit of cleanup and refactoring. |
…erviceConfig add setClassloader api --- part 3: Refactor with ClassLoadConfig
The last commit there refactored the internals and puts ClassLoadConfig on ServerConfig. The ClassLoadConfig has most of the classLoader specific functions including detecting types to support (Joda, Java time, Jackson etc) and creating new instances. Out of the box ClassLoadConfig will try to use the current context classLoader and then fallback to the caller one. In addition it can be created with an explicit classLoader to use. So I think this does what we need it to do. Potentially it could be converted into an interface in time but it might be sufficient as is (with the ability to override methods as desired). |
My framework change classloader load in project class, but
ServiceConfig
not use my classloader because is not in project, it's in jar. So, i use configebean.currentUserProvider
get user throw class can not case exception.The text was updated successfully, but these errors were encountered: