Giter VIP home page Giter VIP logo

wired's Introduction

Wired

LOGO!

Part of the Dart Force Framework.

A library to do dependency injection! It uses the same annotations as in java spring applications.

Walkthrough

To bootstrap your injections call

ApplicationContext.bootstrap();

To configure your classes make a configuration class

@Config
class SomeConfig {

  @Bean
  Counter counter() {
    return new Counter();
  }

  @Bean
  Calc calc() {
    return new Calc();
  }

}

When you want to access an instance you can call

ApplicationContext.getBean("counter");

You can also define Components by using the @Component annotation

For the moment we only support set dependency injections and not constructor dependency injection.

Qualifier

You can use a Qualifier to give the bean a specific name, it is usefull when you want to configure 2 instances of the same class.

@Qualifier(name: "firstCounter")
@Bean
Calc calc() {
	return new Calc();
}

Values

You can add yaml values into your classes. First add them to the applicationContext. The first value is the key of the messages and the second value is the yaml content.

ApplicationContext.registerMessage("sentences", "sentence: Is this good?");

Register the messages before calling the method bootstrap of ApplicationContext.

You can add the @Value annotation into a scanned bean.

@Value("sentence")
String value;

You can also get a value from ApplicationContext, like follow:

ApplicationContext.getValue("sentence");

Order

With the @order annotation we can set the order of a configuration class.

@Config
@Order(2)
class ConfigComp { }

TODO

  • add posibility to add @Autowired in constructor values

Notes to Contributors

Fork Wired

If you'd like to contribute back to the core, you can fork this repository and send us a pull request, when it is ready.

If you are new to Git or GitHub, please read this guide first.

Dart Force

Realtime web framework for dart that uses forcemvc & forcemirrors & wired source code

Twitter

Follow us on twitter https://twitter.com/usethedartforce

Google+

Follow us on google+

wired's People

Contributors

jorishermans avatar luisvt avatar

Watchers

Daniel Varga-Hali avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.