import { TWishedBean } from "../org.springframework.beans/annotations"; import { ApplicationEvent } from "./applicationEvent"; import { AbstractApplicationContext } from "./abstractApplicationContext"; import { IApplicationContextAware } from "./applicationContext"; /** * Params for Bean annotation */ export declare type TBeanParams = { scope?: TScope; resolver?: TWishedBean; }; /** * Definition of the event listener for EventListener annotation */ export declare type TEventListenerRecord = { key: string; eventClass: typeof ApplicationEvent; }; export declare const beansToken: unique symbol; export declare const eventsToken: unique symbol; /** * Annotation for classes contains Throwable annotated methods */ export interface IThrowable extends IApplicationContextAware { } export declare type TScope = "singleton" | "global" | "prototype"; /** * Mark class be managed by context. * @remark https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Component.html * @param token - bean token to comply bean instance. * @param params - bean params (scope). */ export declare function Bean(token: Symbol, params?: TBeanParams): (constructor: any) => void; /** * Mark class as configuration bean. * Allows to use bean annotation for methods. * @remark https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/Configuration.html * @param token * @param params */ export declare function Configuration(token: Symbol, params?: TBeanParams): (constructor: any) => void; /** * Mark method as factory to provide bean. * @remark https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/Bean.html * @param token - token to comply bean instance. * @param params - bean params (scope). */ export declare function bean(token: Symbol, params?: TBeanParams): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; /** * Subscribe for events in context. * @remark https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/event/EventListener.html * @param eventClass - event type to subscribe */ export declare function EventListener(eventClass: typeof ApplicationEvent): (target: any, key: any, descriptor: any) => void; /** * All errors in method will be broadcasted to context as ApplicationContextBeanRuntimeExceptionEvent. * For sync function. * @param context - context to broadcast exceptions */ export declare function Throwable(context?: AbstractApplicationContext): (target: any, key: any, descriptor: any) => any; /** * All errors in method will be broadcasted to context as ApplicationContextBeanRuntimeExceptionEvent. * For async function. * @param context - context to broadcast exceptions */ export declare function ThrowableAsync(context?: AbstractApplicationContext): (target: any, key: any, descriptor: any) => any;