BeanDefinitionDsl

Class implementing functional bean definition Kotlin DSL.

Author

Sebastien Deleuze

Since

5.0

Parameters

condition

the predicate to fulfill in order to take in account the inner bean definition block

Types

BeanSupplierContext
Link copied to clipboard
open class BeanSupplierContext(context: GenericApplicationContext)
Limit access to ref() and provider() to bean supplier lambdas.
Role
Link copied to clipboard
enum Role : Enum<BeanDefinitionDsl.Role>
Role enum constants.
Scope
Link copied to clipboard
enum Scope : Enum<BeanDefinitionDsl.Scope>
Scope enum constants.

Functions

bean
Link copied to clipboard
inline fun <T : Any> bean(name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition from the given bean class which can be inferred when possible.
inline fun <T : Any> bean(crossinline f: () -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with no parameter for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 10 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 11 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 12 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 13 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any, N : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M, N) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 14 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any, N : Any, O : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 15 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any, N : Any, O : Any, P : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 16 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any, N : Any, O : Any, P : Any, Q : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 17 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any, N : Any, O : Any, P : Any, Q : Any, R : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 18 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any, N : Any, O : Any, P : Any, Q : Any, R : Any, S : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 19 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any> bean(crossinline f: (A) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 1 parameter autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any, N : Any, O : Any, P : Any, Q : Any, R : Any, S : Any, U : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 20 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any, N : Any, O : Any, P : Any, Q : Any, R : Any, S : Any, U : Any, V : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U, V) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 21 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any, J : Any, K : Any, L : Any, M : Any, N : Any, O : Any, P : Any, Q : Any, R : Any, S : Any, U : Any, V : Any, W : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U, V, W) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 22 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any> bean(crossinline f: (A, B) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 2 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any> bean(crossinline f: (A, B, C) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 3 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any> bean(crossinline f: (A, B, C, D) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 4 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any> bean(crossinline f: (A, B, C, D, E) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 5 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any> bean(crossinline f: (A, B, C, D, E, F) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 6 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any> bean(crossinline f: (A, B, C, D, E, F, G) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 7 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any> bean(crossinline f: (A, B, C, D, E, F, G, H) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 8 parameters autowired by type for obtaining a new instance.
inline fun <T : Any, A : Any, B : Any, C : Any, D : Any, E : Any, F : Any, G : Any, H : Any, I : Any> bean(crossinline f: (A, B, C, D, E, F, G, H, I) -> T, name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null)
Declare a bean definition using the given callable reference with 9 parameters autowired by type for obtaining a new instance.
inline fun <T : Any> bean(name: String? = null, scope: BeanDefinitionDsl.Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, isAutowireCandidate: Boolean? = null, initMethodName: String? = null, destroyMethodName: String? = null, description: String? = null, role: BeanDefinitionDsl.Role? = null, crossinline function: BeanDefinitionDsl.BeanSupplierContext.() -> T)
Declare a bean definition using the given supplier for obtaining a new instance.
environment
Link copied to clipboard
fun environment(condition: ConfigurableEnvironment.() -> Boolean, init: BeanDefinitionDsl.() -> Unit)
Take in account bean definitions enclosed in the provided lambda only when the specified environment-based predicate is true.
initialize
Link copied to clipboard
open override fun initialize(context: GenericApplicationContext)
Register the bean defined via the DSL on the provided application context.
profile
Link copied to clipboard
fun profile(profile: String, init: BeanDefinitionDsl.() -> Unit)
Take in account bean definitions enclosed in the provided lambda when the profile is accepted.

Properties

env
Link copied to clipboard
val env: ConfigurableEnvironment
Shortcut for context.environment