With traditional Java/Spring web apps, I've historically used an JEE architecture where there's a domain tier and a web tier. The web tier mostly contains web controllers. The domain tier includes entities, data access objects (or repositories in Spring Data parlance), and transactional services.Lately I've been building more apps that incorporate external web services: sometimes as data sources, sometimes as providers of some service that my app needs.Currently I incorporate these web services by invoking them from the service tier. That way the web controllers don't have to handle them. (I like to treat web controllers as thin adapters between domain services and HTTP.)I wonder however whether there are better approaches.I like the idea of keeping the service tier responsible for managing the app's internal resources, as opposed to also incorporating external resources. Here maybe I could handling integration of internal and external resources above the service tier (but below the web tier).Either that, or else use the service tier to handle integration concerns, but separate the strictly internal resources from the other ones. Basically treat the internal/external distinction as an implementation detail that we hide behind the service interface.I'm sure there are other approaches too. Interested to hear about them and associated pros/cons.
Incorporating external web services in Java/Spring web app
java;architecture;web applications;web services;spring