Commit a0785ca0 authored by Deep Dey's avatar Deep Dey

chore: update web configuration

parent 8bec9265
package com.example.LaMartin.config;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
@Getter
public class Settings {
@Value("${lamartin.static.resources.root.path}") // Read path from application.properties
private String staticResourcesRootPath;
}
package com.example.LaMartin.config;
import lombok.AllArgsConstructor;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
......@@ -14,17 +16,16 @@ import java.util.Locale;
@Configuration
@ComponentScan(basePackages = {"com.example.LaMartin"})
@AllArgsConstructor(onConstructor_ = @__({@Autowired}))
public class WebMvcConfig implements WebMvcConfigurer {
private final Settings settings;
@Override
public void addResourceHandlers(@NotNull ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/resources/static/**")
.addResourceLocations("/");
registry
.addResourceHandler("/static/**")
.addResourceLocations("/");
.addResourceHandler("/resources/**")
.addResourceLocations("file:" + settings.getStaticResourcesRootPath() + "/");
}
@Override
......
......@@ -7,4 +7,5 @@ spring.web.resources.cache.cachecontrol.s-max-age=3600000
spring.datasource.username=postgres
spring.datasource.password=2580
spring.redis.host=localhost
spring.redis.port=6379
\ No newline at end of file
spring.redis.port=6379
lamartin.static.resources.root.path=D:/WEBSOFTTECHS/webomagic/data
\ No newline at end of file
spring.thymeleaf.cache=true
logging.level.web=DEBUG
#server.error.include-binding-errors=never
#server.error.include-message=always
server.http2.enabled=true
spring.datasource.url=jdbc:postgresql://localhost:5432/webomagic
spring.datasource.url=jdbc:postgresql://localhost:5432/lamartin
spring.web.resources.cache.cachecontrol.s-max-age=3600000
spring.datasource.username=postgres
spring.datasource.password=2580
spring.redis.host=localhost
spring.redis.port=6379
\ No newline at end of file
spring.redis.port=6379
lamartin.static.resources.root.path=D:/WEBSOFTTECHS/webomagic/data
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment