I have a use case where I only want to execute some packages in my SpringBoot application. So, in my main class, I am using something like this -
@SpringBootApplication
@ComponentScan(basePackages = {"com.example"})
public class Example {
public static void main(String[] args) {
SpringApplication.run(Example.class, args);
}
}
So, here I have hardcoded the basePackages as "com.example". This is not what I want. I want to receive the package name when the application is run from the terminal through command-line arguments. Is there a way I can pass command-line arguments to the application and use the arguments that I receive inside the basePackages? Thanks in advance