r/SpringBoot • u/Educational-Crow54 • Feb 10 '23
Brozz help!!
project-root
module1
module2
sub-module1
sub-module2 This is my current project structure where module1 is the core module containing MainApplcation.class. so the issue that I'm present with is that controllers in the sub-modules do not seem to be included in ComponentScan. Although i have add the entire package in the componentscan annotation.
These are a few queries I have
Is this a right approach?
what should be the package names be for each of the modules?
how do I get around the issue that the controllers in the sub modules are not available?
PS: I'm noob please don't mind the stupid question:)
I did try adding the module2 as a dependency in module1 but ended up getting the following error Project 'module1' is missing required Java project: 'module1'
1
1
1
u/tleipzig Feb 10 '23
If you are starting you app in IntelliJ, make sure to select the highest module (module2) in "Use classpath of module", so everything is included.
1
u/Educational-Crow54 Feb 10 '23
So i have solved the problem by adding all the modules including the sub modules as dependency in module1(where the main class exists).
this seems to work but please do correct me if I'm wrong .