MarcGiffing / wicket-spring-boot

Spring Boot starter for Apache Wicket
151 stars 61 forks source link

AnnotatedMountScannerConfig no longer picking up base packages in 3.1.5 #186

Closed reckart closed 2 years ago

reckart commented 2 years ago

It looks like in 3.1.5, the AnnotatedMountScannerConfig is initialized way before com.giffing.wicket.spring.boot.starter.app.classscanner.ClassCandidateScanner.postConstruct() is called during startup. Thus, AnnotatedMountScannerConfig does not find additional base packages set on the WicketClassCandidatesHolder by ClassCandidateScanner.postConstruct().

reckart commented 2 years ago

I was able to work around the issue by manually setting the base packages in my Spring Boot main class:

    @Autowired
    public void configureBasePackagesWorkaround(WicketClassCandidatesHolder aHolder)
    {
        aHolder.getBasePackages().add(BASE_PACKAGE_1);
        aHolder.getBasePackages().add(BASE_PACKAGE_1);
    }
MarcGiffing commented 2 years ago

Does the problem occour after upgrading? Is it related to the Upgrade of Spring Boot?

reckart commented 2 years ago

I could not really upgrade Spring Boot (2.5.7 -> 2.6.1) without upgrading Wicket Spring Boot (3.0.4 -> 3.1.5).

What I tried through was using Wicket Spring Boot 3.1.5 with Spring Boot 2.5.7 - that didn't work either.

So what I did in the end to try figuring out how to get it working was setting a breakpoint in AnnotatedMountScannerConfig to see when it would be called and there I noticed that the breakpoint hit before another one in ClassCandidateScanner.postConstruct() was hit. Hence the report.

MarcGiffing commented 2 years ago

Can you please try Wicket Spring Boot 3.1.6

reckart commented 2 years ago

3.1.6 seems to work. I updated the dependency, commented out my workaround, started up and it looked good. Thanks for the quick fix!