异常将上下文初始化事件发送到类org.springframework.web.context.ContextLoaderListener的侦听器实例 org.springframework.beans.factory.BeanInitializationException:无法加载属性;嵌套异常是java.io.FileNotFoundException:class pat h资源[WEB-INF / config / redis.properties]无法打开,因为它不存在 at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:89) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284) 在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:166) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681) 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523) 在org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) 在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) 在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842) 在org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 在org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092) 在org.apache.catalina.startup.HostConfig $ DeployDirectory.run(HostConfig.java:1834) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:471) 在java.util.concurrent.FutureTask.run(FutureTask.java:262) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615) 在java.lang.Thread.run(Thread.java:744) 引起:java.io.FileNotFoundException:无法打开类路径资源[WEB-INF / config / redis.properties],因为它不存在 在org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) 在org.springframework.core.io.support.EncodedResource.getInputStream(EncodedResource.java:153) 在org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:98) 在org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:175) 在org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:156) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:80) ......还有20个
答案 0 :(得分:0)
将你的config目录移到src / main / resources /目录中,你的配置应该是
<context:property-placeholder location="classpath:config/redis.properties"/>