• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

How to intoduce Spring into my sample application for practice?

 
Ranch Hand
Posts: 2625
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have built a small application just for Practice. The user logs in using username and password and if he is a valid user, he can enter a keyword and it fetches records for that keyword. This I have done using Struts1.Now for practice I want to introduce Spring here. What can be a way to include spring here just for practice.Spring IOC or any other component of Spring but I am not able to think of an example of how to include spring here for practice.Please suggest.

Thanks
 
author & internet detective
Posts: 41502
881
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See web integration and the section on Struts 1. This gets your actions to be in a Spring container.

As far as how to use Spring for practice - look for the keyword "new" in your code. Those are opportunities to inject a bean. Look for duplication. Those are opportunities for AOP. Look for JDBC code. These are opportunities for JdbcTemplate.
 
Monica Shiralkar
Ranch Hand
Posts: 2625
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks.new operator is used immensely in the application.E.g even for creation of Array list. List temp=new ArrayList(). Should even such objects be created from IOC?If no then which one to create
 
Jeanne Boyarsky
author & internet detective
Posts: 41502
881
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. ArrayLists make sense to create using "new". I was thinking of your objects (which could be other Spring beans.) For example, your action calls some other object to do business processing or access the database or ...
 
Monica Shiralkar
Ranch Hand
Posts: 2625
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I think anything which holds state should be avoided.


For example, your action calls some other object to do business processing ...



I think you mean Business Delegate design pattern.?

 
Monica Shiralkar
Ranch Hand
Posts: 2625
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To add spring IOC to my Practice web application I could think of the below use case. Please tell whether it is a proper use of Spring IOC:

- I am displaying a message on my web application "This is version 1 of application" or "This is version 2 of application". Instead of hard coding the message I am using Spring IOC and setting it using the Setter message and it can be changed dynamically by changing in the beans Xml.

Is is a proper use of IOC (for practice) ? My aim is just to add sample IOC functionality to my application just for practice.

thanks
reply
    Bookmark Topic Watch Topic
  • New Topic