Re: struts2+spring+hibernate, objects instantiate order?

2009-05-14 Thread Jim Kiley
1) is correct.  I can't tell you the number of times that, on app startup,
I've gotten reams and reams of error messages because Spring couldn't
instantiate some bean or another.2) is both -- which you could determine for
yourself pretty easily by putting a logging statement in the action's
constructor.

jk

On Wed, May 13, 2009 at 10:03 PM, ren sky  wrote:

> 1) before running my project, spring has already instantiate all the
> object defined in the applicationContext.xml?
>   such as LoginAction,PersonServiceImpl and sessionFactory?
> 2) the action  used in struts2 is instantiated before a request comes
> in? or is instantiated  when a real request comes in?
> 3) with spring,what is the role of struts2 ? it seems that the
> responsibility of instantiate object is changed to spring, not
> struts2.
>
> thanks.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com


Re: struts2+spring+hibernate, objects instantiate order?

2009-05-13 Thread Dave Newton

ren sky wrote:

1) before running my project, spring has already instantiate all the
object defined in the applicationContext.xml?
   such as LoginAction,PersonServiceImpl and sessionFactory?


Singletons probably are, sure.


2) the action  used in struts2 is instantiated before a request comes
in? or is instantiated  when a real request comes in?


Yes. IIRC Spring will try to instantiate objects on startup to make sure 
they can be instantiated as defined (I could be wrong about that).


Actions are definitely created per-request (assuming they're "prototype" 
scope, which they should be).



3) with spring,what is the role of struts2 ? it seems that the
responsibility of instantiate object is changed to spring, not
struts2.


Struts 2 is the web layer. You know, handling requests.

Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



struts2+spring+hibernate, objects instantiate order?

2009-05-13 Thread ren sky
hello everyone,
i am new to struts2.
i use struts2, spring2.5 and hibernate 3.3.1 to build a simple website.
and have some questions about the order of the objects instantiate.
here is my config file for spring:

-applicationContext.xml
    
    
    

    
    
    

    
    
    

    
    
...
...
    

    
    

    
-applicationContext.xml

and when i start the tomcat, before running my project,
i get the logs like this:

---log
contents
Loaded 6 bean definitions from location pattern
[/WEB-INF/applicationContext.xml]
..
6 beans defined in
org.springframework.web.context.support.xmlwebapplicationcont...@179dce4:
display name [Root WebApplicationContext]; startup date [Thu May 14
08:44:00 CST 2009]; root of context hierarchy
..
Pre-instantiating singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@6210fb:
defining beans 
[Login,personService,PersonDAO,sessionFactory,dataSource,ChartAction];
root of factory hierarchy
Creating shared instance of singleton bean 'personService'
Creating instance of bean 'personService'
Eagerly caching bean 'personService' to allow for resolving potential
circular references
Creating shared instance of singleton bean 'PersonDAO'
Creating instance of bean 'PersonDAO'
Eagerly caching bean 'PersonDAO' to allow for resolving potential
circular references
Creating shared instance of singleton bean 'sessionFactory'
Creating instance of bean 'sessionFactory'
Eagerly caching bean 'sessionFactory' to allow for resolving potential
circular references
Creating shared instance of singleton bean 'dataSource'
Creating instance of bean 'dataSource'
Eagerly caching bean 'dataSource' to allow for resolving potential
circular references

 ---log
contents

does that mean
1) before running my project, spring has already instantiate all the
object defined in the applicationContext.xml?
   such as LoginAction,PersonServiceImpl and sessionFactory?
2) the action  used in struts2 is instantiated before a request comes
in? or is instantiated  when a real request comes in?
3) with spring,what is the role of struts2 ? it seems that the
responsibility of instantiate object is changed to spring, not
struts2.

thanks.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org