Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmmiller612/syringe
Very lightweight dependency injection framework for Java
https://github.com/dmmiller612/syringe
Last synced: about 1 month ago
JSON representation
Very lightweight dependency injection framework for Java
- Host: GitHub
- URL: https://github.com/dmmiller612/syringe
- Owner: dmmiller612
- Created: 2015-04-11T17:02:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-14T20:49:19.000Z (over 9 years ago)
- Last Synced: 2023-03-02T13:06:40.853Z (over 1 year ago)
- Language: Java
- Size: 152 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Syringe
Very lightweight dependency injection framework for Java
```
Copyright [2015] [Derek Miller]Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
Syringe is a very lightweight, easy to use dependency injection framework. Without comments and annotations, it is ~115 lines
of code. In order for your class to be injectable, you need to first add the @Module annotation to your class. i.e:```java
@Module
public class SomeClass {
}
```And to inject it, use the Injectable annotation:
```java
@Injectable
private SomeClass someClass;
```To register your package, so that you can call Injectable modules, you will need to use the static method
Syringe.registerPackage()
```java
Syringe syringe = Syringe.registerPackage("testPackage");
```Then to call SomeClass:
```java
SomeClass someClass = syringe.getClassInstance(SomeClass.class);
```This will inject all dependencies the class has. A working example will be linked soon.