Repeating actions with Spring Retry

retry

Some operations in software systems are not reliable. Database operations may deadlock, sending an email may fail, a network request may not reach the destination etc. There is a chance that another attempt of the same action will succeed. It is recommended to wrap such operations with a retrying mechanism. Spring Retry is a library that makes it easy.

Logging configuration for Spring Boot (logback)

logWhen you start a project, you usually do not care about logging. Necessary information is printed to the console by default. That is usually enough for development but when you want to go with it to production, logging has to be configured. There are a few Java libraries that can handle logging like java.util.logging, Logback, Log4j, Jakarta Commons Logging. When you create a project based on Spring Boot Web Starter, Logback is added by default.

Cannot find ServletContextInitializer

springIf you are upgrading to Spring Boot 1.5, you may notice that some classes, methods and properties were removed. One of them is ServletContextInitializer that was used to configure Java Servlet context. It was an interface and was available in Spring Boot 1.4 but it was marked as deprecated. It disappeared with the upgrade. See how it can be replaced.

Google and Facebook login in one application

google facebookIf you want to avoid maintaining a users database and creating a custom authentication based on a login form, you should consider OAuth2 and their 3rd party providers. Your users will be able to log in with their social accounts. That is great for them as they do not need to remember new passwords and for other various reasons. Some of them are described in What is OpenID, OAuth2 and Google Sign In?

Module xyz reads package org.apache.commons.logging from both commons.logging and jcl.over.slf4j

modulesWhen I tried to migrate one of my projects to Java 9 and modules, I encountered this error - module xyz reads package org.apache.commons.logging from both commons.logging and jcl.over.slf4j. As this package (org.apache.commons.logging) is very popular, it might happen to you also. That is why I want to share with you some background of this issue and a solution that worked for me.