suchen

Heim  >  Fragen und Antworten  >  Hauptteil

java - maven 打开一个普通文件,应该使用什么路径?

maven中,我需要读取一个本地文件,以为放在resource目录下就可以了,然而提示找不到文件的错误,不过换成绝对路径能够读取。
另外,如果想在spring中配置它的路径应该怎么配置呢?

PHPzPHPz2890 Tage vor313

Antworte allen(1)Ich werde antworten

  • 天蓬老师

    天蓬老师2017-04-17 18:00:15

    **<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:applicationContext.xml</param-value>
    </context-param>
    classpath: 这个就是指的是maven构建的项目中的resource目录下的路径。你可以试试看。*

    Antwort
    0
  • StornierenAntwort