Spring Boot Executable jar structure

前端 未结 2 745
深忆病人
深忆病人 2021-01-14 20:50

I\'m trying to run Spring Boot sample application. And I added couple of images in \"images\" folder under webapp folder (same level as WEB-INF).

I created executabl

相关标签:
2条回答
  • 2021-01-14 21:22

    This is covered in the documentation about static resources:

    Do not use the src/main/webapp folder if your application will be packaged as a jar. Although this folder is a common standard, it will only work with war packaging and it will be silently ignored by most build tools if you generate a jar.

    You should place your static resources in src/main/resources instead.

    0 讨论(0)
  • 2021-01-14 21:34

    Follow the given structure to create fat jar :

    Demo
    └── src
    |    ├── main
    |    │   ├── java
    |    │   │     └── org
    |    │   │          └── demo
    |    │   │                └── App.java
    |    │   └── resources
    |    │       └── application.properties
    |    |       |
    |    |       └── META-INF
    |    |       |        └── resources
    |    |       |                 └── jsp
    |    |       └── static
    |    |              └── css
    |    |              └── js
    |    |    
    |    └── test
    |         └── java
    |               └── org
    |                    └── demo
    |                          └── App.java  
    ├──── pom.xml
    
    0 讨论(0)
提交回复
热议问题