-
Notifications
You must be signed in to change notification settings - Fork 5
Possibility of Dependency Injection #5
Comments
Guice is a huge library, if you want to use a more small implementation take a look at https://github.com/AuthMe-Team/AuthMeReloaded |
So guava is a 'maybe', dependency injection is definite (where possible). |
@MylesIsCool |
@sgdc3 I wasn't able to find where you implemented javax.inject. @MylesIsCool @Techcable I don't know how much help this can be. The Logger example is nice, but that could easily be done with a Factory method or something similar, and I don't think using Guice or creating our own dependency injector would benefit plugin developers in enough ways to warrant the code needed for it. |
It looks nicer and more modern than just using a method to retrieve the logger. |
We could depreciate |
Use injection to retrieve server instance? |
@PizzaCrust Yes, normally plugins would do that, but to manufacture Material constants we need a static getter for the server. |
👍 to Guice. If we decide to add injection in, the functionality to inject our own classes would be very nice - Guice already lets you do this. |
@ljacqu is working on a simple and very lightweight inject implementation, based on the injector we are using in authme. |
I can confirm what @sgdc3 says, it's in use in AuthMe (look at the initialization package) and is in the process of being extracted as its own project. If you need to do tons of fancy stuff with dependency injection – use Guice. We needed a simple, lightweight one where we basically have one instance of each class (singletons) we want to wire together elegantly. |
Hi!
A lot of modern APIs use dependency injection, and it's not a bad idea when it's used right and does not cause latency and what (Resolving those dependencies).
Would this project consider that?
eg.
An example of a library that implements this is Guice (https://github.com/google/guice/wiki/GettingStarted), Sponge currently uses this also.
The text was updated successfully, but these errors were encountered: