SpringDev tools problem, with org.springframework.beans.factory.NoSuchBeanDefinitionException

I have a problem with my project, when adding spring-boot-devtools, i get NoSuchBeanDefinitionException. Everything works as expected without this dependency. The exception is thrown at this point:

AionLayout aionLayout = beanFactory.getBean(module.getClass() .getSimpleName(), AionLayout.class);

What is BeanFactory?

ListableBeanFactory beanFactory;

And why are you not using Dependency Injection?

Because I have to load beans dynamically.

Can you please post the whole stacktrace?

message.txt (2.31 KB)

the whole stacktrace please

message.txt (23.9 KB)

How is AionModule defined?

The default bean name starts with lower case normally

Yes I know. The problem is that classes should be extended from AionModule, But when I add springdevtools, suddenly module.getClass()
.getSimpleName() is the parent class, but it shouldn’t be.

And where does module come from?

I am just reviewing code, to check it

Name is stored in mongo and _class is interpreted different with springdevtools on or off.

This is stored in mongo. But when using spring devtools its converted to parent class

How is the Bean registered? DevTools uses a different Classloader

ok. Then this is the problem. It’s just stored to mongo via MongoRepesitory. But repository is defined for parent class only.

Spring devtools acts differently than default class loader. I have created a mongo collection with different bean implementations all extended one base class. Without devtools records are converted to expected class as it’s stated in mongo (_class), but when using devtools everything is converted to parent entity.