Search |
|||
Bruno Ghisi's blogDIME - Dependency Injection for Java MEPosted by brunogh on April 27, 2010 at 3:55 PM PDT
My masters colleague, Guilherme Hobold, and his friend, Elinton Machado, have created a very interesting project for helping Java ME applications with dependency injection. Actually, it is not only for Java ME (CLDC), but because of there is no reflection, they have done some magic to make it work in a nice way. Make a bean:
»
Comments
Comments are listed in date ascending order (oldest first)
DIME Vs Spring ME
Submitted by guicoan on Thu, 2010-04-29 16:26.
Hi,
You are right about Spring ME. But DIME is really different about Spring ME. The objectives are the same, both provide Dependency Injection to the J2ME platform. When using Spring ME you must have a Maven plugin to generate the BeanFactory in compilation time. Even when using DIME, the only thing you have to do is configure your XML and pass it to the BeanContainer. So the BeanContainer will read the XML file in execution time. The BeanFactory from Spring ME is genereted like this:
public class BeanFactory { public Object getBean(String name){ if ("movieFinder".equals(name)){ return getMovieFinder(); } } public final Object getMovieFinder(){ .. } } There will be one if condition inside getBean method for each bean you have in your XML file. So the XML file is loaded and the BeanFactory class is generated before you generate your distributed package. Beyond that DIME offers more beans attributes in XML file like scope and lazy. The first one allow you to create beans that are singletons or beans that are created every time you call getBean(). The lazy attribute tells the container if the bean must be created as soon as XML file is loaded. To finish, I think DIME is more flexible and easy to use when comparable with Spring ME. That`s it. Cheers, Guilherme Hobold. |
Recent EntriesCategoriesArchives |
||
|
Spring ME