mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-01-18 14:14:50 +08:00
properly serve public folder
This commit is contained in:
parent
9aa057312d
commit
aa9f3d4991
@ -2,11 +2,16 @@ package me.minidigger.hangar.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.CacheControl;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Configuration
|
||||
public class MvcConfig {
|
||||
public class MvcConfig implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
public FreeMarkerViewResolver freemarkerViewResolver() {
|
||||
@ -23,4 +28,11 @@ public class MvcConfig {
|
||||
freeMarkerConfigurer.setTemplateLoaderPath("classpath:templates");
|
||||
return freeMarkerConfigurer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/assets/**")
|
||||
.addResourceLocations("classpath:/public/")
|
||||
.setCacheControl(CacheControl.maxAge(1, TimeUnit.DAYS));
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,12 @@
|
||||
###########
|
||||
# General #
|
||||
###########
|
||||
server.port=8080
|
||||
spring.mvc.static-path-pattern=/content/**
|
||||
|
||||
############
|
||||
# DataBase #
|
||||
############
|
||||
spring.jpa.database=POSTGRESQL
|
||||
spring.datasource.platform=postgres
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/hangar
|
||||
|
Loading…
Reference in New Issue
Block a user