lundi 23 mars 2015

Spring Custom Property Editor Between Two MVC Projects

I have two Spring WebMVC projects, Project1 and Project2. The service layer in Project1 calls the web service endpoints from the controller in Project 2 (see diagram below). Project2, which has a database layer, returns the result to Project1 to display in the view.


Getting to my question... I want the controller in Project1 to register custom property editors so that an id returned from the view will automatically bind to a custom object. For example:



public String getName(@PathVariable("nameId") MyNameObject myNameObject,


The problem is that the Dao layer is not in Project1, it is in Project2.


If I were doing this setup in Project2, I would typically register the custom property editor in the controller and define the Autowired service, and that service will contain a findByNameId() method that accesses the Dao layer.


But, I want this setup in Project1, where there is no Dao layer. So, how do I setup custom property editor in Project1? Do I leverage the web services? What is typically done in this scenario?


enter image description here


Aucun commentaire:

Enregistrer un commentaire