これは、これは私のプロジェクトのディレクトリ構造スプリングブートアプリケーション。スタータークラスは、.xmlのファイルを見つけることができません
そして、私はそれがこの
を出力するアプリケーションを実行していますです@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
@ImportResource("classpath : web.xml")
public class WebPortalApplication {
public static void main(String[] args) {
SpringApplication.run(WebPortalApplication.class, args);
}
}
私のスターターアプリケーションクラスであります
Caused by: java.io.FileNotFoundException: class path resource [classpath : web.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
誰でもこの問題を解決できますか?
@ImportResourceアノテーションは、Spring Bean定義ファイル用です。 デプロイメント記述子をインポートしようとしている場合(ファイル "web.xml"という名前から推測します)、Springブートが提供できるTomcat/Jetty/Undertowサーバを使用することをお勧めします。もはやデプロイメント記述子が必要ありません。 http://docs.spring.io/spring-boot/docs/1.5.x/reference/htmlsingle/#boot-features-developing-web-applications – aaguilera