Home » Java » Enterprise Java

Enterprise Java

KivaKit and AWS Lambda

java-interview-questions-answers

KivaKit 1.2 adds seamless support for AWS Lambda. Lambdas for REST and GRPC can be added to a KivaKit Microservice without alteration (which will make this a short article). Creating a Lambda We have already seen a KivaKit request handler for REST in the Microservices article. We will simply reuse this code as our Lambda request handler. As a reminder ...

Read More »

KivaKit Clustering

java-interview-questions-answers

KivaKit Clustering   KivaKit provides built-in support for clustering of microservices using Apache Zookeeper. It supplies a cluster model that is updated as members join and leave the cluster, and an implementation of the SettingsStore interface that stores settings in Zookeeper. Joining and Leaving a KivaKit Microservice Cluster To use KivaKit in a cluster, Apache Zookeeper must be running according ...

Read More »

Get to Know Jakarta MVC

java-interview-questions-answers

To help you get to know the Jakarta MVC specification, here’s a recap of its history and status, and a brief introduction to the technology. Jakarta MVC History and Status The story of Jakarta MVC started back in 2014 when Java Specification Request (JSR) 371 was proposed in the Java Community Process. The work progressed very well, and the specification became popular ...

Read More »

Spring Data Mock DAO

spring-interview-questions-answers

Warning, the following code example is suitable for a narrow range of use cases… but it’s strangely useful. When writing tests against Spring services or controllers, we may wish to mock the DAO layer completely. This can be achieved: @MockBean private MyDao myDao; And the mock dao is then wired into our services etc. However, there are situations where we’re ...

Read More »

HTTP – Content negotiation

java-interview-questions-answers

With HTTP, resources are identified using URIs. And a uniquely identified resource might support multiple resource representations. A representation is a specific form of a particular resource. For example: a HTML page /index.html might be available in different languagesproduct data located at /products/123 can be served in JSON, XML or CSVan avatar image /user/avatar might available in JPEG, PNG and ...

Read More »

KivaKit XML Streaming

java-interview-questions-answers

KivaKit XML Streaming   Since Java 1.6 in 2006, Java has had a built-in XML streaming API in the package javax.xml.stream. This API is known as StAX (Streaming API for XML), and it is a very efficient “pull parser”, allowing clients to iterate through the sequence of elements in an XML document. Other approaches to working with XML are event-handling ...

Read More »

Get logged-in user info in Jakarta EE – the simplest way

java-interview-questions-answers

The security before Java EE 8 / Jakarta EE 8 used to be a bit complicated and confusing. Every specification provided its own way to retrieve information about the logged-in user. The situation greatly improved with the introduction of the Security API that provides a unified way to do that – simply inject the SecurityContext CDI bean. There’s still a small catch ...

Read More »

Mockito when-then vs do-when

Writing unit test is very important for better software quality. For unit tests Mockito is one of the most common choices of developers. Mockito providers different way to mock methods, like do…when and when..then. Most of the time we face the question to use when-then vs do-when. We will see all the differences in detail. In Mockito we can mock ...

Read More »