WireBox : Dependency Injection & AOP
7.x
7.x
  • Introduction
    • Contributing Guide
    • Release History
      • What's New With 7.2.0
      • What's New With 7.1.0
      • What's New With 7.0.0
    • Upgrading to WireBox 7
    • About This Book
      • Author
  • Getting Started
    • Overview
    • Installing WireBox
    • Getting Jiggy Wit It!
      • Instance Creations
      • Binder Introduction
      • Scoping
      • Eager Init
      • How WireBox Resolves Dependencies
    • Migrating From ColdSpring
  • Configuration
    • Configuring WireBox
      • Binder Configuration Properties
      • Binder Environment Properties
      • ColdBox Enhanced Binder
      • Types & Scopes
      • Data Configuration Settings
      • Programmatic Configuration
    • Mapping DSL
      • Mapping Initiators
      • Mapping Destinations
      • MapDirectory() Influence & Filters
      • Persistence DSL
      • Dependencies DSL
        • Mapping Extra Attributes
      • Mapping DSL Examples
      • Influence Instances at Runtime
      • Processing Mappings
    • Component Annotations
      • Persistence Annotations
      • CacheBox Annotations
    • Parent Object Definitions
  • Usage
    • WireBox Injector
      • Injector Constructor Arguments
      • Injection Idioms
      • Common Methods
    • Injection DSL
      • ColdBox Namespace
      • CacheBox Namespace
      • EntityService Namespace
      • Executor Namespace
      • Java Namespace
      • LogBox Namespace
      • Models Namespace
      • Provider Namespace
      • WireBox Namespace
    • WireBox Delegators
    • WireBox Event Model
      • WireBox Events
      • WireBox Listeners
        • ColdBox Mode Listener
        • Standalone Mode Listener
  • Advanced Topics
    • Child Injectors
    • Lazy Properties
    • Object Persistence & Thread Safety
    • ORM Entity Injection
    • Providers
      • Custom Providers
      • toProvider() closures
      • Virtual Provider Injection DSL
      • Virtual Provider Mapping
      • Virtual Provider Lookup Methods
      • Provider onMissingMethod Proxy
      • Scope Widening Injection
    • Property Observers
    • Runtime Mixins()
    • WireBox Object Populator
      • populateFromXML
      • populateFromQuery
      • populateFromStruct
      • populateFromQueryWithPrefix
      • populateFromJSON
    • Virtual Inheritance
  • Extending WireBox
    • Custom DSL
      • The DSL Builder Interface
      • Registering a Custom DSL
    • Custom Scopes
      • The Scope Interface
      • Scoping Process
      • Registering a Custom Scope
    • WireBox Injector Interface
  • Aspect Oriented Programming
    • AOP Intro
      • Overview
        • AOP Vocabulary
      • Activate The AOP Listener
      • Create Your Aspect
        • MethodInvocation Useful Methods
        • MethodLogger Aspect
      • Aspect Registration
      • Aspect Binding
      • Auto Aspect Binding
        • ClassMatcher Annotation DSL
        • MethodMatcher Annotation DSL
      • Included Aspects
        • CFTransaction
        • HibernateTransaction
        • MethodLogger
      • Summary
Powered by GitBook
On this page
  • Dependency Injection Explained
  • Advantages of a DI Framework
  • Features at a Glance
  • WireBox RefCard
  • Useful Resources

Was this helpful?

Edit on GitHub
Export as PDF
  1. Getting Started

Overview

What is dependency injection?

PreviousAuthorNextInstalling WireBox

Last updated 1 year ago

Was this helpful?

Dependency injection is the art of making work come home to you. Dhanji R. Prasanna

WireBox alleviates the need for custom object factories or manual object creation in your ColdFusion (CFML) applications. It provides a standardized approach to object construction and assembling that will make your code easier to adapt to changes, easier to and extend.

As software developers we are always challenged with maintenance and one ever occurring annoyance, change. Therefore, the more sustainable and maintainable our software, the more we can concentrate on real problems and make our lives more productive. WireBox leverages an array of metadata annotations to make your object assembling, storage and creation easy as pie! We have leveraged the power of event driven architecture via object listeners or interceptors so you can extend not only WireBox but the way objects are analyzed, created, wired and much more. To the extent that our capabilities are all driven by our AOP listener which decouples itself from WireBox code and makes it extremely flexible.

Dependency Injection Explained

Advantages of a DI Framework

Compared to manual Dependency Injection (DI), using WireBox can lead to the following advantages:

  • You will write less boilerplate code.

  • By giving WireBox DI responsibilities, you will stop creating objects manually or using custom object factories.

  • You can leverage object persistence scopes for performance and scalability. Even create time persisted objects.

  • You will not have any object creation or wiring code in your application, but have it abstracted via WireBox. Which will lead to more cohesive code that is not plagued with boilerplate code or factory code.

  • Objects will become more testable and easier to mock, which in turn can accelerate your development by using a TDD (Test Driven Development), BDD (Behavior Driven Development) approach.

  • Once WireBox leverages your objects you can take advantage of AOP or other event life cycle processes to really get funky with OO.

Features at a Glance

Here are a simple listing of features WireBox brings to the table:

  • Annotation driven dependency injection

  • 0 configuration mode or a programmatic binder configuration approach via ColdFusion (No XML!)

  • Creation and Wiring of or by:

    • ColdFusion Components

    • Java Classes

    • RSS Feeds

    • WebService objects

    • Constant values

    • DSL string building

    • Factory Methods

    • Providers

  • Multiple Injection Styles: Property, Setter, Method, Constructor

  • Automatic Package/Directory object scanning and registration

  • Multiple object life cycle persistence scopes:

    • No Scope (Transients)

    • Singletons

    • Request Scoped

    • Session Scoped

    • Application Scoped

    • Server Scoped

    • CacheBox Scoped

  • Parent Factories

  • Factory Method Object Creations

  • Object life cycle events via WireBox Listeners/Interceptors

  • Customizable injection DSL

  • WireBox object providers to avoid scope-widening issues on time/volatile persisted objects

WireBox RefCard

Useful Resources

We have also seen the value of a central location for object configuration and behavior so we created our very own WireBox Programmatic Mapping DSL () that you can use to define object construction, relationships, AOP, etc in pure ColdFusion (No XML!). We welcome you to stick around and read our documentation so you can see the true value of WireBox in your web applications.

We have released one of our chapters from our course that deals with getting started with Dependency Injection, the problem, the benefits and the solutions. We encourage you to download it, print it, share it, digest it and learn it:

If you require any training please .

Integrated caching via , scale your objects and metadata

Integrated logging via , never try to figure out what in the world the DI engine is doing

Our Wirebox RefCard will get you up and running in no time

Domain Specific Language
CBOX202: Dependency Injection
http://ortus-public.s3.amazonaws.com/cbox202-unit1-3.pdf
contact us
CacheBox
LogBox
Aspect Oriented Programming
Standalone ORM Entity Injection
http://code.google.com/p/google-guice
http://www.manning.com/prasanna/
http://en.wikipedia.org/wiki/Aspect-oriented_programming
http://en.wikipedia.org/wiki/Dependency_injection
http://en.wikipedia.org/wiki/Inversion_of_control
http://martinfowler.com/articles/injection.html
http://www.theserverside.com/news/1321158/A-beginners-guide-to-Dependency-Injection
http://www.developer.com/net/net/article.php/3636501
http://code.google.com/p/google-guice/
test, mock
AOP