Tag: Java

  • Java Disable HTTPS Certificate Validation

    While working with HTTP clients in java, many times we get a certificate validation exception as given below. Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target The above exception can be caused due to a self-signed certificate or expired certificate as the client is unable to…

  • How to Write MySql Junit Tests?

    MySql is the most used open-source RDBMS in the world with different application development stacks. As nowadays most of the development of the system is TDD based, so for writing test cases for the MySql database will require running DB or we can use H2 database with MySql mode or we can even use Embedded…

  • Postgres JDBC and Hibernate Using JSONB Type

    While working with Postgres JSONB type and Java, if we assign the value of type UUID as a string then we will get the following exception. To assigning value incorrect way is given below, if you are using PreparedStatement. First, in the query, you need to write input param par as given below for the…

  • How to write Java Postgres JDBC JUnit Test

    Postgres is one of the leading open-source RDBMS for developing applications using Java. As now development involves more and more TDD, we need to write Junit tests that can run independently on any build environment without the dependency on any required Database engine. For the Postgres database, I found one very handy Java lib that…

  • How to validate UUID String in Java

    Many times we are supposed to get a string and that should be a valid UUID or GUID. Unfortunately Java UUID class don’t provide any function to validate whether a string is valid UUID or not. In many places, you will see to use the UUID java class function fromString, if any exception then the…

  • Kafka Spring Boot Stateless Stream Processing

    Kafka Spring Boot  Stateless Stream Processing

    Kafka Streams is a client library that is used to process a stream of messages on a topic and either store it within Kafka or send it to some other Kafka topic. One can check complete documentation of Kafka Streams. In Kafka Stream, I will show with one example, how one can use Spring boot…

  • Kafka Spring Boot Example of Producer and Consumer

    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…

  • 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…

  • 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…

  • 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…