Maven configuration with Spring Boot & multi modules - run application in Intellij

前端 未结 3 1356
闹比i
闹比i 2020-12-08 16:09

I\'m currently working on a REST API with Spring Boot.

I\'m new to Maven and have just started coding with IDEA (don\'t know well this IDE yet), and I have a problem

3条回答
  •  清歌不尽
    2020-12-08 16:33

    You need to tell SpringBoot where to look for your controllers. Per default that only happens in sub-packages of your @SpringBootApplication class (which will probably not include your sub module).

    In order to change that you can use @ComponentScan("path.to.package") to change the default package.

    Additionally, you can use @EntityScan to do the same for @Entity classes that might be in your sub-module.

提交回复
热议问题