Author: jt

About jt

    A common requirement while programming in Java is to convert String to int. UI inputs in Web-based HTML, JSP, or Thymeleaf templates are transferred to backend Java applications as strings. It is the application developer’s responsibility to perform any String to int conversions to fulfill business logic, such as calculating discounts, storing age, and so […]Continue reading

    Java Architecture for XML Binding (JAXB) is a library that helps to bind XML schemas and Java representations. JAXB provides you with a mechanism to marshal Java objects into XML and the other way around – unmarshal XML into Java objects. XML is an industry standard for defining the contents of your message. XML along […]Continue reading

    One common requirement in Java application is to iterate through the elements of a collection. Prior to Java 8, the three most common ways to iterate through a collection are by using the while loop, for loop, and enhanced for loop. As the Java Collection interface extends Iterable, you can also use the hasNext() and […]Continue reading

    Prior to Jackson 1.2, the only way to serialize or deserialize JSON using Jackson was by using one of the following two methods: Adding annotations to modify the POJO classes Writing custom serializers and deserializers Now imagine you want to serialize or deserialize a 3rd party POJO which you don’t have access to its source […]Continue reading

    When developing Spring Boot applications, you need to tell the Spring Framework where to look for Spring components. Using component scan is one method of asking Spring to detect Spring managed components. Spring needs the information to locate and register all the Spring components with the application context when the application starts. Spring can auto […]Continue reading

    JSON has become the most preferred way of transmitting data across network connections. JSON being easily readable by machines is one of the many reasons for JSON’s popularity. However, JSON unless formatted well, is not easily readable by a human. Pretty printing a JSON is one common operation to improve the readability of the JSON. […]Continue reading

    While developing applications, we often need to generate random numbers. Java provides support to generate random numbers primarily through the java.lang.Math and java.util.Random classes. In this post, I will discuss different ways to generate random numbers based on different types of requirements. Random Numbers using the Math Class Java provides the Math class in the […]Continue reading

    Jackson is a suite of data-processing tools for Java comprising of three components: Streaming (jackson-core) defines low-level streaming API and includes JSON-specific implementations. Annotations (jackson-annotations) contains standard Jackson annotations. Databind (jackson-databind) implements data-binding (and object serialization) support on streaming package. This package depends both on streaming and annotations packages In this post, I will explain […]Continue reading

    GSON is a very popular Java library for work with JSON. JavaScript Object Notation (JSON) is a lightweight data exchange format. Like XML, JSON provides a way of representing object that is both human readable and machine processable. In the Java ecosystem, there are several libraries that you can use to serialize Java objects to […]Continue reading

    Introduction I’m quickly becoming a fan of using CircleCI for CI builds. I’m finding that CircleCI is a very powerful platform. Recently, I configured CircleCI to build a Spring Boot Microservice. The microservice was generated by JHipster. CircleCI is a online resource which uses Docker containers to run your CI builds. Since your build is […]Continue reading