Tag: spring
-
How to implement Reactive Programming in Spring Boot?
Programming comes in different paradigms. For long , we did procedural programming using languages like C where the business logic was executed step by step in a procedural manner. Then came Object Oriented Programming where you modeled your business requirement into domain objects. It represented real world more closely and has been quite successful even…
-
How to deal with optional request parameters in Spring Boot?
Let’s say you are creating a REST API in Spring Boot which accepts request parameters. You use the annotation @RequestParam to retrieve the request values. And if user does not supply the request parameter Spring will throw error. What if the request parameter is just an optional parameter? How to handle this in Spring ?…
-
How to interpret and modify REST requests in Spring Boot in a centralized way?
Let’s say you have created a bunch of REST services in your Spring Boot app. And you want to perform a common action on all the requests. May be you want to log the incoming requests to a log file. Instead of doing this action for every REST service you can do it in a…
-
How to invoke a REST service protected by BasicAuth using Spring Open Feign?
Invoking REST services from Spring is much easier if you use Spring Open Feign. It allows you to invoke REST services declaratively and saves a lot of code. Here is the post explaining the basic concept of Open Feign: How to call a REST service declaratively using Open Feign? It is a very simple example…
-
How to call a REST service from Spring declaratively using OpenFeign?
If you are using Spring, you are probably using Rest Template provided by Spring to invoke third party REST services. That involves some code , preparing the REST template , populating the parameters required for one of the methods exposed by the REST template and finally invoking one of its specific methods. What if you…
-
How to delete records in Spring Data based on multiple field values?
Spring Data has made it so easy to deal with database. Most boiler plate code are removed and user can just concentrate on the business logic. Here is a simple way to delete records using multiple field values from a relational database table . STEP 1: Prepare your entity which corresponds to the table. Write…