comment 0

No ContextLoaderListener registered – Java Config


I just want to tell you about a simple fix which I struggle for hours. As you can see the error’s cause is Spring cant find the corresponding context loader listener which means we haven’t configured one.

But the underlying reason of this error is we haven’t set our configuration in the correct method of spring initialize. Here’s my configuration:

Main error looks like:

Simple workaround to fix this issue is adding this configuration in getRootConfigClasses override not in getServletConfigClasses. My initialize code was looking like:

Then changed it like:

And now everything is working as expected.

Thanks !

Leave a Reply

Your email address will not be published. Required fields are marked *