Two Laptop Bag*
The moose likes Spring and the fly likes How to intoduce Spring into my sample application for practice? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to intoduce Spring into my sample application for practice?" Watch "How to intoduce Spring into my sample application for practice?" New topic
Author

How to intoduce Spring into my sample application for practice?

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 541
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
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
134

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 541
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
134

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

Joined: Jul 07, 2012
Posts: 541
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

Joined: Jul 07, 2012
Posts: 541
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to intoduce Spring into my sample application for practice?
 
Similar Threads
sending parameter from one controller to other
Spring and Hibernate
session isnew()
Good and up-to-date Spring tutorial
Spring Web Flow 2 Web Development