|
对于最新的稳定版本,请使用 Spring Framework 7.0.6! |
动态语言支持
Spring 提供了全面的支持,用于使用通过动态语言(如 Groovy)定义的类和对象。这种支持使您可以用受支持的动态语言编写任意数量的类,并让 Spring 容器透明地实例化、配置和依赖注入这些对象。
Spring的脚本支持主要针对Groovy和BeanShell。除了这些特定支持的语言之外,JSR-223脚本机制也用于与任何JSR-223兼容的语言提供者进行集成(自Spring 4.2起),例如JRuby。
您可以找到此动态语言支持可以立即有用的完整示例 情景。
第一个示例
本章的大部分内容旨在详细描述动态语言支持。在深入探讨动态语言支持的所有细节之前,我们先看一个用动态语言定义的 bean 的快速示例。第一个 bean 使用的动态语言是 Groovy。(此示例的基础来自 Spring 测试套件。如果您想查看其他任何支持的语言中的等效示例,请查看源代码)。
下一个示例显示了 Messenger 接口,Groovy bean 将要实现该接口。请注意,此接口是用纯 Java 定义的。使用对 Messenger 的引用进行注入的依赖对象并不知道底层实现是一个 Groovy 脚本。下列列表显示了 Messenger 接口:
package org.springframework.scripting;
public interface Messenger {
String getMessage();
}
以下示例定义了一个类,该类依赖于 Messenger 接口:
package org.springframework.scripting;
public class DefaultBookingService implements BookingService {
private Messenger messenger;
public void setMessenger(Messenger messenger) {
this.messenger = messenger;
}
public void processBooking() {
// use the injected Messenger object...
}
}
以下示例在Groovy中实现了<code>0</code>接口:
package org.springframework.scripting.groovy
// Import the Messenger interface (written in Java) that is to be implemented
import org.springframework.scripting.Messenger
// Define the implementation in Groovy in file 'Messenger.groovy'
class GroovyMessenger implements Messenger {
String message
}
|
要使用自定义的动态语言标签来定义基于动态语言的Bean,您需要在Spring XML配置文件的顶部包含XML Schema前导。您还需要使用Spring 有关基于架构的配置的更多信息,请参阅 基于 XML 架构的配置。 |
最后,下面的示例显示了影响将Groovy定义的Messenger实现注入到DefaultBookingService类实例中的bean定义:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:lang="http://www.springframework.org/schema/lang"
xsi:schemaLocation="
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/lang https://www.springframework.org/schema/lang/spring-lang.xsd">
<!-- this is the bean definition for the Groovy-backed Messenger implementation -->
<lang:groovy id="messenger" script-source="classpath:Messenger.groovy">
<lang:property name="message" value="I Can Do The Frug" />
</lang:groovy>
<!-- an otherwise normal bean that will be injected by the Groovy-backed Messenger -->
<bean id="bookingService" class="x.y.DefaultBookingService">
<property name="messenger" ref="messenger" />
</bean>
</beans>
The bookingService bean (a DefaultBookingService) now can use its private messenger
member variable as normal, because the Messenger instance that was injected into it is
a Messenger instance. There is nothing special going on here — just plain Java and
plain Groovy.
希望前面的XML代码片段是不言自明的,但如果它不是,也不必过于担心。继续阅读,了解前面配置的详细原因和背景。
定义由动态语言支持的Bean
本节准确描述了如何在任何支持的动态语言中定义由Spring管理的Bean。
请注意,本章并不试图解释所支持的动态语言的语法和习惯用法。例如,如果您想使用 Groovy 来编写应用程序中的某些类,我们假设您已经了解 Groovy。如果需要有关这些动态语言的更多信息,请参阅本章末尾的 进一步资源。
常见概念
使用动态语言支持的 Bean 的步骤如下:
-
为动态语言源代码编写测试(自然地)。
-
然后编写动态语言的源代码本身。
-
通过在XML配置中使用适当的
<lang:language/>元素来定义基于动态语言的bean(您可以通过使用Spring API以编程方式定义此类bean,尽管您需要查阅源代码以了解如何执行此操作,因为本章不涉及此类高级配置)。 请注意,这是一个迭代步骤。您需要为每个动态语言源文件至少定义一个bean(尽管多个bean定义可以引用同一个源文件)。
前两步(测试和编写你的动态语言源文件)超出了本章的范围。请参阅你所选择的动态语言的语言规范和参考手册,并开始开发你的动态语言源文件。不过,你首先还是想阅读本章的其余部分,因为Spring的动态语言支持对你动态语言源文件的内容做了一些(小的)假设。
<lang:language/> 元素
列表中的最后一步在上一节的前一节中涉及定义基于动态语言的bean定义,每个您想要配置的bean都要定义一个(这与普通的JavaBean配置没有区别)。然而,您不需要指定由容器实例化和配置的类的全限定类名,而是可以使用<lang:language/>元素来定义基于动态语言的bean。
每种支持的语言都有一个对应的 <lang:language/> 元素:
-
<lang:groovy/>(Groovy) -
<lang:bsh/>(BeanShell) -
<lang:std/>(JSR-223,例如使用 JRuby)
确切的属性和子元素可用性取决于 bean 是在哪种语言中定义的(本章后面的特定于语言的部分详细说明了这一点)。
可刷新的 Bean
动态语言支持在Spring中的一个(也许是唯一的)最有价值的增强功能是“可刷新的Bean”特性。
一个可刷新的 Bean 是一种由动态语言支持的 Bean。通过少量的配置,由动态语言支持的 Bean 可以监控其底层源文件资源的变化,并在动态语言源文件发生变化时重新加载自身(例如,当您在文件系统中编辑并保存文件更改时)。
这使您可以在应用程序中部署任意数量的动态语言源文件,配置Spring容器以使用本章描述的机制,由动态语言源文件支持创建Bean,并且(在需求变化或某些其他外部因素出现后)编辑动态语言源文件,使他们所做的任何更改都能反映在由该更改的动态语言源文件支持的Bean中。无需关闭正在运行的应用程序(对于Web应用程序而言,也无需重新部署)。经修改的基于动态语言的Bean会从更改后的动态语言源文件中获取新的状态和逻辑。
| 此功能默认是关闭的。 |
现在我们可以看一个例子,了解使用可刷新的Bean有多么简单。要启用可刷新的Bean功能,您必须在Bean定义的<lang:language/>元素上指定一个额外的属性。因此,如果我们继续使用本章前面的示例,下面的例子将展示我们在Spring XML配置中需要进行哪些更改以实现可刷新的Bean:
<beans>
<!-- this bean is now 'refreshable' due to the presence of the 'refresh-check-delay' attribute -->
<lang:groovy id="messenger"
refresh-check-delay="5000" <!-- switches refreshing on with 5 seconds between checks -->
script-source="classpath:Messenger.groovy">
<lang:property name="message" value="I Can Do The Frug" />
</lang:groovy>
<bean id="bookingService" class="x.y.DefaultBookingService">
<property name="messenger" ref="messenger" />
</bean>
</beans>
你所需要做的就是这些。在messenger bean定义上定义的refresh-check-delay属性表示在对底层动态语言源文件进行任何更改后,bean刷新所需的毫秒数。你可以通过将负值分配给refresh-check-delay属性来关闭刷新行为。请记住,默认情况下,刷新行为是禁用的。如果你不希望启用刷新行为,请不要定义该属性。
如果我们运行以下应用程序,就可以测试可刷新功能。
(请原谅接下来这段代码中的“为暂停执行而做的繁琐操作”。
System.in.read() 的调用只是为了在你(在这种情况下是开发人员)去修改基础动态语言源文件时,让程序的执行暂停下来,这样当程序恢复执行时,就可以触发基于动态语言的 bean 的刷新。)
下列列表显示了这个示例应用程序:
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.scripting.Messenger;
public final class Boot {
public static void main(final String[] args) throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
Messenger messenger = (Messenger) ctx.getBean("messenger");
System.out.println(messenger.getMessage());
// pause execution while I go off and make changes to the source file...
System.in.read();
System.out.println(messenger.getMessage());
}
}
假设在本示例中,所有对getMessage()的Messenger实现的调用都必须更改,使得消息被引号包围。以下列表显示了当程序执行暂停时,您(开发者)应对Messenger.groovy源文件进行的更改:
package org.springframework.scripting
class GroovyMessenger implements Messenger {
private String message = "Bingo"
public String getMessage() {
// change the implementation to surround the message in quotes
return "'" + this.message + "'"
}
public void setMessage(String message) {
this.message = message
}
}
当程序运行时,在输入暂停之前的输出将是 I Can Do The Frug。
在对源文件进行更改并保存后,程序继续执行,
对动态语言支持的 getMessage() 实现调用 Messenger 方法的结果是 'I Can Do The Frug'(注意额外引号的包含)。
如果在 refresh-check-delay 值的时间窗口内发生脚本更改,则不会触发刷新。对脚本的更改实际上直到调用基于动态语言的 bean 的方法时才会被检测到。只有在对基于动态语言的 bean 调用方法时,才会检查其底层脚本源是否已更改。与刷新脚本相关的任何异常(例如遇到编译错误或发现脚本文件已被删除)会导致致命异常传播到调用代码。
前面描述的可刷新Bean行为不适用于使用<lang:inline-script/>元素符号定义的动态语言源文件(参见内联动态语言源文件)。此外,它仅适用于可以实际检测到底层源文件更改的Bean(例如,通过检查存在于文件系统上的动态语言源文件的最后修改日期的代码)。
内联动态语言源文件
动态语言支持还可以处理直接嵌入Spring bean定义中的动态语言源文件。更具体地说,<lang:inline-script/>元素允许您在Spring配置文件内部直接定义动态语言源。一个例子可以说明内联脚本功能的工作方式:
<lang:groovy id="messenger">
<lang:inline-script>
package org.springframework.scripting.groovy
import org.springframework.scripting.Messenger
class GroovyMessenger implements Messenger {
String message
}
</lang:inline-script>
<lang:property name="message" value="I Can Do The Frug" />
</lang:groovy>
如果暂且不考虑在Spring配置文件中定义动态语言源代码是否是良好的实践,<lang:inline-script/>元素在某些情况下可能会很有用。例如,我们可能想要快速地向Spring MVC Controller添加一个Spring Validator实现。使用内联源代码只需片刻即可完成。(参见脚本验证器以获取此类示例。)
了解动态语言支持的 Bean 中的构造函数注入
与 Spring 的动态语言支持有关,有一件非常重要的事情需要留意。即,目前你无法为基于动态语言的 Bean 提供构造函数参数(因此,基于动态语言的 Bean 也不支持构造函数注入)。为了使对构造函数和属性的特殊处理完全清晰,以下代码和配置的混合使用是无效的:
package org.springframework.scripting.groovy
import org.springframework.scripting.Messenger
// from the file 'Messenger.groovy'
class GroovyMessenger implements Messenger {
GroovyMessenger() {}
// this constructor is not available for Constructor Injection
GroovyMessenger(String message) {
this.message = message;
}
String message
String anotherMessage
}
<lang:groovy id="badMessenger"
script-source="classpath:Messenger.groovy">
<!-- this next constructor argument will not be injected into the GroovyMessenger -->
<!-- in fact, this isn't even allowed according to the schema -->
<constructor-arg value="This will not work" />
<!-- only property values are injected into the dynamic-language-backed object -->
<lang:property name="anotherMessage" value="Passed straight through to the dynamic-language-backed object" />
</lang>
在实际应用中,这种限制并没有看起来那么严重,因为设值注入是绝大多数开发人员偏好的注入方式(我们暂且将是否这是好事的讨论留到另一天)。
Groovy Beans
本节描述如何在Spring中使用Groovy中定义的beans。
Groovy首页包含以下描述:
“Groovy 是一种适用于 Java 2 平台的敏捷动态语言,它具有人们在 Python、Ruby 和 Smalltalk 等语言中非常喜欢的许多特性,使用类似 Java 的语法,使这些特性对 Java 开发人员可用。”
如果您从头到尾阅读了这一章,您已经 看过一个示例,该示例使用了基于Groovy动态语言的 bean。现在考虑另一个示例(再次使用Spring测试套件中的一个示例):
package org.springframework.scripting;
public interface Calculator {
int add(int x, int y);
}
以下示例在Groovy中实现了<code>0</code>接口:
package org.springframework.scripting.groovy
// from the file 'calculator.groovy'
class GroovyCalculator implements Calculator {
int add(int x, int y) {
x + y
}
}
以下 bean 定义使用了在 Groovy 中定义的计算器:
<!-- from the file 'beans.xml' -->
<beans>
<lang:groovy id="calculator" script-source="classpath:calculator.groovy"/>
</beans>
最后,以下这个小型应用程序测试了前面的配置:
package org.springframework.scripting;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Main {
public static void main(String[] args) {
ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
Calculator calc = ctx.getBean("calculator", Calculator.class);
System.out.println(calc.add(2, 8));
}
}
运行上述程序后的结果(不出所料)是 10。
(有关更有趣的示例,请参阅动态语言展示项目中的更复杂示例,或查看本章后面的例子 场景)。
你不能在Groovy源文件中定义多个类。虽然这在Groovy中是完全合法的,但(可以说)是一种不好的做法。为了保持一致的方法,根据Spring团队的意见,你应该遵守标准Java惯例,即每个源文件只定义一个(public)类。
通过回调自定义Groovy对象
GroovyObjectCustomizer 接口是一个回调,它允许你将额外的创建逻辑插入到创建基于 Groovy 的 bean 的过程中。例如,该接口的实现可以调用任何必需的初始化方法、设置一些默认属性值,或指定自定义的 MetaClass。下面的列表显示了 GroovyObjectCustomizer 接口的定义:
public interface GroovyObjectCustomizer {
void customize(GroovyObject goo);
}
Spring 框架会实例化您的基于 Groovy 的 bean 的一个实例,然后将创建的 GroovyObject 传递给指定的 GroovyObjectCustomizer(如果已定义的话)。您可以对提供的 GroovyObject 引用做任何您想做的事情。我们预计大多数人希望使用此回调设置自定义 MetaClass,下面的示例展示了如何做到这一点:
public final class SimpleMethodTracingCustomizer implements GroovyObjectCustomizer {
public void customize(GroovyObject goo) {
DelegatingMetaClass metaClass = new DelegatingMetaClass(goo.getMetaClass()) {
public Object invokeMethod(Object object, String methodName, Object[] arguments) {
System.out.println("Invoking '" + methodName + "'.");
return super.invokeMethod(object, methodName, arguments);
}
};
metaClass.initialize();
goo.setMetaClass(metaClass);
}
}
关于Groovy中元编程的完整讨论超出了Spring参考手册的范围。请参阅Groovy参考手册的相关部分或进行在线搜索。有很多文章涉及这个主题。实际上,如果您使用Spring命名空间支持,使用GroovyObjectCustomizer是非常简单的,如下例所示:
<!-- define the GroovyObjectCustomizer just like any other bean -->
<bean id="tracingCustomizer" class="example.SimpleMethodTracingCustomizer"/>
<!-- ... and plug it into the desired Groovy bean via the 'customizer-ref' attribute -->
<lang:groovy id="calculator"
script-source="classpath:org/springframework/scripting/groovy/Calculator.groovy"
customizer-ref="tracingCustomizer"/>
如果您不使用Spring命名空间支持,仍然可以使用
GroovyObjectCustomizer 功能,如下例所示:
<bean id="calculator" class="org.springframework.scripting.groovy.GroovyScriptFactory">
<constructor-arg value="classpath:org/springframework/scripting/groovy/Calculator.groovy"/>
<!-- define the GroovyObjectCustomizer (as an inner bean) -->
<constructor-arg>
<bean id="tracingCustomizer" class="example.SimpleMethodTracingCustomizer"/>
</constructor-arg>
</bean>
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
你也可以在Spring的CompilationCustomizer位置指定一个Groovy ImportCustomizer(例如一个CompilerConfiguration)
或者甚至一个完整的Groovy GroovyObjectCustomizer对象。此外,你可以在GroovyClassLoader级别上为你的bean设置一个通用的ConfigurableApplicationContext.setClassLoader,并进行自定义配置;
这也会导致共享的GroovyClassLoader使用,因此在有大量脚本化bean的情况下(避免每个bean都单独实例化一个GroovyClassLoader)是推荐的做法。 |
BeanShell Bean
本节描述如何在Spring中使用BeanShell beans。
该 BeanShell 主页 包含以下 描述:
BeanShell is a small, free, embeddable Java source interpreter with dynamic language features, written in Java. BeanShell dynamically runs standard Java syntax and extends it with common scripting conveniences such as loose types, commands, and method closures like those in Perl and JavaScript.
与Groovy不同,基于BeanShell的bean定义需要一些(少量)额外的配置。Spring中BeanShell动态语言支持的实现很有趣,因为Spring会创建一个JDK动态代理,该代理实现了script-interfaces属性值中指定的所有接口的<lang:bsh>元素(这就是为什么您必须在属性值中至少提供一个接口,因此在使用基于BeanShell的bean时,必须根据接口进行编程)。这意味着对基于BeanShell的对象的每个方法调用都会通过JDK动态代理调用机制。
现在我们可以展示一个使用基于BeanShell的bean的完整示例,该bean实现了本章中之前定义的Messenger接口。我们再次展示Messenger接口的定义:
package org.springframework.scripting;
public interface Messenger {
String getMessage();
}
下面的示例显示了 BeanShell 的“实现”(我们在这里松散地使用该术语)
的 Messenger 接口:
String message;
String getMessage() {
return message;
}
void setMessage(String aMessage) {
message = aMessage;
}
以下示例显示了定义上述“类”的一个“实例”的 Spring XML(再次说明,我们在这里非常宽松地使用这些术语):
<lang:bsh id="messageService" script-source="classpath:BshMessenger.bsh"
script-interfaces="org.springframework.scripting.Messenger">
<lang:property name="message" value="Hello World!" />
</lang:bsh>
查看 场景 了解可能需要使用基于 BeanShell 的 beans 的一些情况。
场景
在使用脚本语言定义Spring管理的Bean可能带来好处的场景有很多且各不相同。本节描述了Spring动态语言支持的两个可能用例。
脚本化的 Spring MVC 控制器
使用动态语言支持的 bean 的一类类是 Spring MVC 控制器。在纯 Spring MVC 应用中,Web 应用中的导航流程在很大程度上是由你的 Spring MVC 控制器中的代码所决定的。当 Web 应用的导航流程和其他表示层逻辑需要更新以应对支持问题或变化的业务需求时,通过编辑一个或多个动态语言源文件,并立即看到这些更改在运行中的应用状态中体现出来,可能会更容易实现任何所需的变化。
记得在Spring等项目所倡导的轻量级架构模式中,你通常希望拥有一个非常薄的展示层,而应用程序的所有重要业务逻辑都包含在领域和服务层类中。将Spring MVC控制器开发为由动态语言支持的Bean,使你能够通过编辑和保存文本文件来更改展示层逻辑。对这些动态语言源文件的任何更改(根据配置)会自动反映在由动态语言源文件支持的Bean中。
| 要实现对任何动态语言支持的bean的更改的自动“获取”,您必须启用“可刷新的bean”功能。有关此功能的完整说明,请参阅 可刷新的Bean。 |
以下示例显示了一个通过使用Groovy动态语言实现的org.springframework.web.servlet.mvc.Controller:
package org.springframework.showcase.fortune.web
import org.springframework.showcase.fortune.service.FortuneService
import org.springframework.showcase.fortune.domain.Fortune
import org.springframework.web.servlet.ModelAndView
import org.springframework.web.servlet.mvc.Controller
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
// from the file '/WEB-INF/groovy/FortuneController.groovy'
class FortuneController implements Controller {
@Property FortuneService fortuneService
ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse httpServletResponse) {
return new ModelAndView("tell", "fortune", this.fortuneService.tellFortune())
}
}
<lang:groovy id="fortune"
refresh-check-delay="3000"
script-source="/WEB-INF/groovy/FortuneController.groovy">
<lang:property name="fortuneService" ref="fortuneService"/>
</lang:groovy>
脚本化验证器
使用Spring进行应用开发的另一个领域,可能从动态语言支持的Bean所提供的灵活性中受益,那就是验证。与普通的Java相比,使用一种弱类型动态语言(可能还支持内联正则表达式)来表达复杂的验证逻辑可能会更加容易。
再次说明,将验证器作为动态语言支持的 Bean 进行开发,允许您通过编辑和保存一个简单的文本文件来更改验证逻辑。任何此类更改(根据配置)会自动反映在运行中的应用程序执行中,而无需重新启动应用程序。
| 要实现对任何基于动态语言的bean的更改的自动“获取”,您必须启用“可刷新的bean”功能。有关此功能的完整详细说明,请参见 可刷新的Bean。 |
以下示例显示了一个使用Groovy动态语言实现的Spring org.springframework.validation.Validator
(有关Validator接口的讨论,请参见使用Spring的Validator接口进行验证):
import org.springframework.validation.Validator
import org.springframework.validation.Errors
import org.springframework.beans.TestBean
class TestBeanValidator implements Validator {
boolean supports(Class clazz) {
return TestBean.class.isAssignableFrom(clazz)
}
void validate(Object bean, Errors errors) {
if(bean.name?.trim()?.size() > 0) {
return
}
errors.reject("whitespace", "Cannot be composed wholly of whitespace.")
}
}
附加详细信息
这一部分包含与动态语言支持相关的其他详细信息。
AOP — 通知脚本化Bean
您可以使用Spring AOP框架来建议脚本化Bean。Spring AOP框架实际上并不知道正在被建议的Bean可能是一个脚本化Bean,因此您所使用的(或旨在使用的)所有AOP用例和功能都与脚本化Bean兼容。当您建议脚本化Bean时,不能使用基于类的代理。您必须使用基于接口的代理。
你不仅限于对脚本化的Bean进行建议。你也可以在支持的动态语言中编写切面本身,并使用这些Bean来对其他Spring Bean进行建议。不过,这实际上是对动态语言支持的一种高级用法。
作用域
如果尚未明显,脚本化的Bean可以以与任何其他Bean相同的方式进行作用域设置。各种scope元素上的<lang:language/>属性允许您控制底层脚本化Bean的作用域,就像对普通Bean所做的那样。(默认作用域是单例,与“普通”Bean一样。)
以下示例使用 scope 属性来定义一个作用域为
原型 的 Groovy Bean:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:lang="http://www.springframework.org/schema/lang"
xsi:schemaLocation="
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/lang https://www.springframework.org/schema/lang/spring-lang.xsd">
<lang:groovy id="messenger" script-source="classpath:Messenger.groovy" scope="prototype">
<lang:property name="message" value="I Can Do The RoboCop" />
</lang:groovy>
<bean id="bookingService" class="x.y.DefaultBookingService">
<property name="messenger" ref="messenger" />
</bean>
</beans>
lang XML 模式
Spring XML配置中的<code>0</code>元素用于将用动态语言(如Groovy或BeanShell)编写的对象作为Spring容器中的bean公开。
这些元素(以及动态语言支持)在动态语言支持部分有全面的说明。有关此支持以及lang元素的详细信息,请参阅该部分。
要使用 lang 架构中的元素,您需要在 Spring XML 配置文件的顶部包含以下引言。以下片段中的文本引用了正确的架构,以便您能够使用 lang 命名空间中的标签:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:lang="http://www.springframework.org/schema/lang"
xsi:schemaLocation="
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/lang https://www.springframework.org/schema/lang/spring-lang.xsd">
<!-- bean definitions here -->
</beans>