facebook

Best practice for managing code in web service situation?

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #320372 Reply

    Greg Soulsby
    Member

    Finally I have restful web services working. An Object of a particular Class is passed back and forth, Working great, love the structure it gives. Great.

    I do have a small worry however – the Class has to be defined at both ends. So I find myself copy and pasting the Class between the web apps.

    Is there a way to have share one definition of a class across multiple web apps? I can see a day lost in the future due to a bug which is simply the 2 versions of the class getting out of synch accidentally.

    #320374 Reply

    support-swapna
    Moderator

    P0rridge ,

    You can create a new project with common code and set the project as dependent project to other projects which need it.

    Here is a tutorial which explains on how to work with dependent projects in Web and EAR projects :

    http://www.myeclipseide.com/documentation/quickstarts/webprojects/#advanced_features
    http://www.myeclipseide.com/documentation/quickstarts/earprojects/#advanced_features

    Let us know if how it helps you.

    #320732 Reply

    Greg Soulsby
    Member

    Ok, I have started that, have Parent project link to Child projects. This is giving access to the Parent classes in Child project.

    When I scaffolded the Child project, I deselected all the library classes at the point were it asks if they should be copied in or you want to refer to the MyEclipse version – I hoped they would be picked up from the parent project when I made the dependency. But that is not happening – getting not found on something like

    import org.springframework.dao.DataAccessException;

    I can add the /lib of the parent into the classpath of the child project by hand, but I fear that would break once we build the war files and deploy?

    Can I use in Parent /lib/* in the Child project in a way that wont break when deployed?

    Greg

    #320762 Reply

    Greg Soulsby
    Member

    Actually, I over estimated even my simplest capabilities

    I cant link from the child to the /lib in the parent. Or the classes required for things like DataAccessException are not in /lib.

    In researching this I came across EAR projects – would one of those as the Parent help?

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Best practice for managing code in web service situation?

You must be logged in to post in the forum log in