[JBoss-user] [Microcontainer] - Re: How to access beans created by the bootstrap

2005-12-22 Thread belaran
I know this thread is now old and that I haven't post anything but my work took 
me away from JBoss Microcontainer for a while But finally, I understand 
what Adrian meant in his examples, and why there is no "getBean()". The whole 
idea is quite simple, but given the fact that I had hard time with it, maybe 
other will, so i'll explain here what i finally understood.

Basicly my question was "how can i get my bean from the bootstrap in a simple 
"main' program ?" . In a small spring app, i would have done this :

  | public class MyApp
  | {
  |   public static void main(String[] args)
  |   {
  | ...
  | Component comp = context.getBean("component');   
  |   }
  | }
 

When i look at JBoss Container documentation and examples, i was looking for 
this kind of behavior. A method to call, something where my program could 
actually use the 'created bean'. And there I was wrong. As Adrian stated, the 
use of a '.getBean' method ruins the all concept of IoC as it tie the program 
to a specific API ( in this case Spring API). 

I agreed ( and i still agree) but i didn't see how to do without it, even when 
i look into the example. Then, it finally struck me ( i  know, i know i'm quite 
slow) : There is actually no need for my program to get beans from the 
microcontainer as my program is another bean managed by the container. At the 
bootstrap , the microcontainer will create my program and execute its 
initialisation method ( or simply its constructor) and there the program 
actually start. So there is no 'main', no need to actually get the bean for the 
program. The progam is a POJO and its dependancies are resolved by the 
container !
We simply launch the bootstrap instead of the program.

Now this all seems so clear, i almost feel stupid...  : / 
I hope that this post will help other, stuck in the same misconception... ( 
otherwise this post will simply be another public humiliation).

Thanks again Adrian !






 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3913975#3913975

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3913975


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Microcontainer] - Re: How to access beans created by the bootstrap

2005-11-03 Thread belaran
"[EMAIL PROTECTED]" wrote : 
  | "Don't tie yourself to a spec defined locator, use our proprietary api 
instead?" :-)
  | 

: D 

Thanks ! I'll watch the code, the two link your provided me should be enough if 
i'm not too dumb...

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3905089#3905089

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3905089


---
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Microcontainer] - Re: How to access beans created by the bootstrap

2005-11-02 Thread belaran
First of all, thanks you Adrian for all your response. Sorry I didn't reply 
sooner.

About doing a Spring facade, i believe that will be a great idea but I don"t 
know if I got what it's take to do it. I'm still pretty new to all this and the 
person(s) doing this job should be very good with both IoC Framework. However, 
I'll consider the challenge...

anonymous wrote : I strongly discourage this usage. It defeats the whole point 
of IOC. 

I agree completly with you. The method "getBean' is, the way I see it, just a 
way to make test while trying the Spring framework...

However, while doing my research an Spring and Hivemind, i found a lot of 
critics against the use of JNDI locator, which tends to tie the webApp to the 
locator, making portability and unit test not simple [ that is what i read,not 
an opinion ].

So let's say for the purpose of the exercice that we agree that Locator is not 
an option, how can we get back the Bean from the Microcontainer ?


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3904840#3904840

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3904840


---
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Microcontainer] - How to access beans created by the bootstrap

2005-10-31 Thread belaran
Hi,
I come from the Spring world ( please don't throw tomatoes to my face : ) !  ). 
I read the microcontainer getting started. I can see that most features of the 
spring core are reproduced here and i read the xml configurations quite easily. 
However i have hard time understand just one thing. 
Once  I call the  StandaloneBootstrap().bootstrap(), wich basicly parses the 
XML file and creates the proper beans, how can I get a reference to those beans.

In the Spring framework, i add a static method such as :

   ApplicationContext cxt = new 
FileSystemXmlApplicationContext("config.xml");
cxt.getBean("myBean");

But i didn"t see anything like this in the 'A Guide For POJO developpers' , 
neitheir in the example... How can get back my instanciated bean ?

I hope that my question isn't too silly...

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3904433#3904433

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3904433


---
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user