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

com.driver733.mapstructfluent.ApplicationContextService.kt Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package com.driver733.mapstructfluent

import org.springframework.context.ApplicationContext
import org.springframework.stereotype.Component
import javax.annotation.PostConstruct

@Component
private class ApplicationContextService(
        private val context: ApplicationContext
) {
    companion object {
        private lateinit var context: ApplicationContext

        fun  getBean(clazz: Class) = context.getBean(clazz)
    }

    @PostConstruct
    fun initialize() {
        Companion.context = context
    }
}

fun  Class.getBean() = ApplicationContextService.getBean(this)





© 2015 - 2024 Weber Informatics LLC | Privacy Policy