0

I am running a component scan on a jar where I load a few packages. The package com.path.package works fine and is getting loaded but then beans within com.path.package.addon is not getting loaded in by the component scan

<context:component-scan base-package="com.path.package, com.path.package.addon />

I did look at several questions before asking this one. None of them seem to give the answer to the problem I am seeing. There are no errors on my logs, when I try to get this bean from applicationContext, I just get the error bean not found. Any help would be appreciated.

vignesh
  • 37
  • 1
  • 8
  • Can you try to leave only "com.path.package"? It should work on all subpackages (so also on "com.path.package.addon"). If it won't work problem is something else. – Krzysztof Atłasik Sep 16 '17 at 19:08
  • Yeah you were right about the problem being something else. I tried to specify a bean in the appContext with the class I wanted as a bean and lo and behold the error showed up on the log. It was because the jar did not have several dependency packages as part of the export. So I create a osgi Service at this point of one of the beans and referenced it in the other project that I wanted the bean to be used on. There were several other beans that I needed from the jar file but this one has several dependencies. – vignesh Sep 16 '17 at 21:45
  • Strange. How about `base-package="com.path.package.*`? Check if `com.path.package.addon` is really in your class path and the beans you want to load are correctly annotated. Good luck. – Rafa Sep 17 '17 at 02:30

0 Answers0