diff --git a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java b/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java index 34128e64fa..86f9747e1c 100644 --- a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java +++ b/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java @@ -32,4 +32,10 @@ public class ResourceEndpoint { .cacheControl(CacheControl.noCache()) .body(new TimestampDto(LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli())); } + + @RequestMapping(value = "/private/users/{name}", method = RequestMethod.GET) + public ResponseEntity getUserNotCached(@PathVariable("name") String name) { + return ResponseEntity.ok() + .body(new UserDto(name)); + } } diff --git a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/config/WebConfiguration.java b/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/config/WebConfiguration.java deleted file mode 100644 index decc57ec8b..0000000000 --- a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/config/WebConfiguration.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.cachecontrol.config; - -import org.springframework.http.CacheControl; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -import java.util.concurrent.TimeUnit; - -@EnableWebMvc -public class WebConfiguration extends WebMvcConfigurerAdapter { - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry - .addResourceHandler("/resources/**") - .addResourceLocations("/resources/") - .setCacheControl(CacheControl.maxAge(24, TimeUnit.HOURS)); - - } -} -