Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > HTTP (WWW)

    Butterfly Container 3.0.0

    Download button

    No screenshots available
    Downloads: 619  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Good (3.4/5)
    26 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Jakob Jenkov | More programs
    The Apache License 2.0 / FREE
    August 5th, 2009, 15:57 GMT [view history]
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    Butterfly Container description

    A dependency injection container

    Butterfly Container is a dependency injection container. Butterfly Container is a smaller, yet more flexible and easier to use than Spring, Pico and Guice. Instead of XML Butterfly Container is configured using a simple, flexible, Java-like configuration language.

    The Elegant Java Dependency Injection Container.

    Butterfly Container was initially developed as a lightweight alternative to Spring. Granted, there was already Pico Container but it has its own rough edges. Later came Guice, but it too has a few quirks.

    Though Spring is reasonably straightforward to configure, it is a large framework by now. It takes an effort to know that to include and not to include of its dependencies. In addition its XML configuration files are verbose, tedious to write and not too easy to read.

    Simpler, Java-like Configuration

    Butterfly Container started out with a simpler XML configuration file format than Springs. This was soon abandoned since it was too inflexible. Instead a Java-like configuration script language was invented, called Butterfly Container Script. As you will see, this script language is a much simpler way to configure a DI container, than the mechanisms used by Spring, Pico and Guice. Here is a simple example:

    myBean1 = * com.jenkov.MyBean(); /* simple instantiation*/
    myBean2 = * com.jenkov.MyBean(myBean1); /* constructor injection*/
    myBean3 = * com.jenkov.MyBean(myBean2)
    .setExtraBean(myBean1); /* constructor + setter injection */

    Doesn't that look at lot more like Java code than Springs XML config files? It is quite easy to decipher the factory definitions. The MyBean class is just an example. It could be any Java class you like.

    More Flexible Configuration

    Along with the configuration script language came a lot of nice, very flexible features.

    How about extending an existing factory definition? Here is how simple that is:
    myBean1 = * com.jenkov.MyBean(); /* simple instantiation*/
    myBean2 = myBean1.setValue("Some Value"); /* factory extending myBean1 */

    Extending existing factory definitions makes it possible to get rid of close to redundant factory definitions.

    Or what about allowing a factory to take input parameters? Here is how:
    myBean1 = * com.jenkov.MyBean(); /*simple instantiation*/
    myBean2 = myBean1.setValue($0); /*inject input parameter */
    myBean3 = myBean2("Parameter Value"); /*factory call with parameter*/

    Can you do this with Spring, Pico or Guice?

    Still the Lightest

    The new, more flexible and advanced configuration language did not make Butterfly Container heavier (in fact it simplified the internal design). With a less than 70 kb JAR file Butterfly Container is still the lightest Java dependency injection container around.

    Yet Complete

    Even if Butterfly Container is the lightest Java DI container around, it still supports most, if not all, DI features offered by Spring, Pico and Guice. For instance:

    · Constructor Injection
    · Method Injection (Static + Instance)
    · Factory Injection
    · Instance Life Cycle Management
    · New / Singleton
    · Thread Singletons
    · Local, Anonymous Factories

    Butterfly Container also has a few unique features:
    · Method Chaining on Methods Returning Void
    · Adaptation to Custom Factory Interfaces
    · Flyweights


    Product's homepage

    Requirements:

    · Java 2 Standard Edition Runtime Environment

    What's New in This Release: [ read full changelog ]

    · This version brings easy Map configuration and the ability to assign names to the input streams from which you read container scripts.
    · This name is used when an error is detected in the script, making it easier to find out the file in which the error occurred.
    · It is now also possible to have the ScriptFactoryBuilder close the script input stream for you.
    · This version also fixes a minor bug related to parsing and error messages.

      


    TAGS:

    dependency injection | injection container | Java library | dependency | injection | container

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM