Archange
Archange

Reputation: 519

SpringBoot integration tests scan issue

I'm using a multiproject gradle with spring boot 2.0.0.RC1. One of my subproject is the SpringBoot application and contained my integration tests.

The integration test is marked @SpringBootTest with a WebEnvironment.RANDOM_PORT. The test failed due to a unresolved dependency (a service declared in a another subproject, sibling of application) with gradle command line but succeed in Eclipse IDE.

In the IDE the classpath is unified ; in a terminal the dependencies tree is OK.

All the components are scanned automatically ; all the classes in the various subprojects share the same base package name. I don't understand why some services are not picked up during the scan.

If anyone has an idea ? How can I debug the beans loading inside a real WebAppContext test ?

Upvotes: 0

Views: 121

Answers (1)

Archange
Archange

Reputation: 519

My project is a gradle multiproject. One is the main application, the others are "components" depending also on spring framework starters.

To achieve this, I added spring-boot and io-dependency-management plugins Doing so in the "components" also come with a side-effect I forgot : the plugin disable the jar task and add a bootJar. And in this project I forgot to disable bootJar and re-enable jar.

Last time I had a warning about main-class not set when building subproject but not this time. Don't know why.

Sorry. Everything's fine. Read the Manual ! ;)

Upvotes: 1

Related Questions