File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Suggestions for Web as well as stand alone Spring application in one project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Suggestions for Web as well as stand alone Spring application in one project" Watch "Suggestions for Web as well as stand alone Spring application in one project" New topic
Author

Suggestions for Web as well as stand alone Spring application in one project

Shailesh Welankar
Ranch Hand

Joined: Dec 30, 2002
Posts: 35
Friends,

I have worked on separate web vs stand-alone Spring applications, never both together in one project.

Now a business need has come up that requires to have both the Web (Web Services) related part and the stand-alone application in Spring to reside in the same project (CVS repository as well as Eclipse).

The WS app is a small one and uses may be 30% of the total DAOs, Service classes and other configs in the common code for both apps. I have tested the web app(along with the Web Services) and it works fine with the web.xml configured to call the 'contextLoaderServlet' on startup. I will require a lot of code change for the stand-alone related bean initializations and access if I combine the two projects and will need to write separate bean access and loading code anyways.

Has anyone combined such two projects? What are your suggestions on the approach for this? All suggestions are welcome !!
[ November 06, 2008: Message edited by: Shailesh Welankar ]

--Shailesh Welankar
SCDJWS 1.4 | SCBCD 5.0 | SCWCD 1.4 | SCJP 1.4 | Preparing for SCEA 5
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I wouldn't combine the projects, I'd pull the common parts out into a common project and have the web service and the stand alone app depend on the common project.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I would not combine the projects myself either. But if you are forced to, which will be a bad idea, then you will be required to make two different build paths. One that builds your web version, and one that builds your stand alone. Each will need to copy different xml configuration files for Spring. You will need to make sure you really separate your configuration file, so that you can pick up just what you need in the build.

It also sounds like you will also need to put logic into your build so that you only pick up the classes that is needed for each project.

It really isn't a good way to go about this.

Good Luck.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Shailesh Welankar
Ranch Hand

Joined: Dec 30, 2002
Posts: 35
Thanks Mark and Nate for your valuable suggestions.

Yes, I can understand why it would be prudent to implement the two projects separately instead of combining them. Will see how that goes with the "higher-ups". If I have to go with the combined approach, will separate them internally to the project so that building them (I use ANT scripts to generate the WAR and JAR files needed as distros) will be easier and the project will still be under one name.

thanks all for the suggestions !!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Suggestions for Web as well as stand alone Spring application in one project
 
Similar Threads
Finally Got the II & III SCORE (97%)
How to programmatically stop an application mid-way in its start process
Integration of GUI's
EJB Access from Stand Alone Application in WSAD
Spring Usage