Package a spring boot application including JSPs and static resources

前端 未结 5 2131
面向向阳花
面向向阳花 2020-12-29 11:46

I want to package a spring-boot application as jar, and I do so with mvn package.

This produces a jar which does not contain any /WEB-INF/jsp

5条回答
  •  遥遥无期
    2020-12-29 12:29

    The following example works with Spring Boot 1.3.3.RELEASE: https://github.com/ghillert/spring-boot-jsp-demo

    The key is to put the static jsp content in:

    /src/main/resources/META-INF/resources/WEB-INF/jsp
    

    and ensure you define the view prefix/suffix in your application.properties:

    spring.mvc.view.prefix=/WEB-INF/jsp/
    spring.mvc.view.suffix=.jsp
    

提交回复
热议问题