I am trying to identify a way to know the name of the Main-Class
that started SpringBoot.
e.g.
@SpringBootApplication
public class SampleApplication {
public static void main(String[] args) {
SpringApplication.run(SampleApplication.class, args);
}
@RestController
public class SampleController
{
@GetMapping("/hello")
pubic String sayHello()
{
System.out.println("Need start class name: "+System.getProperty("sun.java.command"));
return "hello";
}
}
}
When I run the springboot using java -jar myappname.jar
,the System.getProperty("sun.java.command") returns org.springframework.boot.loader.JarLauncher
Can anyone advise, how can I get the name of actual run class. I have tried specifying the start-class
attribute in the manifest.mf. It still gave me org.springframework.boot.loader.JarLauncher
as the start-class.