A potential solution for this error in your Spring application running on Docker is to add the following variable on Dockerfile.
SPRING_MAIN_ALLOW_BEAN_DEFINITION_OVERRIDING=true