Friday, January 28, 2022

Error creating bean with name 'conversionServicePostProcessor' defined in class path resource

Today I changed my .m2 repository from external repo to internal repo. After downloading all the necessary jars, I did mvn clean install and both got success. Then i tried to start my inbuild tomcat server for my spring boot application, after few seconds I got this error on console and server shutdown.


Error creating bean with name 'conversionServicePostProcessor' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.beans.factory.config.BeanFactoryPostProcessor]: Factory method 'conversionServicePostProcessor' threw exception; nested


The same code working other for my team, so I just googled the error and find some suggestion,   

spring.main.allow-bean-definition-overriding=true

But this same already available in my application.properties.


spring.main.allow-bean-definition-overriding=true 
So I have no clue to solve this issue, I tried many suggestion nothing works for me. Then I remember one, what if I try to  
Reimport All Maven Projects in my IDE, I am using IntelliJ. If you are using Eclipse just refresh the dependencies.


After all the jar loading done, I retried to start the server. Finally it works for me.
If you have some problem initializing spring boot bean after successful mvn install, just try reimport your jars on your IDE.
Because sometime your IDE need manual call to get refresh the dependencies.


No comments:

Post a Comment