From aeed3c963b5dffdccc4589391897b90638f04e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Thu, 30 Oct 2025 15:02:00 +0100 Subject: [PATCH] Move the "Groovy Bean Definition DSL" section This commit moves the "Groovy Bean Definition DSL" section to the Groovy page Closes gh-35721 --- .../modules/ROOT/pages/core/beans/basics.adoc | 34 ------------------ .../modules/ROOT/pages/languages/groovy.adoc | 35 +++++++++++++++++-- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/core/beans/basics.adoc b/framework-docs/modules/ROOT/pages/core/beans/basics.adoc index 25217f97f65..ea07e2be83d 100644 --- a/framework-docs/modules/ROOT/pages/core/beans/basics.adoc +++ b/framework-docs/modules/ROOT/pages/core/beans/basics.adoc @@ -239,40 +239,6 @@ The namespace itself provides the import directive feature. Further configuration features beyond plain bean definitions are available in a selection of XML namespaces provided by Spring -- for example, the `context` and `util` namespaces. -[[beans-factory-groovy]] -=== The Groovy Bean Definition DSL - -As a further example for externalized configuration metadata, bean definitions can also -be expressed in Spring's Groovy Bean Definition DSL, as known from the Grails framework. -Typically, such configuration live in a ".groovy" file with the structure shown in the -following example: - -[source,groovy,indent=0,subs="verbatim,quotes"] ----- - beans { - dataSource(BasicDataSource) { - driverClassName = "org.hsqldb.jdbcDriver" - url = "jdbc:hsqldb:mem:grailsDB" - username = "sa" - password = "" - settings = [mynew:"setting"] - } - sessionFactory(SessionFactory) { - dataSource = dataSource - } - myService(MyService) { - nestedBean = { AnotherBean bean -> - dataSource = dataSource - } - } - } ----- - -This configuration style is largely equivalent to XML bean definitions and even -supports Spring's XML configuration namespaces. It also allows for importing XML -bean definition files through an `importBeans` directive. - - [[beans-factory-client]] == Using the Container diff --git a/framework-docs/modules/ROOT/pages/languages/groovy.adoc b/framework-docs/modules/ROOT/pages/languages/groovy.adoc index ab86c3d0c22..a552fdf61ea 100644 --- a/framework-docs/modules/ROOT/pages/languages/groovy.adoc +++ b/framework-docs/modules/ROOT/pages/languages/groovy.adoc @@ -6,6 +6,37 @@ Groovy is a powerful, optionally typed, and dynamic language, with static-typing compilation capabilities. It offers a concise syntax and integrates smoothly with any existing Java application. +[[beans-factory-groovy]] +== The Groovy Bean Definition DSL + The Spring Framework provides a dedicated `ApplicationContext` that supports a Groovy-based -Bean Definition DSL. For more details, see -xref:core/beans/basics.adoc#beans-factory-groovy[The Groovy Bean Definition DSL]. +Bean Definition DSL, as known from the Grails framework. + +Typically, such configuration live in a ".groovy" file with the structure shown in the +following example: + +[source,groovy,indent=0,subs="verbatim,quotes"] +---- + beans { + dataSource(BasicDataSource) { + driverClassName = "org.hsqldb.jdbcDriver" + url = "jdbc:hsqldb:mem:grailsDB" + username = "sa" + password = "" + settings = [mynew:"setting"] + } + sessionFactory(SessionFactory) { + dataSource = dataSource + } + myService(MyService) { + nestedBean = { AnotherBean bean -> + dataSource = dataSource + } + } + } +---- + +This configuration style is largely equivalent to XML bean definitions and even +supports Spring's XML configuration namespaces. It also allows for importing XML +bean definition files through an `importBeans` directive. +