SpringBoot无法访问webapp目录下的文件

springboot version:2.1.9-RELEASE

解决方案:

  在pom中添加此段 完美解决,代码的作用是让src/main/webapp在编译的时候在resoureces路径下也生成webapp的文件

    <build>
        <resources>
            <resource>
                <directory>src/main/webapp</directory>
                <targetPath>META-INF/resources</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
        </resources>
    </build>

猜你喜欢

转载自www.cnblogs.com/arebirth/p/springbootcantaccessstaticforwebapp.html