All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.firefly.kotlin.ext.context.ApplicationContextExtension.kt Maven / Gradle / Ivy

The newest version!
package com.firefly.kotlin.ext.context

import com.firefly.core.ApplicationContext
import com.firefly.kotlin.ext.common.firefly

/**
 * Application context extension
 *
 * @author Pengtao Qiu
 */

inline fun  ApplicationContext.getBean(): T = this.getBean(T::class.java)

inline fun  ApplicationContext.getBeans(): Collection = this.getBeans(T::class.java)

object Context {

    inline fun  getBean(): T = firefly.getBean(T::class.java)

    fun  getBean(id: String): T = firefly.getBean(id)

    inline fun  getBeans(): Collection = firefly.getBeans(T::class.java)

    fun getBeanMap(): Map = firefly.getBeanMap()

    fun create(): ApplicationContext = firefly.createApplicationContext()

    fun create(path: String): ApplicationContext = firefly.createApplicationContext(path)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy