Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们的应用程序用于@Bean定义创建 bean 并将它们加载到 Spring 上下文中。我们现在需要将这些外部化,以便在不接触 java 源代码的情况下配置应用程序。
@Bean
我们希望@Bean用 Groovy 类替换 's。
有没有办法注释 Groovy bean 以便 Spring 拾取它?
请注意,我们不能简单地引用 Spring XML 中的每个 Groovy bean,因为我们需要在不接触 Spring 代码的情况下添加和修改 bean。
非常感谢。
使用 Spring 配置继承。
将所有共享代码移动到每个单独/特定项目所依赖的公共“基础”项目中。为此使用 Maven。
创建一个通用 / 基础 Spring 配置并将其放入“基础”项目中。此配置不包含定义ProcessDefinition
ProcessDefinition
在特定项目中,创建一个继承自ProcessDefinition. 创建一个导入基本配置并在其中定义单个特定 bean 的 Spring 配置。