Announcement Announcement Module
No announcement yet.
@Configurable(dependecyCheck=true) is not working as expected Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Configurable(dependecyCheck=true) is not working as expected

    Hello guys,

    Recently I was trying to figure out how to use @Configurable annotation for one of my class projects. Since @Configurable needs some kind of aspectj weaving, I decided to use compile-time-weaving. The strange part is that when I try to use @Configurable(dependencyCheck=true) it always throws a UnsatisfiedException. However without the dependencyCheck = true, the code compiles and at runtime, all dependencies are successfully injected and everything seems to work as intended. Preferably, I want to have dependencyCheck true so that I could catch unsatisfied dependency errors early. I am not sure if this is a spring quirk or I missed out something in my code. Following is my code

    The configurable class
    @Configurable(autowire = Autowire.BY_TYPE, dependencyCheck = true)
    public class Crawler extends WebCrawler {
        private ContentRepository contentRepository;
    The class that instantiates Crawler outside of spring container

    protected <T extends WebCrawler> void start(final Class<T> _c, final int numberOfCrawlers) {
    			for (int i = 1; i <= numberOfCrawlers; i++) {
    				T crawler = _c.newInstance();    // --> this is where the Crawler class instantiated outside of spring
    				Thread thread = new Thread(crawler, "Crawler " + i);
    				crawler.init(i, this);
    				threads.add(thread);"Crawler " + i + " started.");
    the pom file configuration

    Please let me know what is going on and how do I get dependencyCheck to work? Thank you very much
    P.S: Spring is really automagical. It has automagically revived my enthusiasm to program in Java