Posts

Showing posts with the label Core Java

How to Build a REST API using Dropwizard?

Image
Hello everyone, today we will discuss how to build RESTful API using Dropwizard with the help of one simple example. Dropwizard is an open-source Java framework for the expeditious development of REST APIs.Dropwizard allows a developer to build an initial project very expeditious. This avails the application to be packaged in a way that allows it to be facilely installed on the production environment as a stand-alone service. Dropwizard comes with the fundamental package of components or libraries needed to develop RESTful web services, so you don't require to include and configure each of them discretely: Libraries included inside Dropwizard Jetty :  Dropwizard utilizes the Jetty HTTP library to embed an HTTP server directly into our project. Jersey : It provides support for JAX-RS APIs and serves as a JAX-RS Reference Implementation. Jackson : Jackson is a high-performance JSON processor for Java. Guava : Google's utility library that gives us a large number of classes to sp

Top Spring Boot Interview Questions

Image
Hello everyone, today we will discuss some top interview questions in Spring Boot. More Java interview questions and answers... Spring Boot actuator interview questions and answers Spring Webflux Interview Questions and Answers Spring Core - Interview Questions Top Spring Cloud Interview Questions Spring Security Interview Questions Spring MVC - Interview Questions Spring Webflux Interview Questions Top Spring Boot Interview Questions Spring Data JPA Interview Questions and Answers Top Mockito Interview Questions and Answers Java Collections Interview Questions Java Stream API Interview Questions and Answers - Frequently asked Quarkus - Interview questions and answers   Spring Interview questions and answers What is Spring Boot?  Spring Boot is an open-source, microservices-based Java framework. It is developed and maintained by the Pivotal Team and is utilized to build stand-alone and production-ready spring applications that you can just run because it requires very little spring con

Java - How to ping multiple HTTP endpoints by run Multiple Threads Concurrently?

Image
Hello everyone, today we are going to learn how to ping multiple HTTP endpoints by running multiple threads concurrently in java. I am using  ExecutorService Approach to achieve the goal. What is the ExecutorService ? The  ExecutorService  is the interface that sanctions us to execute tasks on threads asynchronously.  The ExecutorService avails in maintaining a pool of threads and assigns them tasks. It withal provides the facility to queue up tasks until there is a free thread available if the number of tasks is more than the threads available. “The way the processor industry is going is to add more and more cores, but nobody knows how to program those things. I mean, two, yeah; four, not really; eight, forget it.”                                                           Steve Jobs, Apple.   Example 1:  Java Thread Example by extending Thread class import java.net.HttpURLConnection; import java.net.URL; import java.util.concurrent.ExecutorService; import java.util.concurrent.Exe