When reloading UserDetailsService (for example) I get next error:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [ru.smarty.inpage_help.security.UserDetailsService] is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:319) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:987) ~[spring-context-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at io.github.jhipster.loaded.reloader.SpringReloader.start(SpringReloader.java:162) [core-0.12.jar:na]
at io.github.jhipster.loaded.reloader.SpringReloader.reload(SpringReloader.java:106) [core-0.12.jar:na]
at io.github.jhipster.loaded.JHipsterReloaderThread.batchReload(JHipsterReloaderThread.java:206) [core-0.12.jar:na]
at io.github.jhipster.loaded.JHipsterReloaderThread.run(JHipsterReloaderThread.java:153) [core-0.12.jar:na]
at java.lang.Thread.run(Thread.java:724) [na:1.7.0_40]
Some debugging has shown that in SpringReloader:162
//4) Resolve dependencies for existing beans
for (Class clazz : existingSpringBeans) {
Object beanInstance = applicationContext.getBean(clazz);
Only real class is queried.
But in my case this method throws Exception for my class (ru.smarty.inpage_help.security.UserDetailsService) and returns JdkProxy for class in case of (org.springframework.security.core.userdetails.UserDetailsService).
Unfortunately I don't have enough expertise in Spring internals to make fix myself. Maybe this place should also search for interfaces, implemented by clazz, make list of target Class-es (i.e. class itself, its parents and all implemented interfaces) and then make process for all of them, ignoring errors and giving warning if no target was successfully found?
Right now it gives infinite loop, because beans not cleared and it's repeated again and again.
It should be reproduced on clean jhipster project.
Run Application.java with VM Options -javaagent:spring_loaded/springloaded-jhipster.jar -noverify -Dspringloaded=plugins=io.github.jhipster.loaded.instrument.JHipsterLoadtimeInstrumentationPlugin
Open ru.smarty.loaded_bug.security.UserDetailsService
When reloading UserDetailsService (for example) I get next error:
Some debugging has shown that in SpringReloader:162 //4) Resolve dependencies for existing beans for (Class clazz : existingSpringBeans) { Object beanInstance = applicationContext.getBean(clazz);
Only real class is queried.
But in my case this method throws Exception for my class (ru.smarty.inpage_help.security.UserDetailsService) and returns JdkProxy for class in case of (org.springframework.security.core.userdetails.UserDetailsService).
Unfortunately I don't have enough expertise in Spring internals to make fix myself. Maybe this place should also search for interfaces, implemented by clazz, make list of target Class-es (i.e. class itself, its parents and all implemented interfaces) and then make process for all of them, ignoring errors and giving warning if no target was successfully found?
Right now it gives infinite loop, because beans not cleared and it's repeated again and again.
It should be reproduced on clean jhipster project.