1.Spring-Boot static files and the default page placement

Static Resource Access

In our Web application development time, need to reference a lot of js, css, pictures and other static resources.


default allocation

Spring Boot default directory location to provide a static resource to be placed in the classpath, directory name, subject to the following rules:

  • /static
  • /public
  • /resources
  • /META-INF/resources

For example: we can create static in src / main / resources / directory, place a picture file at that location. After starting the program, try to access http: // localhost: 8080 / D.jpg. If they can show pictures, the configuration is successful.

Static Resource Access

In our Web application development time, need to reference a lot of js, css, pictures and other static resources. Page on the templates, this maven way different from the previously created javaweb pages into webapp.

 

Page placement

templates files in src / main / resources under the deposit plus page ------ freemarker for it


 

                                                                               Micro-channel public number: 

                                               

                                                                             JAVA program ape growth path

                          Resource sharing, recording program ape growing little by little. Focus on Java, Spring, SpringBoot, SpringCloud, distributed, slightly services. 

Guess you like

Origin www.cnblogs.com/niugang0920/p/12197111.html