This post demonstrates how to set all the bean properties with values from .properties file using Spring Boot. We are not going to set them one at a time. We want to set them all at the same time using the following Spring annot
Create a Spring Boot Application using IntelliJ
Using Spring Boot is the fastest way to get up to speed in developing modern applications. But how do we create the initial codebase that works out of the box? There are three ways – by hand, the Spring Initialzr,
Mock methods that return void
Previously, I posted Void methods and Mockito in Java that verifies if any of the methods of a object passed as a argument were invoked. This time we want to alter the behavior of a method that returns void.
Spring Boot + Spring Security with Multiple Login Forms and User Types
I’m working on some personal project that handles 4 different user types (e.g., students, instructors, registrar employees, security personnel). Each user type are stored in a separate user table. With this, I require four (4) login forms.
Java – Beyond String Pool
The String Pool is a location in the Java Virtual Machine (JVM) that collects all the literal Strings from your codes. Java keeps unique Strings for reuse.
Java 8 – Redeclare default methods
In Java, you can extend from another interface using the extends keyword. But Java 8 has default methods. What happens if we extend another interface that has the same default methods as our interface?
It gets re-declared in the “child” interface.
Java 8 – Convert Iterator to Stream Using StreamSupport
Although not a common scenario, some libraries return Iterators instead of Stream or Collection objects. Why? Because they can. If the Java libraries you are using have methods that return Iterator objects, this will show how to convert Iterator to
Java Compare Multidimensional Arrays Of Reference Types
This post shows how to compare two multidimensional arrays of reference types in Java. The codes will examine if they are the same in terms of element values and their locations. For example, we want to compare a modified array
Java – Copy array by range
This post will show you how to copy a subset elements of an array by range. For example, copy elements from index 3 to 4 (exclusive). The range values work in the same way as the String’s substring method.
Java – Sort Objects in Collections
Before Java 8, sorting objects in collections is a bit awkward and verbose in terms of the amount of codes you need to put in. With Java 8, things got easier because of Lambda expressions.