springboot solves the problem of inaccessible static resources (solved)

springboot solves the problem of inaccessible static resources


First of all, my directory structure is as follows:

Insert picture description here
Static resources are placed in the static folder

Then the solution is:
add the following code in application.properties

## 静态资源访问配置
spring.mvc.static-path-pattern=/static/**

/ Is your resources directory, the above code means that all resources in the resources/static directory can be accessed

Before
Insert picture description here
adding code: After adding code:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43520670/article/details/111659400