在SpringXML配置中,SpEL可以与导入语句一起使用吗

在SpringXML配置中,SpEL可以与导入语句一起使用吗,spring,Spring,我试图在SpringXML配置中的import语句中使用SpEL。 我正在努力做到这一点 <import resource="classpath*:/'#{'${enable.mass.quote.service:false}'=='true' ? 'massquoting' : 'quoting'}'-beans.xml"/> 但它不起作用,请提供任何建议实际上你是对的:不支持SpEL,但它支持属性占位符: // Resolve system properties: e.g.

我试图在SpringXML配置中的import语句中使用SpEL。 我正在努力做到这一点

<import resource="classpath*:/'#{'${enable.mass.quote.service:false}'=='true' ? 'massquoting' : 'quoting'}'-beans.xml"/>


但它不起作用,请提供任何建议实际上你是对的:
不支持SpEL,但它支持
属性占位符

// Resolve system properties: e.g. "${user.dir}"
location = environment.resolveRequiredPlaceholders(location);
因此,对于您的情况,它可能看起来像:

<import resource="classpath*:/${enable.mass.quote.service:quoting}-beans.xml"/>

我也遇到了这个要求,结果发现答案是否定的。SpEL或占位符不能在Spring导入语句中使用,因为导入发生在占位符/表达式被计算和替换之前。参考Spring概要文件就是答案,因为Spring概要文件是从Spring 3.1.x开始浮动的,所以当使用较旧版本的Spring时,可能需要承担编写自定义概要文件的繁重任务

如何删除关于SpEL的引号?所有这些组合都已经尝试过了,没有进展,所以只想确认是否可以在导入中使用SpEL?以前有人用过吗?我也用过配置文件,请参见下面的配置
<beans profile="service">
    <import resource="classpath*:/massquoting-beans.xml"/>
</beans>

<beans profile="nonService">
    <import resource="classpath*:/quoting-beans.xml"/>
</beans>