I am working on a Springboot project where i need to consume lot of rest APIs. The current project folder structure has a Controller, Model, Service, Dao and Util packages.
-The Util package has a Scheduler, that calls the Service module. -The Service module will then call REST API of a different application and based on result will save data by calling DAO layer.
My doubt is "The part where the service layer method calls rest api". Do i need to place that code logic in a different class called RestClient.java ? If yes then should that class be a part of service package itself or i need to create a different pacakge?
There is no constrained package structure. Actual structure will be driven by your requirement and directory structure is laid by build-tool / IDE.
but here is my recommendation in your service
package you can have provider
andconsumer
package from where provider
packages can have services which will be called by your rest controllers and consumers
can have service which will call other application services.
Or You can simple have restclients
package like services from where you can define your consumers
services to just separate out your package structure to distinguish your rest client services.