All Projects → stephanenicolas → Toothpick

stephanenicolas / Toothpick

Licence: apache-2.0
A scope tree based Dependency Injection (DI) library for Java / Kotlin / Android.

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Toothpick

Lean
Use the PHP League's Container package with auto-wiring support as the core container in Slim 3
Stars: ✭ 30 (-97.17%)
Mutual labels:  dependency-injection
Inversifyjs
InversifyJS is a lightweight inversion of control (IoC) container for TypeScript and JavaScript apps. An IoC container uses a class constructor to identify and inject its dependencies. InversifyJS has a friendly API and encourages the usage of the best OOP and IoC practices.
Stars: ✭ 8,399 (+691.61%)
Mutual labels:  dependency-injection
Vue.js With Asp.net Core Sample
This provides a sample code using vue.js running on ASP.NET Core
Stars: ✭ 44 (-95.85%)
Mutual labels:  dependency-injection
Flair
This is powerful android framework
Stars: ✭ 31 (-97.08%)
Mutual labels:  dependency-injection
Simpleinjector
An easy, flexible, and fast Dependency Injection library that promotes best practice to steer developers towards the pit of success.
Stars: ✭ 966 (-8.95%)
Mutual labels:  dependency-injection
Nex
Aiming to simplify the construction of JSON API service
Stars: ✭ 35 (-96.7%)
Mutual labels:  dependency-injection
Spring Depend
Tool for getting a spring bean dependency graph
Stars: ✭ 28 (-97.36%)
Mutual labels:  dependency-injection
Android Mvvm Rxjava2 Dagger2
This repository contains a detailed sample application that uses MVVM as its presentation layer pattern. Essential dependencies are Dagger2 with Dagger-android, RxJava2 with RxAndroid, Room, Retrofit and Espresso.
Stars: ✭ 50 (-95.29%)
Mutual labels:  dependency-injection
Core
Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.
Stars: ✭ 34 (-96.8%)
Mutual labels:  dependency-injection
Zenject Hero
Zenject 7 - Game example (WIP)
Stars: ✭ 44 (-95.85%)
Mutual labels:  dependency-injection
Autowire
Lightweight & Simple dependency injection and resource management library for Python
Stars: ✭ 31 (-97.08%)
Mutual labels:  dependency-injection
Injection Js
Dependency injection library for JavaScript and TypeScript in 5.1K. It is an extraction of the Angular's ReflectiveInjector which means that it's well designed, feature complete, fast, reliable and well tested.
Stars: ✭ 962 (-9.33%)
Mutual labels:  dependency-injection
Social Note
Social Note - Note-taking, sharing, time & location reminder
Stars: ✭ 38 (-96.42%)
Mutual labels:  dependency-injection
Cookbook
🎶 Cookbook for Nette Framework (@nette) & Contributte (@contributte). Read it while its HOT!
Stars: ✭ 30 (-97.17%)
Mutual labels:  dependency-injection
Ios
A sample project demonstrating MVVM, RxSwift, Coordinator Pattern, Dependency Injection
Stars: ✭ 49 (-95.38%)
Mutual labels:  dependency-injection
Servicemanager
🔌 Most basic implementation of dependency injection container for JavaScript
Stars: ✭ 29 (-97.27%)
Mutual labels:  dependency-injection
Picobox
Dependency injection framework designed with Python in mind.
Stars: ✭ 35 (-96.7%)
Mutual labels:  dependency-injection
Factory
Factory for object creation and dependency injection. Works with normal C# apps or under Unity3d
Stars: ✭ 50 (-95.29%)
Mutual labels:  dependency-injection
Dijs
JavaScript dependency injection for Node and browser environments.
Stars: ✭ 49 (-95.38%)
Mutual labels:  dependency-injection
Gulp Di
gulp-di is a dependency injection framework for the Gulp streaming build system.
Stars: ✭ 40 (-96.23%)
Mutual labels:  dependency-injection

Toothpick (a.k.a T.P. like a teepee)







Visit TP wiki !

What is Toothpick ?

Toothpick is a scope tree based Dependency Injection (DI) library for Java.

It is a full-featured, runtime based, but reflection free, implementation of JSR 330.

What does Toothpick offer ?

//a typical Toothpick scope tree during the execution of an Android app.

           @ApplicationScope 
             /          |    \  
            /           |     \
           /            |      \
   @ViewModelScope      |   Service 2
         /              | 
        /            Service 1  
       /            
 @Activity1Scope
      /
     /
Activity 1
   /   \
  /   Fragment 2
 /
Fragment 1

Scopes offer to compartmentalize memory during the runtime of an app and prevent memory leaks. All dependencies created via Toothpick, and available for injections, will be fully garbage collected when this scope is closed. To learn more about scopes, read TP wiki.

Toothpick is :

Examples

This is the example:

Setup

The latest version of TP is provided by a badge at the top of this page.

For Android :

#android setup using gradle 5.5.1
buildscript {
  repositories {
    google()
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.4.x'
  }
}

...
#for java
dependencies {
  implementation 'com.github.stephanenicolas.toothpick:toothpick-runtime:3.x'
  // and for android -> implementation 'com.github.stephanenicolas.toothpick:smoothie-androidx:3.x'
  annotationProcessor 'com.github.stephanenicolas.toothpick:toothpick-compiler:3.x'

  //highly recommended
  testImplementation 'com.github.stephanenicolas.toothpick:toothpick-testing-junit5:3.x'
  testImplementation 'mockito or easymock'
}

#for kotlin
dependencies {
  implementation 'com.github.stephanenicolas.toothpick:ktp:3.x'
  kapt 'com.github.stephanenicolas.toothpick:toothpick-compiler:3.x'

  //highly recommended
  testImplementation 'com.github.stephanenicolas.toothpick:toothpick-testing-junit5:3.x'
  testImplementation 'mockito or easymock'
}

For java:

<!--java setup with maven -->
  <dependencies>
    <dependency>
      <groupId>com.github.stephanenicolas.toothpick</groupId>
      <artifactId>toothpick-compiler</artifactId>
      <version>3.x</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.github.stephanenicolas.toothpick</groupId>
      <artifactId>toothpick-runtime</artifactId>
      <version>3.x</version>
      <scope>compile</scope>
    </dependency>
    
    <!-- highly recommended-->
    <dependency> 
      <groupId>com.github.stephanenicolas.toothpick</groupId>
      <artifactId>toothpick-testing</artifactId>
      <version>3.x</version>
      <scope>test</scope>
    </dependency>
    <dependency>
    <easymock or mockito>
    </dependency>
  </dependencies>

Support

TP is actively maintained and we provide support to questions via the Toothpick-di tag on Stack Over Flow.

Ask questions on Stack Over Flow while keeping the GitHub issue board for real issues. Thx in advance !

Talks & Articles

Wanna know more ?

Visit Toothpick's wiki !

Alternative Dependency Injection (DI) engines for Android

Libs / Apps using TP 2

  • Okuki is a simple, hierarchical navigation bus and back stack for Android, with optional Rx bindings, and Toothpick DI integration.
  • KotlinWeather is a simple example of using ToothPick with Kotlin and gradle integration using kapt.

Credits

TP 1 & 3 have been developped by Stephane Nicolas and Daniel Molinero Reguera. Most of the effort on version 2 has been actively supported by Groupon. Thanks for this awesome OSS commitment !

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].