@@ -64,6 +64,41 @@ open class BeanRegistrarDsl(private val init: BeanRegistrarDsl.() -> Unit): Bean
64
64
*/
65
65
lateinit var env: Environment
66
66
67
+
68
+ /* *
69
+ * Apply the nested block if the given profile expression matches the
70
+ * active profiles.
71
+ *
72
+ * A profile expression may contain a simple profile name (for example
73
+ * `"production"`) or a compound expression. A compound expression allows
74
+ * for more complicated profile logic to be expressed, for example
75
+ * `"production & cloud"`.
76
+ *
77
+ * The following operators are supported in profile expressions:
78
+ * - `!` - A logical *NOT* of the profile name or compound expression
79
+ * - `&` - A logical *AND* of the profile names or compound expressions
80
+ * - `|` - A logical *OR* of the profile names or compound expressions
81
+ *
82
+ * Please note that the `&` and `|` operators may not be mixed
83
+ * without using parentheses. For example, `"a & b | c"` is not a valid
84
+ * expression: it must be expressed as `"(a & b) | c"` or `"a & (b | c)"`.
85
+ * @param expression the profile expressions to evaluate
86
+ */
87
+ fun profile (expression : String , init : BeanRegistrarDsl .() -> Unit ) {
88
+ if (env.matchesProfiles(expression)) {
89
+ init ()
90
+ }
91
+ }
92
+
93
+ /* *
94
+ * Register beans using the given [BeanRegistrar].
95
+ * @param registrar the bean registrar that will be called to register
96
+ * additional beans
97
+ */
98
+ fun register (registrar : BeanRegistrar ) {
99
+ return registry.register(registrar)
100
+ }
101
+
67
102
/* *
68
103
* Given a name, register an alias for it.
69
104
* @param name the canonical name
@@ -345,39 +380,6 @@ open class BeanRegistrarDsl(private val init: BeanRegistrarDsl.() -> Unit): Bean
345
380
return registry.registerBean(T ::class .java, customizer)
346
381
}
347
382
348
- /* *
349
- * Register beans using the given [BeanRegistrar].
350
- * @param registrar the bean registrar that will be called to register
351
- * additional beans
352
- */
353
- fun register (registrar : BeanRegistrar ) {
354
- return registry.register(registrar)
355
- }
356
-
357
- /* *
358
- * Apply the nested block if the given profile expression matches the
359
- * active profiles.
360
- *
361
- * A profile expression may contain a simple profile name (for example
362
- * `"production"`) or a compound expression. A compound expression allows
363
- * for more complicated profile logic to be expressed, for example
364
- * `"production & cloud"`.
365
- *
366
- * The following operators are supported in profile expressions:
367
- * - `!` - A logical *NOT* of the profile name or compound expression
368
- * - `&` - A logical *AND* of the profile names or compound expressions
369
- * - `|` - A logical *OR* of the profile names or compound expressions
370
- *
371
- * Please note that the `&` and `|` operators may not be mixed
372
- * without using parentheses. For example, `"a & b | c"` is not a valid
373
- * expression: it must be expressed as `"(a & b) | c"` or `"a & (b | c)"`.
374
- * @param expression the profile expressions to evaluate
375
- */
376
- fun profile (expression : String , init : BeanRegistrarDsl .() -> Unit ) {
377
- if (env.matchesProfiles(expression)) {
378
- init ()
379
- }
380
- }
381
383
382
384
/* *
383
385
* Context available from the bean instance supplier designed to give access
0 commit comments