使用基于Java的配置在Spring中启用绝对顺序,而不是使用XML。

huangapple 未分类评论57阅读模式
英文:

Enable absolute ordering in spring using java based configuration instead of xml

问题

我想使用Java代码配置添加/启用absolute-ordering。以下是我们在web.xml中使用基于XML的配置:

<absolute-ordering/>

我有一个通过@Configuration@EnableWebMvc进行配置的类,还有另一个实现了WebApplicationInitializer接口的类。

英文:

I want to add/enable the absolute-ordering using java code configuration. Below is the xml based configuration we do in web.xml

&lt;absolute-ordering/&gt;

I am having a class that is configured using @Congiguration and @EnableWebMvc and another class that implements WebApplicationInitializer interface.

答案1

得分: 0

以下是翻译好的内容:

它对我起作用。

显然,您的类路径上有多个 spring-webspring-webmvc 的 JAR 包。或者还有其他贡献该文件的依赖项。
从您的类路径中移除这些源 JAR 包。
文件的名称分别是
spring-web-5.3.0-sources.jar
spring-webmvc-5.3.0-sources.jar

我在这个链接上找到了解决方案。

对于基于 XML 的配置,请使用:
<display-name> 标签之后,将 <absolute-ordering /> 标签添加到您的 web.xml 中。应该可以正常工作。

英文:

It worked for me.

Apparently you have multiple spring-web or spring-webmvc jars on your class path.
Or another dependencies that contributes that file as well.
Remove the source jars from your classpath.
Name of the file are
spring-web-5.3.0-sources.jar and
spring-webmvc-5.3.0-sources.jar

I found the solution at this link

For xml base configuration make use of:
add &lt;absolute-ordering /&gt; tag to your web.xml just under the <display-name> tag. should work fine.

huangapple
  • 本文由 发表于 2020年7月27日 20:57:49
  • 转载请务必保留本文链接:https://java.coder-hub.com/63115834.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定