getMainApplicationClass abstract method

Class<Object> getMainApplicationClass()

Returns the main application class.

This is the class that was used to bootstrap the application and serves as the primary configuration source and entry point.

Framework Usage:

  • Component Scanning: Base package for annotation scanning
  • Configuration Detection: Source for @Configuration classes
  • Banner Display: Used in startup banner presentation
  • Metadata Access: Provides application metadata and version info

Example:

final mainClass = context.getMainApplicationClass();

print('Main application class: ${mainClass.getSimpleName()}');
print('Package: ${mainClass.getPackage()?.getName()}');

// Check for specific annotations
if (mainClass.hasAnnotation<SpringBootApplication>()) {
  print('This is a Spring Boot application');
}

Implementation

Class<Object> getMainApplicationClass();