Categories
Java

Kafka Spring Boot Example of Producer and Consumer

Apache Kafka is open-source and widely used software for event stream platform. It is mainly used for service integration, data integration, creating data pipelines and real-time data analytics, and many. You can get more details from here Apache Kafka. For development, it has libs for almost every development platform. In this post, I am going […]

Categories
Java

Spring Boot Upload File to S3 Asynchronously

In Spring Boot uploading files to S3 can be implemented using the REST API POST/PUT method very easily. This can be implemented using Spring WebMVC and was s3 SDK. I this example I used the following dependencies using Gradle. Gradle dependencies Spring boot config for async upload file to AWS S3 We need to define […]

Categories
Java

Extract and Strip Text From PDF in Java Example

Extracting text from a pdf file using Java is quite easy using the Apache PDFBox Java library. This library provides PDFTextStripper class which is used to strip text from PDF files. This library can be included using Gradle, maven, and other builds systems from the Maven repository. Gradle dependency: Maven dependency: Example to Extract text […]

Categories
Java

Adding Watermark to PDF using Java

Adding a text-based watermark to existing PDF using Java is quite simple using the Apache PDFBox opensource free library. This library is very handing and can be used to create new PDF and modify existing files. This can be easily added to maven and Gradle based projects by adding the following reference. Gradle dependency: Maven […]

Categories
Java

Rest Client For Java using HttpClient and Jakson

There are many HttpClient and Rest Clients lib is available for Java developers. The most common is Spring Rest Template for REST client and Apache HttpClient a generic HTTP client. I personally like the Apache HttpClient library for making REST calls and Http Calls. I found one generic kind of REST client using Apache HttpClient […]

Categories
Java

Java HttpClient POST, PUT and Patch Example with Body

Java HttpClient library from Apache is very good, it provides many interfaces to perform different operations like  POST, PUT, and PATCH. One can also send String or URI encoded form and another payload very easily using the HttpEntity interface. You can easily add query strings and custom headers. To post JSON string, XML, or simple […]

Categories
Java

HttpClient Java Get Example with Query String and Custom Headers

Apache HttpClient java library is my most preferred HttpClient library for making HTTP requests. One can easily add parameters, body, and custom headers with clean interfaces. Since version 4.0 it also provides EntityUtils to read the response from HttpResponse into string and byte arrays. Here is a complete example to make get requests with parameres […]

Categories
Java

Connection Timeout In Java HTTPClient, RestTemplate and URLConnection

Connection timeout is the time for which an HTTP client or Socket client waits, if the server doesn’t respond in that time or not found then the client closes the connection. HTTP also uses sockets internally. Connection timeout is different from the Connection Request timeout or connection read timeout. In many situations, the client doesn’t […]

Categories
Java

Best Libraries for Working with CSV in Java

Reading and writing CSV in Java can be very simple by the use of some well known and stable CSV library. One can write CSV using core java classes very easily for reading CSV can be problematic as there are many variations in CSV. CSV is one of the most common data formats for exporting […]

Categories
Java

SpotBugs Static Analysis Tool For Java Developers

SpotBugs is a software tool for static analysis of Java programs, which is free to download, use,  open-source and can be used in various ways. It can be installed as Eclipse Plugin, configured with Maven build as plugin and Gradle builds as a plugin. It is very handy while being used as an Eclipse plugin […]