0
我试图将我们的应用程序从基于Spring XML的配置迁移到基于注释的配置。在我们的XML文件中的一个,说application-config.xml
,我们有以下行:基于系统属性导入Spring @Configurations
<import resource="${jobName}/beans.xml" />
这里${jobName}
是设置在JVM启动系统属性。还有其他系统属性用于加载其他XML资源。现在,在基于注释的配置中,我希望将类似@Configuration
类作为XML文件本身。因此,我有一个类ApplicationConfig
,将导入jobName
特定的Configuration
类。
我该如何做到这一点?
@Configuration
@Import({somehow-need-to-use-system-property-to-import-appropriate-class})
class ApplicationConfiguration {
//bean definitions
}
我不想保留任何我的XML文件。我想要的是将我的所有bean迁移到注释配置中,并按照我目前所做的相同方式导入它们。 –