SSLHandshakeException appear in logs when there is some error occur while validating the certificate installed in client machine with certificate on server machine. In this post, we will learn about fixing this if you are using Apache HttpClient library to create HttpClient to connect to SSL/TLS secured URLs.
We have already gone through the RestTemplate examples for accessing REST APIs inside spring application. In this example, we are extending the configuration to use Apache HttpClient 4. The purpose of this tutorial is to give you pre-cooked recipe for little head-start, and save you from writing all bits and pieces.
Simple quick to use examples to sort Map by values, using Java 8 Stream APIs, in ascending and descending (reverse) orders. In the center of logic is the method Map.Entry.comparingByValue() which compares Map.Entry in natural order on value. Sort Map by Values using Stream APIs In java 8, Map.Entry class has static method comparingByValue() to […]
Simple quick to use examples to sort a Map by key, using TreeMap and Stream APIs, in ascending and descending (reverse) orders.
Masking sensitive information is very practical need of applications which deal with sensitive customer data. For example, banking applications. When these applications run inside organization intra-net, many times UI logs are generated and stored on user’s machine for debugging purpose. In above scenario, it is regulatory requirement to mask all such sensitive informations so that […]
In java garbage collection tutorial, we will learn about object life cycle, difference between mark-sweep, mark-sweep-compact and mark-copy mechanisms, different single threaded and concurrent GC algorithms (e.g. G1), and various flags to control the gc algorithm’s behavior and log useful information for applications.
Till Java 8, String in java were internally represented by char. Each char is stored in 2 bytes in memory. JDK developers at oracle analyzed lots of client’s application help dumps and they noticed that most of the strings can be represented only using Latin-1 characters set. A latin-1 char can be stored in one byte, which is 50% (1 byte) less than char data type storage.
If you have worked on latest UI development frameworks e.g. Node, angular, gulp etc. then you must have appreciated the auto-reload of UI in browser whenever there is change in some code. Its pretty useful and saves a lot of time. Well, same feature can be utilized in spring boot applications using spring-boot-devtools dependency provided […]
In Spring boot applications, default packaging is jar which is deployed in embedded servers. If you want to generate a war file for deployment in seperate application server instances such as Jboss, Weblogic or tomcat, then follow below instructions.
In this spring boot tutorial, we will learn to validate request body sent to PUT/POST REST APIs. We will also learn to add custom error messages in API responses for validation errors using ResponseEntityExceptionHandler, @ControllerAdvice and @ExceptionHandler annotations.
String boot is very easy to use and it does a lot of things under the hood, you might not be aware of. In future, a good developer will be who will know exactly what is going on behind spring boot auto configuration, how to use it in your favor and how to disable certain sections which you do not want into your project.
In this Spring HATEOAS example, we will learn to add HATEOAS links to existing REST APIs created in a spring boot project. We will use the class org.springframework.hateoas.ResourceSupport along with org.springframework.hateoas.mvc.ControllerLinkBuilder and org.springframework.hateoas.Link classes provided by spring HATEOAS module. To demo the creation of links, we will first create few REST APIs and see their […]
The spring-boot-starter-parent dependency is the parent POM providing dependency and plugin management for Spring Boot-based applications. It contains the default versions of Java to use, the default versions of dependencies that Spring Boot uses, and the default configuration of the Maven plugins.
Spring Boot comes with over 50+ different starter modules, which provide ready-to-use integration libraries for many different frameworks, such as database connections that are both relational and NoSQL, web services, social network integration, monitoring libraries, logging, template rendering, and the list just keeps going on.
Spring boot is widely being used while delivering micro services based application. Eventually it has become a necessity to monitor Spring boot applications running on different hosts. There are many tools available to monitor different health stats of these microservices. In this post, we will learn to use three such monitoring tools i.e. Hystrix dashboard, […]
Swagger can be integrated with REST APIs in below ways – A top-down approach – First API specification and then code generation. A botton-up approach – First API code and then Swagger integration. In this tutorial, we will learn the top down approach.
In this maven tutorial, we will learn to create fat jar or uber jar for spring boot applications using maven plugin. Its very easy and require very few config changes in pom.xml file.
In this ANT tutorial, we will learn to build war file for our java web application project. This example uses minimum code and configuration so you can use it for sample ant build.xml for war as well. ANT Installation Download Apache Ant from ant.apache.org. Extract the zip file into a directory structure of your choice. […]
Learn to build jar files for our java project. This example uses minimum code and configuration so you can use it for sample build.xml example as well.
Learn to read typesafe user inputs from console in any interactive java application i.e. prompt the user until user inputs the value in correct format/datatype.