Я пытаюсь запустить свое приложение на JBoss EAP-6.4, но получаю следующую ошибку:
17:29:27,353 WARN [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (ServerService Thread Pool -- 62) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.xxx.yyy.appname.Config]; nested exception is java.io.FileNotFoundException: class path resource [git.properties] cannot be opened because it does not exist
17:29:27,369 ERROR [org.springframework.web.servlet.DispatcherServlet] (ServerService Thread Pool -- 62) Context initialization failed: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.xxx.yyy.appname.Config]; nested exception is java.io.FileNotFoundException: class path resource [git.properties] cannot be opened because it does not exist
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE]
Это странно, потому что приложение работает без проблем в WebSphere 8.5.5 и читает параметрыиз файла конфигурации без проблем.
Файл git.properties
находится в каталоге: src/main/webapp
в проекте.
Это класс конфигурации.
@Configuration
@ImportResource({"classpath*:META-INF/spring/applicationContext.xml"})
@PropertySource("classpath:git.properties")
@ComponentScan("com.myapplication.controller")
@EnableWebMvc
@EnableSpringDataWebSupport
public class Config extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
}
Я прочитал документацию , но я до сих пор не знаю, что происходит и что может быть не так.