{"id":704,"date":"2023-10-13T16:12:51","date_gmt":"2023-10-13T07:12:51","guid":{"rendered":"https:\/\/deskplate.net\/blog\/?p=704"},"modified":"2023-10-13T16:12:59","modified_gmt":"2023-10-13T07:12:59","slug":"spring-template-engine-thymeleaf-css-no-mapping-for-get","status":"publish","type":"post","link":"https:\/\/deskplate.net\/blog\/archives\/704","title":{"rendered":"spring template engine thymeleaf css No mapping for GET 404"},"content":{"rendered":"<p>Spring + thymeleaf \u3067<br \/>\nCSS\u3084JS\u3092\u898b\u3064\u3051\u3089\u308c\u306a\u3044\u5834\u5408<\/p>\n<p>\u30ab\u30b9\u30bf\u30e0\u30af\u30e9\u30b9\u3067<br \/>\nresources\/static \u4ee5\u4e0b\u3092\u8aad\u3081\u308b\u3088\u3046\u306b\u3059\u308b<\/p>\n<pre>\r\n@Configuration\r\npublic class CustomWebMvcConfigurationSupport extends WebMvcConfigurationSupport {\r\n\r\n    private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {\r\n\t\t\t\"classpath:\/META-INF\/resources\/\", \"classpath:\/resources\/\",\r\n\t\t\t\"classpath:\/static\/\", \"classpath:\/public\/\" };\r\n\r\n    @Override\r\n\tprotected void addResourceHandlers(ResourceHandlerRegistry registry) {\r\n\t\tif (!registry.hasMappingForPattern(\"\/webjars\/**\")) {\r\n\t\t\tregistry.addResourceHandler(\"\/webjars\/**\")\r\n\t\t\t\t\t.addResourceLocations(\"classpath:\/META-INF\/resources\/webjars\/\");\r\n\t\t}\r\n\t\tif (!registry.hasMappingForPattern(\"\/**\")) {\r\n\t\t\tregistry.addResourceHandler(\"\/**\")\r\n\t\t\t\t\t.addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Spring + thymeleaf \u3067<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,63],"tags":[],"class_list":["post-704","post","type-post","status-publish","format-standard","hentry","category-java","category-spring"],"_links":{"self":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts\/704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/comments?post=704"}],"version-history":[{"count":3,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts\/704\/revisions"}],"predecessor-version":[{"id":707,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts\/704\/revisions\/707"}],"wp:attachment":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/media?parent=704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/categories?post=704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/tags?post=704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}