Inquiry. I recently added a new service to my sys...
# spring
l
Inquiry. I recently added a new service to my system.
interface Foo
and
class FooImpl: Foo
. They appear to be fine, have some dependencies, have no linter or compiler errors. But I have a pre-existing controller test of a completely different part of the system, that has no dependency on Foo at all, that is now failing every test method with this error:
Error creating bean with name 'fooImpl': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.myorg.FooImpl] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@5ffd2b27]
… Which I do not understand at all. I am even able to inject that class in a different test of the new code, but in this one test that shouldn’t be related, it’s failing. The fact that it fails on a lowercase
f
in
fooImpl
sounds suspicious, but I have no idea where that could be coming up.
fooImpl
appears nowhere in the codebase at all, and
FooImpl
appears only once, in the class definition. What PEBCAK error am I looking at here?
e
Have you annotated
FooImpl
with
@Component
or
@Service
?
l
@Service. Another colleague just helped me track it down. It was not actually FooImpl that was the problem. It was a dependency of FooImple that was being declared in one gradle build file but not another. (We have a multi-module application.)
k
fooImpl is implicit name of bean if not customized
l
A colleague helped me sort out the issue. It wasn’t FooImpl that was the problem. Rather, we have a multi-module setup, FooImpl was using a different class internally, and that class was in a library that was declared in one module but not another. And since dependencies are not transitive, it wasn’t loading the other library and so that other class was missing.
k
yeah, I am just referring
The fact that it fails on a lowercase
f
in
fooImpl
sounds suspicious, but I have no idea where that could be coming up
l
The container was trying to register FooImpl with default naming configuration, which means
fooImpl
. But in so doing it does a lexical scan of the class, found the other class, tried to look that up, couldn’t, and so failed.