Home » Java

Java

Apache Kafka Streams + Machine Learning (Spark, TensorFlow, H2O.ai)

I started at Confluent in May 2017 to work as Technology Evangelist focusing on topics around the open source framework Apache Kafka. I think Machine Learning is one of the hottest buzzwords these days as it can add huge business value in any industry. Therefore, you will see various other posts from me around Apache Kafka (messaging), Kafka Connect (integration), ...

Read More »

Who needs Java modules after all ?

Jigsaw questions for 1000. I as an X want JPMS modules. What is X if it’s not a platform developer? My answer is that X is a human being (minus platform developers, because that was a condition). We all need module system to have safer code resulting in more reliable systems resulting in better performance in the business resulting in ...

Read More »

Effective Java – Creating and Destroying Objects

Creating and Destroying Objects (Ch 2) This is a short summary of Joshua Blochs book Effective Java chapter 2. I have only included items that are relevant for myself. Static Factories (item 1) Some advantages of static factories vs constructors: Factory methods have names which add a description to the constructor They can return pre-constructed object instead of always returning ...

Read More »

Effective Java – Method Common to All Objects

Methods Common to All Objects (Ch 3) This is a short summary of Joshua Blochs book Effective Java chapter 3. I have only included items that are relevant for myself. The general equals() contract (item 8) The equals contract describes the equivalence relation as: x.equals(null) == false Reflexive – x.equals(x) == true Symmetric – if x.equals(y) == true then y.equals(x) ...

Read More »

Get Started with Spring Boot, OAuth 2.0, and Okta

spring-interview-questions-answers

Build faster with Okta’s authentication and user management API. Register today for the free forever Developer Edition! If you’re building a Spring Boot application, you’ll eventually need to add user authentication. You can do this with OAuth 2.0 (henceforth: OAuth). OAuth is a standard that applications can use to provide client applications with “secure delegated access”. It works over HTTP ...

Read More »

Mocking Spring Security Context for Unit Testing

spring-interview-questions-answers

Today, while writing unit test case for one of the Java method which looks like below: public ApplicationUser getApplicationUser() { ApplicationUser applicationUser = (ApplicationUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); return applicationUser; } I want to mock Spring Security Context to get the Principal, to achieve the same I mocked each level of method calls as follows: import org.junit.Before; import org.junit.Rule; import org.junit.Test; import static org.mockito.Mockito.when; ...

Read More »

Boosting test performance with TestContainers

java-interview-questions-answers

In my previous post on testing, I described how to use TestContainers to provide realistic test environments for database tests. This comment revealed the downside: …as noted above, there always seems to be some drawback. In this case, the overhead of starting the Docker image and everything it contains will increase your overall build time. As a reminder, here’s the ...

Read More »

Importance of given-when-then in unit tests and TDD

Recently, I’ve been writing rather about more advanced concepts related to automatic testing (mostly related to Spock). However, conducting my testing training I clearly see that very often knowledge of particular tools is not the main problem. Even with Spock it is possible to write bloated and hard-to-maintain test, breaking (or not being aware of) good practices related to writing ...

Read More »

JVM Statistics with jstat

I have written about several command-line tools provided with the Oracle and/or OpenJDK Java Development Kits (JDKs) in the past, but I’ve never written exclusively about the jstat tool. The Oracle JDK 9 Documentation Early Access states that jstat is used “to monitor Java Virtual Machine (JVM) statistics.” There is also a warning, “This command is experimental and unsupported.” Although ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns