Class.equals returns false in some cases with spring-boot-dev-tools activated
Probably because of ReloaderClassLoader, in some cases there are classes that appears equals that are loaded by a different class loader.
If i store a reference of class type into a singleton bean and compare with the same class using equals(), the result is false.
es: @Component class SingletonBean() { public Class getClassType() { return MyClass.class } }
somewhere in code, for example a controller
applicationContext.getBean(SingletonBean.class).getClassType().equals(MyClass.class)
returns false
If I check the classloader of each class, in the first case is ReloaderClassLoader, in second case is AppLauncher$ClassLoader.
Sounds like you need to configure some of your dependencies to be loaded by the restart class loader. The documentation describes how to do it.
Tnx for the quick response. It's not the case that the documentation describe. Both classes are in the same module and a single class is loaded into 2 class loaders. If this is normal, I'll check my configuration
We can investigate a bit more, but we'll need some more information. If you provide a sample that reproduces the problem we can take another look.