有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

正在加载java复制spring配置?

我在看tomcat加载的spring的输出,有一件非常奇怪的事情。。。一切都是重复的。这是什么原因造成的?不管是什么,它都会导致我的应用程序以奇怪的方式运行

其他信息:

该应用程序是一个web应用程序。使用上下文加载器(?)加载所有spring信息在网络上定义。xml文件。我的配置文件被拆分为6个左右的文件

调试输出示例:

[DEBUG,DefaultFilterInvocationDefinitionSource,main] Added URL pattern: /**; attributes: [REQUIRES_SECURE_CHANNEL]

[DEBUG,DefaultFilterInvocationDefinitionSource,main] Added URL pattern: /**; attributes: [REQUIRES_SECURE_CHANNEL]

[DEBUG,DefaultFilterInvocationDefinitionSource,main] Added URL pattern: /**; attributes: [ROLE_READ, ROLE_UPDATE]

[DEBUG,DefaultFilterInvocationDefinitionSource,main] Added URL pattern: /**; attributes: [ROLE_READ, ROLE_UPDATE]

[DEBUG,AbstractFallbackMethodDefinitionSource,main] Adding security method [CacheKey[com.service.impl.FooServiceImpl; public abstract java.lang.Boolean com.service.IFooService.saveOrUpdateFoo(com.model.Foo2,java.lang.String) throws org.springframework.dao.DataAccessException]] with attribute [[ROLE_UPDATE]]

[DEBUG,AbstractFallbackMethodDefinitionSource,main] Adding security method [CacheKey[com.service.impl.FooServiceImpl; public abstract java.lang.Boolean com.service.IFooService.saveOrUpdateFoo(com.model.Foo2,java.lang.String) throws org.springframework.dao.DataAccessException]] with attribute [[ROLE_UPDATE]]

[INFO,AbstractSecurityInterceptor,main] Validated configuration attributes

[INFO,AbstractSecurityInterceptor,main] Validated configuration attributes


共 (3) 个答案

  1. # 1 楼答案

    在Tomcat中,如果应用程序被配置为默认应用程序,那么它必须部署在/root目录下。如果没有,Tomcat将启动应用程序的两个副本,一个在您放置的位置,另一个在它预期的默认位置

    这可以解释这里发生了什么,假设我正确地回忆了所有这些

  2. # 2 楼答案

    我和你面临同样的问题,这只是一个log4j配置问题,这是我最初的配置

    <category name="org.springframework">
        <level value="INFO"></level>
        <appender-ref ref="basicAppender" />
    </category>
    

    在这个配置中,包org中的所有类。springframework将记录一次,由于我没有将additivity属性设置为false,记录器“org.springframework”将再次记录,结果所有日志都被复制。所以我只是把加法属性设为false,它就行了。这只是我的情况,希望能对你有所帮助

  3. # 3 楼答案

    您确定日志配置中的某些内容没有多次将每个类别/记录器添加到appender吗

    这在log4j中是可能的,但不确定JCL或Tomcat最新版本在封面下使用的任何东西