我正在我的 Spring 应用程序中创建一个 bean。目前使用 Spring 3.2 已经相当老了。我有一个 bean xml 文件,其中根 <beans>
标签有 profile
属性。我希望当配置文件不是 test 或 uat 时创建此文件中的 bean ..所以类似 profile="!test && !uat"
ETC。
我尝试了以下方法,但 spring 不支持 &&
运算符,所以我目前有 profile="!test, !uat"
。 Spring 官方文档中写道:
If a profile is prefixed with the NOT operator '!', e.g.
<beans profile="p1,!p2">
indicates that the element should be parsed if profile "p1" is active or if profile "p2" is not active.
很明显,这在我的情况下不起作用,因为我只想在配置文件不是 test 和 uat 时创建 bean。是否有我不知道的可以使用的运算符?
最佳答案
关于java - 如何在 Spring 型材的 spel 中编写 AND 运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60599676/