Skip to content
Advertisement

Is there a way to execute only some packages in SpringBoot?

I have a use case where I have a lot of services running in the same code base but they are in different packages. So, whenever I start SpringBoot all those services start. Is there a way I can specify SpringBoot to start the code in a particular package? Thanks in advance

Advertisement

Answer

you can use component scan annotation in main class, which will scan only the packages mentioned

 @ComponentScan(basePackages = "name of specific package")
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement