π Interface for components that need access to the entry application class.
The EntryApplicationAware interface provides components with knowledge of the main application class, enabling framework integration points that need to understand the application's entry point and structure.
Typical Use Cases:
- Framework Integration: Components that need to interact with application bootstrap
- Configuration Scanning: Components that perform classpath scanning relative to main class
- Metadata Inspection: Access annotations or metadata on the main application class
- Plugin Systems: Plugins that need application class information for registration
Framework Integration:
- Called during application bootstrap process
- Provides the Class object representing the main application class
- Useful for framework components rather than application business logic
Example Usage:
@Component
class ApplicationMetadataService implements EntryApplicationAware {
late Class<Object> _entryApplication;
@override
void setEntryApplication(Class<Object> entryApplication) {
_entryApplication = entryApplication;
}
String getApplicationName() {
return _entryApplication.getSimpleName();
}
bool hasAnnotation<T>() {
return _entryApplication.hasAnnotation<T>();
}
Package getApplicationPackage() {
return _entryApplication.getPackage();
}
List<Class> findConfigurationClasses() {
return _entryApplication.getPackage()
.getClasses()
.where((cls) => cls.hasAnnotation<Configuration>())
.toList();
}
}
Best Practices:
- Primarily for framework-level components, not application business logic
- Use for scanning and metadata purposes rather than runtime behavior
- Consider performance implications when performing reflection operations
- Cache expensive metadata operations when possible
See also:
- ApplicationContextAware for broader application context access
- PodFactoryAware for dependency injection container access
Properties
- hashCode β int
-
The hash code for this object.
no setterinherited
- runtimeType β Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) β dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setEntryApplication(
Class< Object> entryApplication) β void - Sets the entry application class that this component can reference.
-
toString(
) β String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) β bool -
The equality operator.
inherited