Home » Java (page 4)

Java

Functional Java by Example | Part 7 – Treat Failures as Data Too

This is part 7 of the series called “Functional Java by Example”. The example I’m evolving in each part of the series is some kind of “feed handler” which processes documents. We’ve already dealt with exceptional situations before, but we’re going to take care of them, more ehm,…functionally — as data. If you came for the first time, it’s best ...

Read More »

When using JAXB

Not many examples show this, but how you use JAXB in your application can make a huge difference in the performance (and memory usage). The example In this blog post I’ll use an example Object called Membership that looks something like this: We will marshal and unmarshal this object to and from XML using JAXB. Create the context in a ...

Read More »

5 Refactoring Principles by Example

This post features five (mostly well-known) refactoring principles applied when refactoring real open-source code (Gradle Modules Plugin). Context When I worked on separate compilation of module-info.java for Gradle Modules Plugin (PR #73), I noticed potential for some refactoring. As a result, I filed issue #79 and later resolved it with PR #88 (not merged yet), where I refactored the code. ...

Read More »

A New Era for Determining Equivalence in Java?

Liam Miller-Cushon has published a document simply called “Equivalence” in which he proposes “to create a library solution to help produce readable, correct, and performant implementations of equals() and hashCode().” In this post, I summarize some reasons why I believe this proposal is worth reading for most Java developers even if the proposal never gets implemented and why the proposal’s ...

Read More »

Maven Dependency Scopes

Introduction: Managing dependencies is a core feature of Maven. When defining a maven dependency, the scope attribute defines the visibility of that dependency on different maven lifecycle phases such as build, test and run. The dependency scopes limit the transitivity of dependencies in any project, thereby affecting the classpath. Also, there are six different available dependency scopes in Maven. In ...

Read More »

Spring Boot Error – Error creating a bean with name ‘dataSource’ defined in class path resource DataSourceAutoConfiguration

spring-interview-questions-answers

Hello guys, If you are using Spring Boot and getting errors like “Cannot determine embedded database driver class for database type NONE” or “Error creating a bean with name ‘dataSource’ defined in class path resource ataSourceAutoConfiguration” then you have come to the right place. In this article, we’ll examine different scenarios on which this Spring Boot error comes and what ...

Read More »

Perils of opinionated frameworks, like Spring Boot. Inverting for opinionated code

spring-interview-questions-answers

We developers like abstraction.  Without it, we could not build applications.  Our programming disciplines even require that we code to abstractions and avoid coupling our code to detailed implementations. However, what is the right abstractions for your application? Sadly, the choice of abstractions really comes from our choice of framework.  Frameworks are basically abstract solutions that we extend to solve ...

Read More »

Complete Guide On TestNG Annotations For Selenium WebDriver

TestNG is a testing framework created by Cédric Beust and helps to cater a lot of our testing needs. It is widely used in Selenium. Wondering on what NG stands for? Well, it refers to ‘Next Generation’. TestNG is similar to Junit but is more powerful to it when it comes to controlling the execution flow of your program. As ...

Read More »

Best Way to Learn Java Programming Online

1. Introduction Java is one of the most widely used programming languages. According to a recent report by Github, Java was ranked as the 2nd most used programming language after JavaScript. There is a very big list of topics that someone has to learn to master Java. The good thing is that you can find lots of content online. In ...

Read More »