无法在Spring Web应用程序中打开属性文件

尼克·M

我正在尝试在tomcat上设置几个Web应用程序,但是没有获取任何属性文件

2014-02-19 15:47:02,106 - WARN  org.springframework.core.io.support.PropertiesLoaderSupport - Could not load properties from class
 path resource [indexing.properties]: class path resource [indexing.properties] cannot be opened because it does not exist
2014-02-19 15:47:02,110 - WARN  org.springframework.core.io.support.PropertiesLoaderSupport - Could not load properties from class
 path resource [user-service.properties]: class path resource [user-service.properties] cannot be opened because it does not exist
2014-02-19 15:47:05,169 - WARN  com.cubeia.backoffice.users.Configuration - No user-service.properties configuration file found. U
sing default.

/WEB-INF/classes/service.xml文件具有以下定义:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>classpath:default-indexing.properties</value>
            <value>classpath:indexing.properties</value>
        </list>
    </property>
    <property name="ignoreResourceNotFound" value="true" />
</bean>

我尝试将.property文件复制到我能想到的任何地方。tomcat / conf,tomcat / lib,tomcat / conf / Catalina,tomcat / conf / catalina / localhost,webapps // WEB-INF /,webapps // WEB-INF / classes /,然后也位于与实际目录相同的目录中。类文件,临时目录,您为它命名。只是不会拿起它。

以后的编辑:我还尝试了/ WEB-INF / classes,WEB-INF /,tomcat / conf,tomcat / lib,classpath *等值:...基本上所有可能的组合。

软件工程师

您应该将属性文件放在webapp的src / main / resources目录中。然后,Maven(假设您正在使用maven)会将文件复制到您的WEB-INF / classes目录中,并将其放在您的类路径中。然后,如果您遵循@arahant的回答,一切都会好起来的。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法在应用程序中打开.pdf文件

无法在外部应用程序中打开PDF文件

无法在 QuickLook 应用程序中打开 USDZ 文件

在Spring MVC应用程序中打开静态文件

为什么我无法在Web ASP应用程序中打开自定义web.config文件?

无法从JUnit的Spring Boot中读取应用程序属性?

无法通过“在<我的应用程序>”中打开“打开”文件从iOS文件应用程序打开文件:提供的文件URL上没有文件

应用程序无法在牛轧糖中打开

Spring Boot 1.5.9版应用程序无法打开视图文件,未找到错误404

为什么我的 Spring Boot Web 应用程序无法加载其配置属性?

无法从服务器 URL 打开 Web 应用程序

尝试在Spring Boot / Spring Security Web应用程序中打开.css文件时,为什么会出现“ 405-不允许使用方法”错误?

读取多个文件时,ggplot图形未显示在闪亮的应用程序中-无法打开连接

Web应用程序中的Spring线程

无法打开特定的Excel文件-应用程序崩溃

Jenkins Gradle应用程序:mergeDebugResources无法打开PNG文件

WPF 应用程序无法通过文件关联打开

自动运行的Python应用程序无法打开文件

MacOS 应用程序无法重新打开自动保存的文件

如何在Spring MVC应用程序中显示JSP中属性文件中的值

无法在Weblogic 12c上部署Spring Boot应用程序(非Web)war文件

无法启动Spring Boot Web应用程序

无法使用Spring Boot运行Web应用程序

Spring Boot Web应用程序无法启动

Spring Web 应用程序。无法查看视图页面

无法访问Grails 3中的Web应用程序文件夹文件

无法使用@Value在Spring应用程序中获取Maven project.version属性

无法在 Junit 测试中覆盖 Spring-Boot 应用程序属性

无法使用Spring Boot应用程序映射HTML文件