2016-04-22 29 views
1

我有我的服務器在tomcat 8上運行,我使用了沒有任何澤西組件的Spring Boot框架,但仍然從某些原因,當我啓動我的服務器時, :爲什麼在我的Spring引導中顯示球衣MVC

信息:春WebApplicationInitializers類路徑檢測:org.springframework.boot.autoconfigure[email protected]310ddd95,[email protected]]

注:我的服務器只運行很好,但我沒有使用任何澤西島,所以爲什麼我得到這個信息?

這是我的主要配置類:

@ImportResource({"classpath:/META-INF/application-context.xml"}) 
@SpringBootApplication 
@EnableAspectJAutoProxy 
@EnableScheduling 
public class DemoApplication {...} 

這是另一種的conf類:

@Configuration 
@AutoConfigureAfter(DispatcherServletAutoConfiguration.class) 
public class CustomWebMvcAutoConfig extends WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter {...} 

另外的conf類:

@Configuration 
@EnableWebSecurity 
public class SecurityConfiguration {} 

而且也是這一個(我認爲是大問題)

public class ServletInitializer extends SpringBootServletInitializer { 

    @Override 
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 
     return application.sources(DemoApplication.class); 
    } 

} 

回答

2

org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration是彈簧啓動的一部分,並且包含自動配置爲新澤西(這是當澤西是在類路徑唯一活性)。但是,它還包含一個內部類,它實現了接口WebApplicationInitializer,並且由於Spring檢測到該接口的所有實現,就會得到此日誌消息(如您​​所見,這隻出現在所有實現的列表中,其中還包含您的實現接口的WebApplicationInitializer)。

但是,也許這是一個錯誤,因爲在我看來,它不應該檢測WebApplicationInitializer,如果周圍的自動配置不活動。在這種情況下,您應該在Spring Boot的Github項目中打開一個錯誤報告(https://github.com/spring-projects/spring-boot/issues)。

+0

我必須問,你怎麼知道「周圍的自動配置不活躍」? – winter

+0

你說,你使用Spring Boot「沒有任何Jersey組件」。所以我假設你在類路徑中沒有任何Jersey相關的依賴關係。然後自動配置不應該是主動的。當然,如果你的類路徑上有Jersey,它就會像它應該那樣工作,你應該清理你的依賴關係。 – dunni

+0

以及我的類路徑中沒有任何依賴項,並且我沒有使用任何澤西(甚至爲了以防萬一清理了我的未使用的導入),所以基本上我會去找一個錯誤報告... :) – winter

相關問題