Computers have been my hobby since I was 12. Now I'm a freelance Java developer. Like many other developers I am working on various private projects. Some are open source components (Butterfly Components - DI container, web ui, persistence api, mock test api etc.). Some are the tutorials at Yet others are web projects. I hold a bachelor degree in computer science and a master degree in IT focused on P2P networks. Jakob has posted 35 posts at DZone. You can read more from them at their website. View Full User Profile

Butterfly DI Container 3.0.0

  • submit to reddit

Version 3.0.0 contains support for using Butterfly Container as an internationalization mechanism for your application. You can internationalize (localize) both components, like... NumberFormatter's, and texts.

In other words, when you request an instance of an object from the container, the Locale associated with the  thread calling the container, determines what concrete instance / text is returned. 

It is now also possible to tell the script parser what character encoding your script files are written in. That makes it possible to write Butterfly Container Script files in UTF-16, so you can internationalize your app's with ease.


You can find Butterfly DI Container here:


With release 3.0.0 all majore planned features are now implemented. Butterfly DI Container is now every bit as advanced a dependency injection container as the IOC container found in Spring, Guice or Pico container. In some areas it even exceeds these containers, for instance in configuration flexibility and instantiation performance. In fact, the goal of Butterfly DI Container is to become more than just an object wiring mechanism. Butterfly DI Container is far along the way towards becoming a central integration unit for all resources (both classes and external resources). Yet Butterfly DI Container is still only about 100 KB in jar file size.


Future releases will focus on nice-to-have stuff like string templating, increased script parsing performance etc. For instance, it would be nice to be able to configure a string like this:


myString = *  "This is a string where I want something inserted here {0}";


And, when you obtain this string from the container you can have a value injected into the {0}. For instance, like this:

String theString = (String) container.instance("myString", "insert this");



Published at DZone with permission of its author, Jakob Jenkov.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)