AWS S3 with Java

In this tutorial, we’ll learn how to interact with the Amazon S3 (Simple Storage Service) storage system programmatically, from Java.

Remember that S3 has a very simple structure — each bucket can store any number of objects which can be accessed using either a SOAP interface or a REST-style API.

Going forward, we’ll use the AWS SDK for Java to create, list, and delete S3 buckets. We’ll also upload, list, download and delete objects within these buckets.

Image Compress JPG and PNG file

Registering a SQL function with JPA and Hibernate

Registering a SQL function with JPA and Hibernate

Lambda Expressions best Practices Example

Lambda Expressions best Practices Example

More updates on GitHub

Permutation of String in Java Algorithm

Covert String to byte array

We can use String class getBytes() method to encode the string into a sequence of bytes using the platform’s default charset. This method is overloaded and we can also pass Charset as argument.
Here is a simple program showing how to convert String to byte array in java.

Ignore case while find query using Mongodb.

Use This Criteria

How to add CORS with Spring?

1st Example For All Location

2nd Example For Validate which location and which method to allow

How To Register Multiple Interceptor In Spring MVC?

Create Configuration Class extends with WebMvcConfigurerAdapter

Log4j Multiple Appender Simple Example in java

# Root logger option
log4j.rootLogger=INFO, DEBUG, file,console

# Console Appender
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Append=true
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-ddHH:mm:ss,SSS} %-5p [ %M ] ( %C ) %c{1}:%L - %m%n

# File Appender
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.DatePattern='.'yyyy-MM-dd-HH-mm
log4j.appender.file.Append=true
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-ddHH:mm:ss,SSS} %-5p [ %M ] ( %C ) %c{1}:%L - %m%n
log4j.appender.file.File=C:/log/SpringMain.log
log4j.appender.file.MaxBackupIndex=10